In this tutorial, we will show you how to install LibreNMS on Ubuntu 20.04 LTS. For those of you who didn’t know, LibreNMS is an open-source auto-discovering network monitoring tool for servers and network hardware. It supports a wide range of network hardware like Cisco, Juniper, Brocade, Foundry, HP, and operating systems including Linux and Windows. LibraNMS is a community-based fork of the Network monitoring tool “Observium“, released under GPLv3.
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 LibreNMS on Ubuntu 20.04 (Focal Fossa). You can follow the same instructions for Ubuntu 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
- A server running one of the following operating systems: Ubuntu 20.04, 18.04, 16.04, and any other Debian-based distribution like Linux Mint.
- 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 Ubuntu 20.04 LTS Focal Fossa
Step 1. First, make sure that all your system packages are up-to-date by running the following
apt commands in the terminal.
sudo apt update sudo apt upgrade
Step 2. Install the LEMP stack.
A Ubuntu 20.04 LEMP server is required. If you do not have LEMP installed, you can follow our guide here.
Step 3. Installing LibreNMS on Ubuntu 20.04.
Let us install the packages required for LibreNMS:
sudo install apt install curl composer fping git graphviz imagemagick rrdtool snmp snmpd whois unzip python python3-pip
Now we will grab the LibreNMS source from the GitHub repository:
cd /opt git clone https://github.com/librenms/librenms.git
Next, create a user that will manage LibreNMS and add Nginx to the LibreNMS group:
useradd librenms -d /opt/librenms -M -r usermod -a -G librenms www-data
We will need to change some folders 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/
After that, we are provided with a PHP script that will install the composer dependencies. To execute that we will use the following command. To execute this script we need to switch to LibreNMS user:
su - librenms cd /opt/librenms ./scripts/composer_wrapper.php install --no-dev exit
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 utf8 COLLATE utf8_unicode_ci; MariaDB [(none)]> CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'YOUR-PASSWD'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> exit
Once done, open the MariaDB configuration file and add the following lines under
Within the [mysqld] section please add:
Then, restart MariaDB for the changes to take effect:
sudo systemctl restart mariadb
Step 5. Configuring Nginx for LibreNMS.
Let’s create the VirtualHost definition for Nginx to be used by LibreNMS:
Add the following to the config file:
Now, we can restart the Nginx web server so that the changes take place:
sudo systemctl restart nginx
Step 6. Configure Firewall.
Allow Nginx through the firewall so that the user can able to access the LibreNMS portal from an external machine:
ufw allow 80/tcp ufw allow 443/tcp ufw reload
Step 7. Accessing LibreNMS Web Interface.
LibreNMS will be available on HTTP port 80 by default. Open your favorite browser and navigate to
http://server-ip-address/ and complete the required steps to finish the installation.
Congratulations! You have successfully installed LibreNMS. Thanks for using this tutorial for installing LibreNMS on your Ubuntu 20.04 LTS Focal Fossa system. For additional help or useful information, we recommend you to check the official LibreNMS website.