In this article, we will have explained the necessary steps to install LibreNMS on Debian 11. Before continuing with this tutorial, make sure you are logged in as a user with sudo
privileges. All the commands in this tutorial should be run as a non-root user.
LibreNMS is an auto discovering PHP/MySQL-based network monitoring system. It displays a series of graphs suitable for bandwidth and system resource utilization analysis. LibreNMS also supports a wide range of network devices including, Linux, Cisco, Juniper, Windows, and more. It supports multiple authentication methods including, Radius, Active Directory, LDAP, MySQL, and more.
Install LibreNMS on Debian 11
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo apt update sudo apt upgrade sudo apt install software-properties-common wget
Step 2. Install LEMP stack.
You’re going to need to set Debian up as either a LEMP server. If you haven’t done so already, use our traditional LEMP guide to set up Debian to serve before you continue.
Step 3. Creating a MySQL database for LibreNMS.
LibreNMS uses the MySQL database to store all its data. Log in to your MySQL server with the following command and enter your MySQL root password:
mysql -u root -p
Once you’re in the MySQL console, create a new database:
MariaDB [(none)]> CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; MariaDB [(none)]> CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'secure-your-password'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> EXIT;
Step 4. Create LibreNMS User.
Now create a dedicated user for LibreNMS using the following command:
useradd librenms -d /opt/librenms -M -r -s /bin/bash usermod -a -G librenms www-data
Step 5. Install LibreNMS on Debian Bullseye system.
We now need to clone the LIbreNMS software from GitHub with the command:
git clone https://github.com/librenms/librenms.git /opt/librenms
Next, set ownership and permission 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, running a composer Wrapper on Debian:
su - librenms cd /opt/librenms ./scripts/composer_wrapper.php install --no-dev
When complete, issue the exit command to return to the root user:
exit
Step 6. Configuring PHP-FPM.
Now 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
Then, edit the librenms.conf
configuration file:
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
After this, enable and restart php-fpm:
systemctl restart php7.4-fpm
Step 7. Configuring Nginx
Next steps, create an Nginx virtual host configuration file for LibreNMS:
nano /etc/nginx/conf.d/librenms.conf
Add the following configuration:
server { listen 80; server_name libre.your-domain.com; 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; } }
Finally, restart the Nginx and php-fpm to apply the changes:
sudo systemctl restart nginx sudo systemctl restart php7.4-fpm
Step 8. Configuring Cron job.
Now copy the cron job and logrotate configuration file to enable automatic discovery and polling for newly added devices:
cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms
Step 9. Access LibreNMS Web Installation.
Now open your browser and input the following address to launch the installation webpage.
http://librenms.your-domian.com/
That’s all you need to do to install LibreNMS on Debian (Bullseye). I hope you find this quick tip helpful. For further reading LibreNMS network monitoring on Debian’s system, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.