How to Install LibreNMS on CentOS 8

LibreNMS is an open-source network monitoring tool. We can monitor a wide range of network devices such as Cisco, Juniper, Foundry, FreeBSD, Brocade, HP, different operating systems such as Linux, FreeBSD, Windows as well and pretty much anything that supports SNMP polling.

It’s feature set includes automatic discovery, customizable alerts, API access, billing system for ports on the network, automatic updates and many more. It also has multiple authentication methods like MySQL, HTTP, LDAP, Radius, Active Directory.

We can also get the LibreNMS native Android and iOS app so that we can monitor our devices while roaming everywhere.


For this tutorial, we will be using CentOS 8 as the host operating system. Here is a brief overview of the steps we will be following in the tutorial.

  1. Some pre-requisite operations
  2. Configuring SELinux
  3. Installing Dependencies and setting user permission
  4. Setup Database
  5. Web engine configuration (Nginx)
  6. Setup Web Interface
  7. Adding a device to monitor

Step 1: Pre-Requisites

Before we begin with the installation let us make sure that our system is up to date.

dnf -y update

Now let’s install all repos which are required to install LibreNMS on Centos 8. All dependencies are found in both Epel and Remi repository. Remi repo to get the latest PHP package and EPEL repo to satisfy the dependencies.

dnf -y install
dnf -y install 

We are also required to enable PHP-7.4 stream because by default PHP-7.2 is enabled and latest LibreNMS requires PHP-7.3 and above.

dnf module reset php
dnf module enable php:remi-7.4
dnf update

Step 2: SELinux

Before we can start with our installation it is advised that we disable SELinux or set it to permissive mode so that it will not hinder the installation process. To do this, we will edit the SELinux config file.

nano /etc/selinux/config
Here we set it to the permissive mode

Make sure to reboot your server after changing the SELinux config.

Step 3: Dependencies

Let’s install the packages required for LibreNMS to run on Ubuntu 20.

dnf install bash-completion cronie fping git ImageMagick mariadb-server mtr 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 

Now let’s create LibreNMS user.

useradd librenms -d /opt/librenms -M -r -s /usr/bin/bash 

Finally, it’s time to clone the latest LibreNMS repo under /opt

cd /opt && git clone

Since we have a new user to manage LibreNMS, we are required to provide the user with the privileges and set permissions for directories.

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/ 

We are provided with a PHP script that will install the composer dependencies. To execute that script we need to switch to librenms user.

su - librenms
./scripts/composer_wrapper.php install --no-dev

Step 4: Setting up Database

We will be using MariaDB on Centos8 for LibreNMS. It is a fork of MySQL and is quite similar to mysql-server. We have already installed the MariaDB in the dependencies section.

systemctl start mariadb
systemctl enable mariadb

To set up MariaDB, we will use


Here we will:

  • Set up root password for database
  • Remove anonymous users
  • Disallow root login remotely
  • Remove test databases
  • Reload Privileges table

We will now create our database which will be used by LibreNMS. First login as the root user with the password you set.

mysql -u root -p

Next we are required to create a database and a user, Do not forget to change the ‘password’ below to something secure

CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';

In the MariaDB config file, we need to add two lines.

nano /etc/my.cnf.d/mariadb-server.cnf

Add the following lines under [mysqld] section


Then restart MariaDB

systemctl restart mariadb

Step 5: PHP-FPM and Nginx set up

For PHP-FPM to work with Nginx, we are required to make changes to the config file

cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/librenms.conf 
nano /etc/php-fpm.d/librenms.conf 

We will edit the following values.

# Change "www" to "librenms"
# Change user and group to "librenms" 
user = librenms 
group = librenms 
# Change listen to a unique name 
listen = /run/php-fpm-librenms.sock 

After a quick restart, PHP-FPM should be now ready to go.

systemctl start php-fpm

For Nginx, we will make a config file.

nano /etc/nginx/conf.d/librenms.conf

