From Morose Ostrich, 2 Years ago, written in Plain Text.
This paste is a reply to LibreNMS installation bug from lbsoulliere - go back
Embed
[/opt]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.1 (Ootpa)

dnf -y install zip unzip git cronie wget fping net-snmp net-snmp-utils  jwhois mtr rrdtool  nmap
yum install php73-php-mbstring php73-php-pecl-zip php73-php-process php73-php-snmp php73-php-xml

[/opt/librenms]# yum list installed | grep php
php73.x86_64                                             2.0-1.el8.remi                           @remi-safe
php73-php-cli.x86_64                                     7.3.11-1.el8.remi                        @remi-safe
php73-php-common.x86_64                                  7.3.11-1.el8.remi                        @remi-safe
php73-php-fpm.x86_64                                     7.3.11-1.el8.remi                        @remi-safe
php73-php-gd.x86_64                                      7.3.11-1.el8.remi                        @remi-safe
php73-php-json.x86_64                                    7.3.11-1.el8.remi                        @remi-safe
php73-php-ldap.x86_64                                    7.3.11-1.el8.remi                        @remi-safe
php73-php-mbstring.x86_64                                7.3.11-1.el8.remi                        @remi-safe
php73-php-mysqlnd.x86_64                                 7.3.11-1.el8.remi                        @remi-safe
php73-php-pdo.x86_64                                     7.3.11-1.el8.remi                        @remi-safe
php73-php-pecl-zip.x86_64                                1.15.5-1.el8.remi                        @remi-safe
php73-php-process.x86_64                                 7.3.11-1.el8.remi                        @remi-safe
php73-php-snmp.x86_64                                    7.3.11-1.el8.remi                        @remi-safe
php73-php-sqlsrv.x86_64                                  5.6.1-2.el8.remi                         @remi-safe
php73-php-xml.x86_64                                     7.3.11-1.el8.remi                        @remi-safe
php73-runtime.x86_64                                     2.0-1.el8.remi                           @remi-safe

CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'librenms'@'%' IDENTIFIED BY 'mypass';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'%';
FLUSH PRIVILEGES;
exit

On database server :
vi /etc/my.cnf.d/mariadb-server.cnf
[mysqld]
innodb_file_per_table=1
lower_case_table_names=0

systemctl restart mariadb


Back to server :

useradd librenms -d /opt/librenms -M -r
usermod -a -G librenms apache
cd /opt
git clone https://github.com/librenms/librenms.git
chown librenms:librenms -R /opt/librenms

cd /opt/librenms
scl enable php73 './scripts/composer_wrapper.php install --no-dev'
output : all ok

vi /etc/httpd/conf.d/librenms.conf

<VirtualHost>
  DocumentRoot /opt/librenms/html/
  ServerName  librenms.example.com

  AllowEncodedSlashes NoDecode
  <Directory>
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews
  </Directory>
</VirtualHost>

cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms
cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms

sudo chown -R librenms:librenms /opt/librenms
setfacl -d -m g::rwx /opt/librenms/logs
sudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
sudo setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/

[/opt/librenms]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          permissive
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Memory protection checking:     actual (secure)
Max kernel policy version:      31

[root@tcn00qubc02415 /opt/librenms]# firewall-cmd --list-all
FirewallD is not running

[root@tcn00qubc02415 /opt/librenms]# nft list ruleset
table ip filter {
        chain INPUT {
                type filter hook input priority 0; policy accept;
        }

        chain FORWARD {
                type filter hook forward priority 0; policy accept;
        }

        chain OUTPUT {
                type filter hook output priority 0; policy accept;
        }
}

[root@tcn00qubc02415 /opt/librenms]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

[/opt/librenms]# ip rule list
0:      from all lookup local
32766:  from all lookup main
32767:  from all lookup default

[root@tcn00qubc02415 /opt/librenms]# ip route
default via 10.249.100.1 dev ens192 proto static metric 100
10.xxx.xxx.0/24 dev ens192 proto kernel scope link src 10.xxx.xxx.202 metric 100

Stage 0 of 6 complete
Stage 1 of 6 complete

username : librenms
password : mypass
host : 10.xxx.xxx.88
port : 3306

Stage 2 of 6 : 

Starting Update...
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')
Error!

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.

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.

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 :

"vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php"
   
     return isset($port)
                    ? "mysql:host=10.xxx.xxx.88;port=3306;dbname=librenms"
                    : "mysql:host={$host};dbname={$database}";

Can someone explain what I did wrong or if it is a bug?

Thanks!