Install LibreNMS Monitoring Tool on Debian 11 - Step by step guide ?

LibreNMS is a free, open-source, web-based, and auto-discovering network monitoring tool written in PHP.  It uses MySQL or MariaDB as a database backend and uses SNMP to discover the remote clients. It supports a wide range of network devices including, Linux, Cisco, Juniper, FreeBSD, HP, Windows, and more. It supports multiple authentication methods including, Radius, Active Directory, LDAP, MySQL, and more.

Here at Outsource Path, as part of our Server Management Services, we regularly help our Customers to perform related Linux system Monitoring queries.

In this context, we shall look into how to install LibreNMS with Nginx on Debian 11.

Steps to install LibreNMS with Nginx on Debian 11

1. Perform System Update

Before we install any software, it's important to make sure your system is up to date by running the following apt commands in the terminal:

$ sudo apt update
$ sudo apt upgrade

2. Install and Configure MariaDB Database

Now, you will need to install the MariaDB database server on your server. You can install it using the following command:

$ apt-get install mariadb-server -y

Once the install is completed, run the following script to secure the MariaDB installation and set a root password:

$ mysql_secure_installation

Then, Answer all the questions as shown below:

Enter current password for root (enter for none): 
Switch to unix_socket authentication [Y/n] n
Change the root password? [Y/n] Y
New password: 
Re-enter new password: 
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] 
Reload privilege tables now? [Y/n] Y

Once the MariaDB is secured, edit the MariaDB configuration file and tweak some settings:

$ nano /etc/mysql/mariadb.conf.d/50-server.cnf

In this file, Add the following lines inside [mysqld] section:


Save and close the file then restart the MariaDB to apply the changes:

$ systemctl restart mariadb

Next, log in to MariaDB with the following command:

$ mysql -u root -p

Once you are log in, create a database and user for LibreNMS:

MariaDB [(none)]> CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
MariaDB [(none)]> CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'securepassword';
Next, grant all the privileges to the LibreNMS database using the command below:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';

Finally, flush the privileges and exit from the MariaDB shell using the following command:

MariaDB [(none)]> EXIT;

Once you are done, you can proceed to the next step.

3. Install Nginx, PHP, and Required Dependencies

Next, you will need to install the Nginx web server, PHP, and other dependencies required by LibreNMS. You can install all of them by running the following command:

$ apt-get install nginx-full nmap php-cli php-curl php-fpm php-gd php-json php-mbstring php-mysql php-snmp php-xml php-zip python3-dotenv python3-pip python3-pymysql python3-redis python3-setuptools python3-systemd rrdtool snmp snmpd whois acl curl composer fping git graphviz imagemagick mtr-tiny

Once all the packages are installed, edit the php.ini file and set your time zone:

$ nano /etc/php/7.4/fpm/php.ini

Change the following line:

date.timezone = UTC

Save and close the file when you are finished.

4. Install and Configure LibreNMS

Here, create a dedicated user for LibreNMS using the following command:

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

Next, add the LibreNMS user to the www-data group with the following command:

$ usermod -a -G librenms www-data

Next, download the latest version of LibreNMS from the GitHub repository to the /opt directory:

$ git clone /opt/librenms

Next, set ownership and permission of LibreNMS directory:

$ chown -R librenms:librenms /opt/librenms
$ chmod 775 /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/

Next, change the user to LibreNMS with the following command:

$ su - librenms

Next, install the PHP composer using the following command:

$ cd /opt/librenms
./scripts/composer_wrapper.php install --no-dev

Once the Composer and other PHP dependencies are installed, you should see the following output:

> @php artisan optimize
Configuration cache cleared!
Configuration cached successfully!
Route cache cleared!
Routes cached successfully!
Files cached successfully!
> @php artisan config:clear
Configuration cache cleared!
> scripts/ || pip3 install --user -r requirements.txt || :
Requirement already satisfied: PyMySQL!=1.0.0 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 1)) (0.9.3)
Requirement already satisfied: python-dotenv in /usr/lib/python3/dist-packages (from -r requirements.txt (line 2)) (0.15.0)
Requirement already satisfied: redis>=3.0 in /usr/lib/python3/dist-packages (from -r requirements.txt (line 3)) (3.5.3)
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from -r requirements.txt (line 4)) (52.0.0)
Collecting psutil>=5.6.0
  Downloading psutil-5.8.0-cp39-cp39-manylinux2010_x86_64.whl (293 kB)
Collecting command_runner>=1.3.0
  Downloading command_runner-1.3.0-py3-none-any.whl (17 kB)
Installing collected packages: psutil, command-runner
Successfully installed command-runner-1.3.0 psutil-5.8.0

Next, exit from the LibreNMS user using the command below:

$ exit

Next, you will need to create a separate configuration file for PHP-FPM. You can create it with the following command:

$ cp /etc/php/7.4/fpm/pool.d/www.conf /etc/php/7.4/fpm/pool.d/librenms.conf

Next, edit the librenms.conf configuration file with your favorite editor:

$ nano /etc/php/7.4/fpm/pool.d/librenms.conf

Change [www-data] to [librenms] and also update the listening socket:

user = librenms
group = librenms
listen = /run/php-fpm-librenms.sock

Save and close the file then restart the PHP-FPM service to apply the configuration changes:

$ systemctl restart php7.4-fpm

Once you are finished, you can proceed to the next step.

5. Configure Nginx for LibreNMS

Next, you will need to create an Nginx virtual host configuration file for LibreNMS. 

You can create it with the following command:

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

Add the following lines:

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;

Save and close the file then verify the Nginx for any syntax error with the following command:

$ nginx -t

If everything is fine, you will get the following output:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Finally, restart the Nginx to apply the changes.

$ systemctl restart nginx php7.4-fpm

You can also verify the Nginx status using the following command:

$ systemctl status nginx

You should see the following output:

? nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2021-12-03 14:39:18 UTC; 18s ago
       Docs: man:nginx(8)
    Process: 39888 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 39892 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 39893 (nginx)
      Tasks: 2 (limit: 2341)
     Memory: 2.7M
        CPU: 42ms
     CGroup: /system.slice/nginx.service
             ??39893 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             ??39894 nginx: worker process
Dec 03 14:39:18 debian11 systemd[1]: Starting A high performance web server and a reverse proxy server...
Dec 03 14:39:18 debian11 systemd[1]: nginx.service: Failed to parse PID from file /run/ Invalid argument
Dec 03 14:39:18 debian11 systemd[1]: Started A high performance web server and a reverse proxy server.

Next, copy the cron job configuration file to enable automatic discovery and polling for newly added devices:

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

Next, copy the logrotate configuration file to rotate the old logs:

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

Once you are finished, you can proceed to the next step.

How to Access LibreNMS Web Installation Wizard ?

You can now access the LibreNMS web-based setup using the URL:

You should see the pre-install check page.

Make sure all checks are successfully then click on the database icon. You should see the database configuration page.

Provide your database information and click on the Check Credentials.

Now,  click on the key icon to set up an admin user.

Provide your admin username, password then click on the Add User button. 

Click on the Yes icon button.

Now, open another tab in your web browser and type the URL to validate the installation.

Provide your admin username, password and click on the Login button.

[Need help in configuring Nginx on your Debian system ? We can help you. ]


This article covers the complete procedure for installing the latest version of LibreNMS network monitoring system on Debian 11 Bullseye. In fact, LibreNMS is an auto discovering PHP/MySQL-based network monitoring system that includes support for a wide range of network hardware and operating systems including Cisco, Linux, FreeBSD, Juniper, Brocade, HP, and many more.

Recent Post