How TosUbuntu

How to install LibreNMS on Ubuntu

There’s a range of great monitoring tools available to you to monitor and alert on all aspects of your network. Here we’re going to look at one of my favourite open-source packages, LibreNMS.

LibreNMS is a fork of Observium but it has a focus on presentation and usability. It’s certainly easier to get up and running with LibreNMS. With great graphs, a truck-load of notification options, including PushBullet, it’s everything you want from a network tool.

One area where LibreNMS is currently weak is in the support for custom MIB files. Whilst LibreNMS has good support for a large range of network switches and devices, it’s support for MIB files is still very experimental. This has never been an issue for me when it comes to monitoring networks as LibreNMS always seems to discover something it can monitor, but you might need to get down and dirty in terminal to get more esoteric devices up and monitoring.

For this walk-through I’m assuming that you have a Ubuntu Server 14.04 and we’re using LibreNMS version c72d8cc. I’m using Emacs as my editor of choice (it is the best, after all) but feel free to use whatever you want. I’m also assuming that LibreNMS will be the only thing running on this server and that you aren’t looking to run the MySQL functions on another server.

    1. First off install Emacs.
      sudo apt-get install emacs
    2. Configure MySQL using the command line.
      mysql -u root -p
    3. Enter the following commands in to the mysql prompt.
      create database librenms;
      grant all privileges on librenms.* to 'librenms'@'localhost' identified by 'password';
      flush privileges;
    4. Install the required software.
      apt-get install libapache2-mod-php5 php5-cli php5-mysql php5-gd php5-snmp php-pear php5-curl snmp graphviz php5-mcrypt php5-json apache2 fping imagemagick whois mtr-tiny nmap python-mysqldb snmpd php-net-ipv4 php-net-ipv6 rrdtool git
    5. Create a user account for Libre and add it to the www-data group for apache.
      sudo useradd librenms -d /opt/librenms -M -r
      sudo usermod -a -G librenms www-data
      sudo chmod ug+w librenms
    6. Download the LibreNMS files using GIT, which was installed as part of the software packages in step 4.
      cd /opt
      sudo git clone librenms
      cd /opt/librenms

Web interface

    1. Create the folders needed for RRD and assign the right permissions.
      sudo mkdir rrd logs
      sudo chown -R librenms:librenms /opt/librenms
      sudo chmod 775 rrd
    2. Next create the Apache configuration file for Libre;
      sudo emacs /etc/apache2/sites-available/librenms.conf
    3. Paste the following text in to the editor. Change “MyHostname” to match your servers hostname.

      DocumentRoot /opt/librenms/html/
      ServerName MyHostname
      CustomLog /opt/librenms/logs/access_log combined
      ErrorLog /opt/librenms/logs/error_log
      AllowEncodedSlashes On

      Require all granted
      AllowOverride All
      Options FollowSymLinks MultiViews

    4. Enable the mcrypt Apache module
      sudo php5enmod mcrypt
    5. Tidy up and restart Apache
      sudo a2ensite librenms.conf
      sudo a2enmod rewrite
      sudo a2dissite 000-default
      sudo service apache2 restart
    6. Right. Now for the web based configuration. Visit the install URL in your browser to start the configuration process. Change the “MyHostname” to match your hostname.
    7. All being well you should see the following configuration page. Click Next.
    8. On the following screen enter your MySQL details. The database, username and password have to match the details used in step 4 above.
    9. In the next page enter the username and password for your main admin user. Don’t lose this, it will be needed for any system changes.
    10. Confirm you want to create the configuration file (you do after all) and hit Generate.
      2016-02-17 13_19_56-test-libre_install.php
    11. All being well, you shouldn’t see any error messages. Click Finish.
      2016-02-17 14_01_10-test-libre_install.php
    12. …and you are done. Congratulations. Now to quickly look at adding devices.
      2016-02-17 14_09_04-test-libre_install.php

Adding devices

Now you need to configure a few more things. We’re going to add the LibreNMS box to the list of devices from the command line and then we’re going to set up regular polling of the registered devices in LibreNMS.

    1. Go back to your terminal window and add the local server to the list of LibreNMS devices and run a discovery of the SNMP objects available.
      sudo php addhost.php localhost public v2c
      sudo php discovery.php -h all
    2. Copy the cron file containing all the scheduled times for the discovery scripts to the right location.
      sudo cp librenms.nonroot.cron /etc/cron.d/librenms
    3. Finally, you can add network devices. Pop back to the web interface. Click on the Devices menu then Add Device. Enter the IP of the device.
      2016-02-17 15_17_36-Add host - LibreNMS
    4. It should be added and LibreNMS will start monitoring.
      2016-02-17 15_17_47-Add host - LibreNMS

And we are done. Phew, high five people!

What is your reaction?

Strongly Agree
Strongly Disagree

You may also like

Leave a reply

Your email address will not be published. Required fields are marked *

The reCAPTCHA verification period has expired. Please reload the page.

More in:How Tos