Tech News

How to Install and Configure LibreNMS on Ubuntu 16.04 Server

LibreNMS is an open source autodiscovering PHP/MySQL/SNMP based network monitoring which includes support for a wide range of network hardware and operating systems including Cisco, Linux, FreeBSD, Juniper, Brocade, Foundry, HP and many more.

If you are not interested in written instruction then you can watch the below step by step video tutorial.


Automatic discovery: Automatically discover your entire network using CDP, FDP, LLDP, OSPF, BGP, SNMP and ARP.
Customisable alerting: Highly flexible alerting system, notify via email, irc, slack and more.
API Access: A full API to manage, graph and retrieve data from your install.
Billing system: Generate bandwidth bills for ports on your network based on usage or transfer.
Automatic Updates: Stay upto date automatically with bug fixes, new features and more.
Distributed Polling: Horizontal scaling to grow with your network.
iPhone App: Native iPhone App is available which provides core functionality.
Android App: Native Android App is available which provides core functionality.

Authentication methods:

Active Directory

In this tutorial, we will show you how to install and configure LibreNMS on Ubuntu 16.04 server with Nginx as webserver and MariaDB as database.


One Ubuntu 16.04 Server with a non-root user having sudo privileges

Installing Required Packages

The first step we must do for installing LibreNMS Monitoring Tools is to install some packages needed on the server.

sudo apt-get update
sudo apt-get install composer fping git graphviz imagemagick mariadb-client mariadb-server mtr-tiny nginx-full nmap php7.0-cli php7.0-curl php7.0-fpm php7.0-gd php7.0-mcrypt php7.0-mysql php7.0-snmp php7.0-xml php7.0-zip python-memcache python-mysqldb rrdtool snmp snmpd whois

Adding librenms user

sudo useradd librenms -d /opt/librenms -M -r
sudo usermod -a -G librenms www-data

Download LibreNMS

cd /opt
sudo git clone librenms

Configure MySQL

sudo systemctl restart mysql
sudo mysql -u root -p

CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';

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

Within the [mysqld] section please add:


Save and close.

Configure and Start PHP-FPM

Ensure date.timezone is set in php.ini to your preferred time zone. See for a list of supported timezones. Valid examples are: "America/New_York", "Australia/Brisbane", "Etc/UTC".

sudo nano /etc/php/7.0/fpm/php.ini
sudo nano /etc/php/7.0/cli/php.ini

Uncomment the 'date.time' line and change the value with your system timezone.

date.time = Asia/Pakistan

Save and close.

sudo phpenmod mcrypt
sudo systemctl restart php7.0-fpm

sudo systemctl restart mysql

Configure NGINX

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

Add the following config, edit server_name as required:

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 /api/v0 {
  try_files $uri $uri/ /api_v0.php?$query_string;
 location ~ \.php {
  include fastcgi.conf;
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
 location ~ /\.ht {
  deny all;

Save and close

sudo rm /etc/nginx/sites-enabled/default
sudo systemctl restart nginx

Configure snmpd

sudo cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
sudo nano /etc/snmp/snmpd.conf

Edit the text which says RANDOMSTRINGGOESHERE and set your own community string.

com2sec readonly  default         technocracy

Save and close.

sudo curl -o /usr/bin/distro
sudo chmod +x /usr/bin/distro
sudo systemctl restart snmpd

Configure Cron job

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

Copy logrotate config
LibreNMS keeps logs in /opt/librenms/logs. Over time these can become large and be rotated out. To rotate out the old logs you can use the provided logrotate config file:

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

Set permissions

sudo chown -R librenms:librenms /opt/librenms
sudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs
sudo setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs

Now, we need to allow ssh, http, https and the port used by snmpd 161 udp type from the ufw firewall.

sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw allow 161/udp
sudo ufw enable

Run the 'ufw status' command to see the firewall status.

sudo ufw status

Installing LibreNMS

We need to install LibreNMS through the web browser. Open your web browser, type the LibreNMS domain name '' in the address bar and press Enter.

You will be redirected to the install.php page showing the result of PHP module support checks.

Make sure all status is green as shown below.

Click 'Next Stage' to continue.

Fill all the database info with your own db.

DB User: librenms
DB Pass: password
DB Name: librenms

Click Next Stage

Wait for the installer script to import sample of database to our database - do not close the browser tab during this process.

Once done, click 'Goto Add User'.

Type your admin user, email, and password.

Click 'Add User'.

Click the 'Generate Config' button.

And you will get a config file similar to the one shown below.

Copy the php config script, and return back to your terminal session. Goto the '/opt/librenms' directory and create the 'config.php' file manually.

cd /etc/librenms/
sudo nano config.php

Paste the configuration there, and change the ownership of the file to librenms user and group.

sudo chown librenms:librenms config.php

Return back to your web browser and click the 'Finish Install' button.

You are reached to last page from the librenms web installer as shown below.

Go to the librenms directory and run the validate script.

cd /opt/librenms/
sudo ./validate.php

If your installation is correct, you will get the result as shown below.

You are done.


  1. Issue looking on web access time :- Error: Missing dependencies! Run the following command to fix:
    ./scripts/composer_wrapper.php install --no-dev

    Please give me solutions.

    Thanks:- Chandan Kr. Raj

    1. You need to execute this ./scripts/composer_wrapper.php install --no-dev

    2. for me i get this "bash: ./scripts/composer_wrapper.php: No such file or directory"

    3. You should run the script from inside of /opt/librenms

      If you are root then:

      cd /opt/librenms

      ./scripts/composer_wrapper.php install --no-dev

      If you are not root then:

      cd /opt/librenms

      run ./scripts/composer_wrapper.php install --no-dev

      That's it.

  2. hello,

    I'm trying to hit' but is giving me an error like:

    We can’t connect to the server at

    can you please help

    1. is hostname for my Ubuntu server. If you want to keep the hostname same for your Ubuntu server then do:

      sudo systemctl set-hostname
      sudo nano /etc/hosts


      save and close.

  3. Hello,

    I'm struck on the LibreNMS install page, saying that "We could not connect to your database, please check the details and try again"

    Could you advise please?

    1. You must have made some mistakes while performing "Configure MySQL" steps. Revisit these steps and see where you gone wrong.

  4. Edit the text which says RANDOMSTRINGGOESHERE and set your own community string.

    com2sec readonly default technocracy

    need to change to this Exact word or samthig alls?

    1. No. You just need to replace "technocracy" with your own community name whatever you want to name it.

  5. when i enter the IP address of pi 3 to install LibreNMS through the web browser it gives me 502 Bad Gateway nginx/1.10.3 error.
    please help.

    1. If you want to access your server with ip address in browser instead of hostname then you have to change following parameter by editing /etc/nginx/conf.d/librenms.conf file.

      server_name your_server_ip;

    This helped me, and Thank you.

  7. how i add multiple aws instance vm on one server in librenms


Comments with links will not be published.