In this tutorial we will show you how to install and configure LibreNMS on Ubuntu 16.04. LibreNMS is free and open source auto-discovering network monitoring tool based on PHP/MYSQL/SNMP. It’s a featured network monitoring system that provides support for wide range of network hardware and operating systems including, FreeBSD, Cisco, Linux, HP etc. LibreNMS is a community-based fork of the Observium network monitoring tool.
LibreNMS comes with a lot of useful features such as
– Automatic discovery
– Customisable alerting
– API Access
– Billing system
– Automatic Updates
– Distributed Polling
– iOS and Android App
– Unix Agent
– And many more…
Installing and configuring LibreNMS on Ubuntu 16.04, is fairly easy task, if you carefully follow our guide below.
1. Update the system
Login to your server via SSH as user root
and update all installed packages
apt-get update && apt-get upgrade
2. Install Apache web server
Run the following command to install Apache web server on your Ubuntu 16.04 VPS
apt-get -y install apache2
Once the web server is installed, start it and enable it to start on boot
systemctl start apache2 systemctl enable apache2
Create Apache virtual host with the following content
nano /etc/apache2/sites-available/librenms.conf <VirtualHost *:80> DocumentRoot /opt/librenms/html/ ServerName yourdomain.com AllowEncodedSlashes NoDecode <Directory "/opt/librenms/html/"> Require all granted AllowOverride All Options FollowSymLinks MultiViews </Directory> </VirtualHost>
enable the virtual host and restart Apache for the changes to take effect
a2ensite librenms.conf a2enmod rewrite systemctl restart apache2
3. Install and configure MariaDB server
Install MariaDB server, start it and enable it to start automatically at system boot
apt-get install -y mariadb-client mariadb-server systemctl start mysql systemctl enable mysql
Next, run the
mysql_secure_installation post installation script to secure the MariaDB server and set root password.
Now, login to the MariaDB server as user root and create a new user and database for the LibreNMS installation
MariaDB [(none)]> CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_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
Don’t forget to replace ‘PASSWORD’ with an actual strong password.
Open the MariaDB configuration file and add the following lines under
nano /etc/mysql/mariadb.conf.d/50-server.cnf innodb_file_per_table=1 sql-mode="" lower_case_table_names=0
Restart MariaDB for the changes to take effect.
systemctl restart mysql
4. Install PHP 7
LibreNMS is a PHP based application, so we have to install PHP too. Run the following command to install PHP 7 and some additional PHP modules required by LibreNMS
apt-get install php7.0-cli php7.0-curl php7.0-gd php7.0-json php7.0-mcrypt php7.0-mysql php7.0-snmp php7.0-xml php7.0-zip libapache2-mod-php7.0
5. Install additional required packages
Install the following packages required by LibreNMS
apt-get install composer fping git graphviz imagemagick mtr-tiny nmap python-memcache python-mysqldb rrdtool snmp snmpd whois
6. Install and configure LibreNMS
Create a system user under which LibreNMS will run, and set the its home directory to /opt/librenms
useradd librenms -d /opt/librenms -M -r usermod -a -G librenms www-data
Clone the LibreNMS source code through Git.
cd /opt/ git clone https://github.com/librenms/librenms.git librenms
set the correct permission to the librenms directory
chown -R librenms:librenms /opt/librenms
To configure snmpd, copy the example configuration file
cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
Open the snmpd.conf file, edit the RANDOMSTRINGGOESHERE line and set your own community string.
Next, download the snmpd distro detection script
curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
make it executable and restart the service
chmod +x /usr/bin/distro systemctl restart snmpd
Now, copy the cron script provided by LibreNMS to the ‘/ect/cron.d’ directory.
cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms
Copy the logrotate script too, in order to rotate the old logs
cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms
7. Finalize the installation
Finally, go to http://yourdomain.com/install.php and follow the on-screen instructions to complete the LibreNMS installation.
Of course you don’t have to install LibreNMS on Ubuntu 16.04, if you use one of our Managed Ubuntu VPS hosting plans in which case you can simply ask our expert Linux admins to install LibreNMS on Ubuntu 16.04 for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post, on how to install LibreNMS on Ubuntu 16.04, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.