In this tutorial, we will show you how to install LibreNMS on Debian 10. For those of you who didn’t know, LibreNMS is an auto discovering PHP/MySQL/SNMP-based network monitoring which includes support for a wide range of network hardware and operating systems including Cisco, Linux, FreeBSD, Juniper, HP, and many more. LibreNMS is a community-supported fork of Observium.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the LibreNMS on a Debian 10 (Buster).
- A server running one of the following operating systems: Debian 10 (Buster).
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
non-root sudo useror access to the
root user. We recommend acting as a
non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.
Install LibreNMS on Debian 10 Buster
Step 1. Before running the tutorial below, it’s important to make sure your system is up to date by running the following
apt commands in the terminal:
sudo apt update
Step 2. Installing Required Packages.
Run the following commands below to install dependency required packages:
sudo apt install acl curl composer fping git graphviz imagemagick mariadb-client mariadb-server mtr-tiny nmap python-memcache python-mysqldb rrdtool snmp snmpd whois python3-pymysql python3-dotenv python3-redis python3-setuptools
Step 3. Install the LEMP stack.
A Debian 10 LEMP server is required. If you do not have LEMP installed, you can follow our guide here.
Step 4. Installing LibreNMS on Debian 10.
Before installation we create a user for LibreNMS:
useradd librenms -d /opt/librenms -M -r usermod -a -G librenms www-data
Now we download LibreNMS from the official website:
cd /opt git clone https://github.com/librenms/librenms.git
Next, change folders ownership permissions:
chown -R librenms:librenms /opt/librenms chmod 770 /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/
Step 4. Configuring MariaDB for LibreNMS.
By default, MariaDB is not hardened. You can secure MariaDB using the
mysql_secure_installation script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:
Configure it like this:
- 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
Next, we will need to log in to the MariaDB console and create a database for the LibreNMS. Run the following command:
mysql -u root -p
This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for LibreNMS installation:
MariaDB [(none)]> CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; MariaDB [(none)]> CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'password'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> exit
Once successfully create databases, now open the MariaDB configuration file and add the following lines under
[mysqld] section please add:
Then, restart MariaDB for the changes to take effect:
sudo systemctl restart mariadb
Step 5. Configure Nginx.
Now we create the VirtualHost definition for Nginx to be used by LibreNMS:
rm /etc/nginx/sites-enabled/default nano /etc/nginx/sites-available/librenms.vhost
Add the following config, edit
server_name as required:
Save and close also restart the Nginx web server so that the changes take place:
ln -s /etc/nginx/sites-available/librenms.vhost /etc/nginx/sites-enabled/librenms.vhost sudo systemctl restart nginx
Step 6. Configure snmpd.
Now edit the new configuration snmpd using nano text editors:
cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf chmod 600 /etc/snmp/snmpd.conf nano /etc/snmp/snmpd.conf
Edit the text which says
RANDOMSTRINGGOESHERE and set your own community string:
curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro chmod +x /usr/bin/distro service snmpd restart
Step 7. Configure UFW Firewall.
Add new ports to the firewall. Add new ssh, HTTP, HTTPS, and the port used by snmpd 161 udp type to the ufw firewall:
sudo ufw allow ssh sudo ufw allow http sudo ufw allow https sudo ufw allow 161/udp sudo ufw enable
Step 8. Accessing LibreNMS Web Interface.
Once successfully installed, LibreNMS will be available on HTTP port 80 by default. Open your favorite browser and navigate to
http://librenms.idroot.us/ and complete the required steps to finish the installation.
Congratulations! You have successfully installed LibreNMS. Thanks for using this tutorial for installing the latest version of the LibreNMS on the Debian system. For additional help or useful information, we recommend you check the official LibreNMS website.