How to install LibreNMS in Ubuntu

To install LibreNMS in Ubuntu

LibreNMS is a network monitoring tool that supports wide range of network hardware and operating systems. Installation of LibreNMS in Ubuntu is explained in this manual.



  • Automatic discovery
  • Customizable alerting
  • Distributed Polling
  • Plugin system

To install LibreNMS

Run the following command to install the mysql-server.

root@linuxhelp:/home/user1# apt-get install mariadb-server 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (229-4ubuntu4) ...

Start the mysql service by running the following command.

root@linuxhelp:/home/user1# service mysql start 
Configure the mysql
root@linuxhelp:/home/user1# mysql_secure_installation 
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!

Login to mysql server and create database as shown below.

root@linuxhelp:/home/user1# mysql -u root -p 
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 50
Server version: 10.0.27-MariaDB-0ubuntu0.16.04.1 Ubuntu 16.04
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]> CREATE DATABASE librenms;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost' IDENTIFIED BY '123';
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit

Open and edit the mysql configuration file by utilizing the following command.

root@linuxhelp:/home/user1# nano /etc/mysql/mariadb.conf.d/50-server.cnf 

 Add the above lines inside the mysqld section


Then restart the mysql service with the following command.

root@linuxhelp:/home/user1# service mysql restart 

Next install the other dependency packages that are required for the libreNMS.

root@linuxhelp:/home/user1# apt-get install libapache2-mod-php7.0 php7.0-cli php7.0-mysql php7.0-gd php7.0-snmp php-pear php7.0-curl snmp graphviz php7.0-mcrypt php7.0-json apache2 fping imagemagick whois mtr-tiny nmap python-mysqldb snmpd php-net-ipv4 php-net-ipv6 rrdtool git 
Reading package lists... Done
Building dependency tree       
rocessing triggers for systemd (229-4ubuntu4) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for libapache2-mod-php7.0 (7.0.8-0ubuntu0.16.04.2) ...

Then edit the PHP configuration for setting the timezone.

In /etc/php/7.0/apache2/php.ini and /etc/php/7.0/cli/php.ini, ensure date.timezone is set to your preferred time zone.


After setting the time zone, enable the installed packages.


root@linuxhelp:/home/user1# a2enmod php7.0 
Considering conflict php5 for php7.0:
Module php7.0 already enabled
root@linuxhelp:/home/user1# a2dismod mpm_event 
Module mpm_event already disabled
root@linuxhelp:/home/user1# a2enmod mpm_prefork 
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Module mpm_prefork already enabled
root@linuxhelp:/home/user1# phpenmod mcrypt 


To create the libreNMS user

Run the following command to create the LibreNMS user.

root@linuxhelp:/home/user1# useradd librenms -d /opt/librenms -M -r
root@linuxhelp:/home/user1# usermod -a -G librenms www-data 

Download and extract the LibreNMS package by using the following command.

root@linuxhelp:/home/user1# cd /opt/
root@linuxhelp:/opt# git clone librenms 
Cloning into 'librenms'...
remote: Counting objects: 94203, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 94203 (delta 0), reused 0 (delta 0), pack-reused 94199
Receiving objects: 100% (94203/94203), 73.26 MiB | 339.00 KiB/s, done.
Resolving deltas: 100% (64337/64337), done.
Checking connectivity... done.

To make web UI ready for LibreNMS installation, do as directed.

root@linuxhelp:/opt# cd librenms/
root@linuxhelp:/opt/librenms# mkdir rrd logs
root@linuxhelp:/opt/librenms# chmod 775 rrd 

Now create a virtual host file for Apache configuration by using the following command and add the following lines into it.

root@linuxhelp:/opt/librenms# nano /etc/apache2/sites-available/librenms.conf 
<VirtualHost *:80>
  DocumentRoot /opt/librenms/html/
  ServerName  linuxhelp
  CustomLog /opt/librenms/logs/access_log combined
  ErrorLog /opt/librenms/logs/error_log
  AllowEncodedSlashes NoDecode
  <Directory "/opt/librenms/html/">
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews

Once the configuration is done, disable the default config file and then enable the librenms.conf file.

root@linuxhelp:/opt/librenms# a2dissite 000-default.conf
root@linuxhelp:/opt/librenms# a2ensite librenms.conf 
Enabling site librenms. 

To activate the new configuration, rewrite and restart the service of apache2.

root@linuxhelp:/opt/librenms# service apache2 reload
root@linuxhelp:/opt/librenms# a2enmod rewrite 
Enabling module rewrite.
root@linuxhelp:/opt/librenms# service apache2 restart 

Open the browser and navigate to http:/<IP_address>/install.php
Set the Database and click Next to proceed further.
Then click on Goto Add user.
Fill the user details and click Add user.
Create a config.php file and paste configuration. Add the following line at the end of the file and save it.

[root@linuxhelp librenms]# php addhost.php localhost public v2c 
Added device localhost (1)
Discover localhost:
[root@linuxhelp librenms]# php discovery.php -h all 
LibreNMS Discovery
Version info:
#### Unload disco module ntp ####
Discovered in 1.781 seconds
MySQL: Cell[1/0s] Row[10/0.01s] Rows[36/0.03s] Column[0/0s] Update[2/0.01s] Insert[2/0.02s] Delete[0/0s]
Create cronjob

By default, the LibreNMS cronjob runs with 16 threads. The current LibreNMS recommendation is to use 4 threads per core. The default if no thread count is 16 threads.
If the thread count needs to be changed, edit the cron file. Just add a number after,

[root@linuxhelp librenms]# /opt/librenms/ 12 >> /dev/null 2>&1
[root@linuxhelp librenms]# cp librenms.nonroot.cron /etc/cron.d/librenms 

Installation is successfully completed, refresh the page in the browser to get the login page.
To add device, enter the Hostname, SNMP version, Port association mode.
Navigate to Overview → Plugins → Plugin Admin
To know more about LibreNMS, click LibreNMS.

Thank you! for using Linux Help.

You find this tutorial helpful? Share with your friends to keep it alive.
For more help topics browse our website
Be the first to comment, we value your suggestions. For further queries please comment below.

Tags: Network Monitoring
user image Author :  Caden
user image
Steelfaith 29-03-2017 at 15:46
Same error as systemtech. How did you solve that error. Please help me.
user image
evanjayretuerto 30-03-2017 at 22:13
Not Found The requested URL /phpmyadmin was not found on this server. Apache/2.4.18 (Ubuntu) Server at localhost Port 80
user image
MmMMMMthatsalotofMs 01-04-2017 at 00:15
I to cannot get past [IP ADDRESS]/install.php One thing to note is that this is an AWS instance (port 80 inbound is whitelisted, though).
user image
MmMMMMthatsalotofMs 01-04-2017 at 00:24
Hoho so whatcha gotta do is the following. I'm not sure if the a2enmod rewrite and service apache2 restart are necessary, but it got me going in the right direction. a2dissite 000-default.conf service apache2 reload a2enmod rewrite service apache2 restart
user image
jagannatharumugam 01-04-2017 at 12:13
Hello, MmMMMMthatsalotofMs has pointed out the issue pretty well in his comment. By default it will load the 000-default.conf file, So jus disable this file and you need to enable the librenms.conf file. To disable, # a2dissite 000-default.conf To enable, # a2enmod librenms.conf Now restart the apache to take effect.
user image
jayjzz 06-06-2017 at 02:37
I'm stuck, can't seem to find this to edit it /etc/mysql/mariadb.conf.d/50-server.cnf - do I copy my.cnf to this?