1. Install required package
dnf -y install epel-release
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf module enable php:remi-7.3 -y
dnf install bash-completion composer-cli cronie fping git ImageMagick mariadb-server mtr nano net-snmp net-snmp-utils nginx nmap php-fpm php-cli php-common php-curl php-gd php-json php-mbstring php-process php-snmp php-xml php-zip php-mysqlnd python3 python3-PyMySQL python3-redis python3-memcached python3-pip rrdtool unzip
2. Add librenms user
useradd librenms -d /opt/librenms -M -r -s /usr/bin/bash
3. Download LibreNMS
cd /opt
git clone https://github.com/librenms/librenms.git
4. Set permissions
chown -R librenms:librenms /opt/librenms
chmod 771 /opt/librenms
setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
5. Install PHP dependencies
su - librenms
./scripts/composer_wrapper.php install --no-dev
exit
6. Set timezone in file /etc/php.ini
nano /etc/php.ini
Press Ctrl + W
to search word date.timezone
and update to Asia/Kuala_Lumpur
and remove ;
date.timezone = Asia/Kuala_Lumpur
Press Ctrl + x
to save
nano /etc/my.cnf.d/mariadb-server.cnf
Within the [mysqld]
section add:
innodb_file_per_table=1
lower_case_table_names=0
2. Enable and start the MariaDB Service
systemctl enable mariadb
systemctl restart mariadb
3. Run MariaDB wizard to set root password and disallow remote access to secure your DB
mysql_secure_installation
follow the selection below
Enter current password for root (enter for none): ENTER
...
Set root password? [Y/n] Y
New password: SETYOUROWNPASSWORD
Re-enter new password: RETYPE SETYOUROWNPASSWORD
...
Remove anonymous users? [Y/n] Y
...
Disallow root login remotely? [Y/n] Y
...
Remove test database and access to it? [Y/n] Y
...
Reload privilege tables now? [Y/n] Y
4. Login to MariaDB database server. Then enter the password you set in Step 3
mysql -u root -p
5. Create new database name “librenms”
CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
6. Create new user access for LibreNMS application. Replace YOURPASSWORD
to your own.
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'YOURPASSWORD';
7. Grant permission and reload privileges user. Then exit MariaDB database server
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
FLUSH PRIVILEGES;
exit;
mv /etc/php-fpm.d/www.conf /etc/php-fpm.d/librenms.conf
nano /etc/php-fpm.d/librenms.conf
Replace the following section:-
# Change "www" to "librenms"
[librenms]
# Change user and group to "librenms"
user = librenms
group = librenms
# Change listen to a unique name
listen = /run/php-fpm-librenms.sock
2. Create new file name librenms.conf
touch /etc/nginx/conf.d/librenms.conf
3. Add the following config, edit server_name
to your hostname:
nano /etc/nginx/conf.d/librenms.conf
copy all
server {
listen 80;
server_name XXXX.myren.net.my;
root /opt/librenms/html;
index index.php;
charset utf-8;
gzip on;
gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ [^/]\.php(/|$) {
fastcgi_pass unix:/run/php-fpm-librenms.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
3. Delete the server
section from /etc/nginx/nginx.conf
nano /etc/nginx/nginx.conf
4. Enable nginx service and php-fpm service
systemctl enable --now nginx
systemctl enable --now php-fpm
systemctl start nginx
systemctl start php-fpm
setenforce 0
2. Disable SELinux permanently. Edit file selinux
nano /etc/sysconfig/selinux
Change to disabled. example:-
SELINUX=disabled
3. Allow access http and https from public
firewall-cmd --zone public --add-service http --add-service https
firewall-cmd --permanent --zone public --add-service http --add-service https
firewall-cmd --reload
cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
2. Edit the text which says RANDOMSTRINGGOESHERE and set your own community string.
nano /etc/snmp/snmpd.conf
sample edited snmpd.conf
# Change RANDOMSTRINGGOESHERE to your preferred SNMP community string
com2sec readonly default myrennoc
group MyROGroup v2c readonly
view all included .1 80
access MyROGroup "" any noauth exact all none none
syslocation Level 10,Dataran PHB
syscontact Hamid <hamid@myren.net.my>
#Distro Detection
extend .1.3.6.1.4.1.2021.7890.1 distro /usr/bin/distro
3. Then enable and restart the service.
curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
chmod +x /usr/bin/distro
systemctl enable snmpd
systemctl restart snmpd
copy cron job file to cron.d service folder
cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms
open URL http://labXX.myren.net.my/install
and follow the on-screen instructions.
After finish the installation wizard, run :
chown librenms:librenms /opt/librenms/config.php
Then try access using browser http://labXX.myren.net.my