From Morose Ostrich, 2 Years ago, written in Plain Text.
This paste is a reply to LibreNMS installation bug from lbsoulliere - view diff
Embed
  1. [/opt]# cat /etc/redhat-release
  2. Red Hat Enterprise Linux release 8.1 (Ootpa)
  3.  
  4. dnf -y install zip unzip git cronie wget fping net-snmp net-snmp-utils  jwhois mtr rrdtool  nmap
  5. yum install php73-php-mbstring php73-php-pecl-zip php73-php-process php73-php-snmp php73-php-xml
  6.  
  7. [/opt/librenms]# yum list installed | grep php
  8. php73.x86_64                                             2.0-1.el8.remi                           @remi-safe
  9. php73-php-cli.x86_64                                     7.3.11-1.el8.remi                        @remi-safe
  10. php73-php-common.x86_64                                  7.3.11-1.el8.remi                        @remi-safe
  11. php73-php-fpm.x86_64                                     7.3.11-1.el8.remi                        @remi-safe
  12. php73-php-gd.x86_64                                      7.3.11-1.el8.remi                        @remi-safe
  13. php73-php-json.x86_64                                    7.3.11-1.el8.remi                        @remi-safe
  14. php73-php-ldap.x86_64                                    7.3.11-1.el8.remi                        @remi-safe
  15. php73-php-mbstring.x86_64                                7.3.11-1.el8.remi                        @remi-safe
  16. php73-php-mysqlnd.x86_64                                 7.3.11-1.el8.remi                        @remi-safe
  17. php73-php-pdo.x86_64                                     7.3.11-1.el8.remi                        @remi-safe
  18. php73-php-pecl-zip.x86_64                                1.15.5-1.el8.remi                        @remi-safe
  19. php73-php-process.x86_64                                 7.3.11-1.el8.remi                        @remi-safe
  20. php73-php-snmp.x86_64                                    7.3.11-1.el8.remi                        @remi-safe
  21. php73-php-sqlsrv.x86_64                                  5.6.1-2.el8.remi                         @remi-safe
  22. php73-php-xml.x86_64                                     7.3.11-1.el8.remi                        @remi-safe
  23. php73-runtime.x86_64                                     2.0-1.el8.remi                           @remi-safe
  24.  
  25. CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
  26. CREATE USER 'librenms'@'%' IDENTIFIED BY 'mypass';
  27. GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'%';
  28. FLUSH PRIVILEGES;
  29. exit
  30.  
  31. On database server :
  32. vi /etc/my.cnf.d/mariadb-server.cnf
  33. [mysqld]
  34. innodb_file_per_table=1
  35. lower_case_table_names=0
  36.  
  37. systemctl restart mariadb
  38.  
  39.  
  40. Back to server :
  41.  
  42. useradd librenms -d /opt/librenms -M -r
  43. usermod -a -G librenms apache
  44. cd /opt
  45. git clone https://github.com/librenms/librenms.git
  46. chown librenms:librenms -R /opt/librenms
  47.  
  48. cd /opt/librenms
  49. scl enable php73 './scripts/composer_wrapper.php install --no-dev'
  50. output : all ok
  51.  
  52. vi /etc/httpd/conf.d/librenms.conf
  53.  
  54. <VirtualHost>
  55.   DocumentRoot /opt/librenms/html/
  56.   ServerName  librenms.example.com
  57.  
  58.   AllowEncodedSlashes NoDecode
  59.   <Directory>
  60.     Require all granted
  61.     AllowOverride All
  62.     Options FollowSymLinks MultiViews
  63.   </Directory>
  64. </VirtualHost>
  65.  
  66. cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms
  67. cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms
  68.  
  69. sudo chown -R librenms:librenms /opt/librenms
  70. setfacl -d -m g::rwx /opt/librenms/logs
  71. sudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
  72. sudo setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
  73.  
  74. [/opt/librenms]# sestatus
  75. SELinux status:                 enabled
  76. SELinuxfs mount:                /sys/fs/selinux
  77. SELinux root directory:         /etc/selinux
  78. Loaded policy name:             targeted
  79. Current mode:                   permissive
  80. Mode from config file:          permissive
  81. Policy MLS status:              enabled
  82. Policy deny_unknown status:     allowed
  83. Memory protection checking:     actual (secure)
  84. Max kernel policy version:      31
  85.  
  86. [root@tcn00qubc02415 /opt/librenms]# firewall-cmd --list-all
  87. FirewallD is not running
  88.  
  89. [root@tcn00qubc02415 /opt/librenms]# nft list ruleset
  90. table ip filter {
  91.         chain INPUT {
  92.                 type filter hook input priority 0; policy accept;
  93.         }
  94.  
  95.         chain FORWARD {
  96.                 type filter hook forward priority 0; policy accept;
  97.         }
  98.  
  99.         chain OUTPUT {
  100.                 type filter hook output priority 0; policy accept;
  101.         }
  102. }
  103.  
  104. [root@tcn00qubc02415 /opt/librenms]# iptables -L
  105. Chain INPUT (policy ACCEPT)
  106. target     prot opt source               destination
  107.  
  108. Chain FORWARD (policy ACCEPT)
  109. target     prot opt source               destination
  110.  
  111. Chain OUTPUT (policy ACCEPT)
  112. target     prot opt source               destination
  113.  
  114. [/opt/librenms]# ip rule list
  115. 0:      from all lookup local
  116. 32766:  from all lookup main
  117. 32767:  from all lookup default
  118.  
  119. [root@tcn00qubc02415 /opt/librenms]# ip route
  120. default via 10.249.100.1 dev ens192 proto static metric 100
  121. 10.xxx.xxx.0/24 dev ens192 proto kernel scope link src 10.xxx.xxx.202 metric 100
  122.  
  123. Stage 0 of 6 complete
  124. Stage 1 of 6 complete
  125.  
  126. username : librenms
  127. password : mypass
  128. host : 10.xxx.xxx.88
  129. port : 3306
  130.  
  131. Stage 2 of 6 :
  132.  
  133. Starting Update...
  134. SQLSTATE[HY000] [2002] No route to host (SQL: select * from information_schema.tables where table_schema = librenms and table_name = migrations and table_type = 'BASE TABLE')
  135. Error!
  136.  
  137. The only thing special about my setup is that the mysql server is on another server. If I do a ping or telnet 3306 to the bd server from the librenms server, it is working. Both server are on the same subnet.
  138.  
  139. What is even more weird is that the stage 1 of 6 is working... so the connection is working. I'm able to connect to this database from other host.
  140.  
  141. What I finally did was to hardcode the ip and the port of my database server and now I can get past this stage and complete the wizard :
  142.  
  143. "vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php"
  144.    
  145.      return isset($port)
  146.                     ? "mysql:host=10.xxx.xxx.88;port=3306;dbname=librenms"
  147.                     : "mysql:host={$host};dbname={$database}";
  148.  
  149. Can someone explain what I did wrong or if it is a bug?
  150.  
  151. Thanks!