Now add the following lines in the librenms.conf file and replace server_name with your IP Address or FQDN.

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 ~ [^/]\.php(/|$) {   fastcgi_pass unix:/run/php-fpm-librenms.sock;
   fastcgi_split_path_info ^(.+\.php)(/.+)$;
   include fastcgi.conf;
  location ~ /\.(?!well-known).* { 
   deny all;

Also, we should not forget to remove the default server section from the nginx.conf file.

nano /etc/nginx/nginx.conf
Here we removed the contents of server section

Now start and enable the Nginx so that it will start with system restart

systemctl start nginx
systemctl enable nginx

Step 6: Miscellaneous:


We can either disable the firewalld

systemctl stop firewalld
systemctl disable firewalld

Or we can allow access through the firewalld by using the following commands.

firewall-cmd --zone public --add-service http
firewall-cmd --permanent --zone public --add-service http
firewall-cmd --zone public --add-service https
firewall-cmd --permanent --zone public --add-service https


Copy the sample config file to its required destination

cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf

We have to edit the RANDOMSTRINGGOESHERE provided in the snmpd.conf file.

nano /etc/snmp/snmpd.conf

Now we will run the following commands to get it set up and started

curl -o /usr/bin/distro
chmod +x /usr/bin/distro
systemctl enable snmpd
systemctl restart snmpd


LibreNMS has it’s own cron jobs that are used to poll and discover the devices in your network, copy it’s cron file and paste it inside /etc/cron.d directory.

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


LibreNMS logs can be found in /opt/librenms/logs directory which can grow up to be quite large at some time in future. We can use the logrotate config provided to counter this problem.

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


It is important for each component that we have installed to work on the same timezone as our server.

On CentOS

To check timezone on CentOS 8 we can use


If you want to change it, we will first look at available timezones

timedatectl list-timezones | grep  -i continent

Change the ‘continent’ with your continent to make the search easier. Now to change the timezone we will use. Edit the following command with your timezone instead of Europe/London.

 timedatectl set-timezone Europe/London


Time zone can be set in the php.ini file found in /etc

nano /etc/php.ini

Edit the date_timezone under the [Module Setting] section. Use the same timezone as used above.

Now restart php-fpm and we are good to go.

systemctl restart php-fpm

Step 7: Web Installer

Now on your browser, open the address of your server, In our case, it was Yours might be different. It will take you to the web interface for the next steps in the setup process.

Enter the database user password when prompted.

Next, it will build the Database. If you do not see any errors then we are good to go.

Then we will be creating a user to manage LibreNMS web interface.

Now click on ‘validate your install and fix any issues’ To validate our install.

We will be using the same user we created in the web interface to login

If you see the above screen then it means that LibreNMS is properly installed and we are good to go for further configuration.

Step 8: Adding a New Device

We will be adding a Linux device running Debian 10. We will be using SNMP to collect and organize information from our device

On the device, we will install snmpd

apt install snmpd 

Now replace the snmpd.conf file with the example below. And also change the community string appropriately.

 # Change RANDOMSTRINGGOESHERE to your preferred SNMP community string  
 com2sec readonly  default         RANDOMSTRINGGOESHERE 
 group MyROGroup v2c        readonly 
 view all    included  .1                               80  
 access MyROGroup ""      any       noauth    exact  all    none   none 
 syslocation Rack, Room, Building, City, Country [GPSX,Y] 
 syscontact Your Name <your@email.address>  
 #Distro Detection  
 extend . distro /usr/bin/distro 
 #Hardware Detection (uncomment to enable)  
 #extend . hardware '/bin/cat /sys/devices/virtual/dmi/id/product_name'  
 #extend . manufacturer '/bin/cat /sys/devices/virtual/dmi/id/sys_vendor' 
 #extend . serial '/bin/cat /sys/devices/virtual/dmi/id/product_serial'  
Note: Restart snmpd service after changing it's config file.

Now we will head to the add device section in the Web Interface

Add your hostname or IP in its respective section. The default SNMP port is 161 so we will enter the port as 161. At last enter the community string in the Community section

After a few minutes, you will be able to see your device in the devices section.

You have successfully installed your LibreNMS server on Centos 8.Thank you for reading this blog, if you guys have any questions or you got stuck anywhere please feel free to mention in the comment section below.

6 Replies to “How to Install LibreNMS on CentOS 8”

  1. Hi,
    Really nice guide, thank you.

    At the end on validation, I get this warning:

    Warning: Global lnms shortcut not installed. lnms command must be run with full path
    sudo ln -s /opt/librenms/lnms /usr/local/bin/lnms

    Is there any way to fix this?

Leave a Reply

Your email address will not be published. Required fields are marked *