Featured image

Digital Avenue DevOps Tutorials


What is LibreNMS ?

LibreNMS is an opensource monitoring tool for servers and network hardware. Based on Nginx or Apache, MySQL, and PHP. LibreNMS can discover network using UDP, FDP, LLDP, OSPF, BGP, SNMP and ARP portocols.Collects monitoring metrices via SNMP protocol.


1.Root login

2.CenstOS 7

3.EPEL repository


STEP 1:-Install Required Packages.

STEP 2:-Install NginX Web Server.

STEP 3:-Install and Configure MariaDB.

STEP 4:-Download and Configure LibreNMS.

STEP 5:-LibreNMS Web-based Installation.

STEP 6:-Firewall and SELinux Configuration.

STEP 7:-Install FPing and SNMP.

STEP 8:-Set Permission.

STEP 9:-LibreNMS Web Installation.

STEP 1:- Install Required Packages

Configure EPEL Repository.

[root@LibreNMS ~]# rpm -Uvh

Digital Avenue DevOps Tutorials

Configure Webtatic Repository.

[root@LibreNMS ~]# rpm -Uvh

Digital Avenue DevOps Tutorials

Install some packages including ImageMagic, rrdtool, git, snmp, nmap, fping and more.

[root@LibreNMS ~]# yum install -y cronie fping git ImageMagick jwhois mtr net-snmp net-snmp-utils nmap rrdtool MySQL-python python-memcached

STEP 2:- Install Nginx Web Server

[root@LibreNMS ~]# yum install -y nginx
[root@LibreNMS ~]# systemctl enable nginx
[root@LibreNMS ~]# systemctl start  nginx

Digital Avenue DevOps Tutorials

STEP 3:- Install and Configure PHP-FPM

Install PHP-FPM version 7 for CentOS7 from Webtatic repository. Webtatic repository has been installed on previous step.

[root@LibreNMS ~]# yum install -y composer php72w php72w-cli php72w-common php72w-curl php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-process php72w-snmp php72w-xml php72w-zip

Update the PEAR (PHP Extension and Application Repository) repository.

[root@LibreNMS ~]# yum install php72w-pear.noarch
[root@LibreNMS ~]# pear channel-update
[root@LibreNMS ~]# pear install Net_IPv4-1.3.4
[root@LibreNMS ~]# pear install Net_IPv6-1.2.2b2

Digital Avenue DevOps Tutorials

Set default timezone in the php.ini file. un-comment and edit look like below.

date.timezone = Asia/Colombo


Now, Set PHP-FPM to running under the ‘sock’ file instead of the server port.

[root@LibreNMS ~]# vim /etc/php-fpm.d/www.conf

Change ‘listen’ port line to the sock file below.

touch /var/run/php-fpm/php7.2-fpm.sock chmod 777
listen = /var/run/php-fpm/php7.2-fpm.sock

Ucomment the ‘listen’ owner, group and the permission of the sock file.

listen.owner = nginx = nginx
listen.mode = 0660
[root@LibreNMS ~]# systemctl start php-fpm.service 
[root@LibreNMS ~]# systemctl enable php-fpm.service

Now, PHP-FPM should running under the sock file.

[root@LibreNMS ~]# netstat  -pl | grep php

Digital Avenue DevOps Tutorials

STEP 3:- Install and Configure MariaDB

Install MariaDB

[root@LibreNMS ~]# yum install -y mariadb mariadb-server 
[root@LibreNMS ~]# systemctl start mariadb.service 
[root@LibreNMS ~]# systemctl enable mariadb.service

Digital Avenue DevOps Tutorials

Set root password? [Y/n] Y

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

Create a new database and a user for LibreNMS.

Create database named “librenms” and a user named “librenms” with password **

[root@LibreNMS ~]# mysql -u root –p
MariaDB [(none)]> CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
MariaDB [(none)]> CREATE USER 'librenms'@'localhost' IDENTIFIED BY '<PASSWORD>';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
MariaDB [(none)]> quit;

Digital Avenue DevOps Tutorials

Edit /etc/my.cnf file and add new configuration.

Paste below additional configuration under the ‘[mysqld]’ section.




Digital Avenue DevOps Tutorials

[root@LibreNMS ~]# systemctl restart mariadb.service

STEP 4:- Download and Configure LibreNMS

Create new system user named ‘librenms’ and define the home directory under ‘/opt/librenms’ and add ‘librenms’ user to ‘nginx’ group.

[root@LibreNMS ~]# useradd librenms -d /opt/librenms -M -r
[root@LibreNMS ~]# usermod -a -G librenms nginx

Clone LibreNMS into /opt/librenms directory.

[root@LibreNMS opt]# cd /opt/
[root@LibreNMS opt]# git clone librenms

This Step is optional…

Create new directories for LibreNMS logs and rrd files.

[root@LibreNMS opt]# mkdir -p /opt/librenms/{logs,rrd}
[root@LibreNMS opt]# chmod 755 /opt/librenms/rrd/

Digital Avenue DevOps Tutorials

Digital Avenue DevOps Tutorials

Change ownership of all files and directories under ‘/opt/librenms’ to the ‘librenms’ user and group.

[root@LibreNMS opt]# chown -R librenms:librenms /opt/librenms/

Digital Avenue DevOps Tutorials

Configure LibreNMS virtual host

LibreNMS is a Web-based application and we using Nginx web server to host it. Create a new virtual host file user ‘librenms.conf’ under Nginx ‘conf.d’ directory.

[root@LibreNMS ~]# vim /etc/nginx/conf.d/librenms.conf

Paste configuration below.

server {
 listen      80;
 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 /api/v0 {
  try_files $uri $uri/ /api_v0.php?$query_string;
 location ~ \.php {
  include fastcgi.conf;
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  fastcgi_pass unix:/var/run/php-fpm/php7.2-fpm.sock;
 location ~ /\.ht {
  deny all;