How to Install LibreNMS on Ubuntu 16.04

By Hitesh Jethva, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud’s incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

LibreNMS is a free and open source auto-discovering network monitoring tool for servers and network hardware. It supports wide range of network hardware and operating systems including Cisco, Linux, Juniper, Foundry, Windows, Brocade and many more. LibreNMS discover your network using OSPF, BGP, SNMP, CDP, FDP, LLDP and ARP protocols. LibreNMS comes with a lot of useful features including, Auto discovery, Email alert, Automatic Updates, iOS and Android App, Billing system and many more.

In this tutorial, we will install and configure LibreNMS on Ubuntu 16.04 with an Alibaba Cloud Elastic Compute Service (ECS) instance.

Prerequisites

  1. A fresh Alibaba cloud Ubuntu 16.04 instance.
  2. A static IP address 192.168.0.103 is configured on the instance.
  3. A Root password is setup on the server.

Launch Alibaba Cloud ECS Instance

First, log in to your https://ecs.console.aliyun.com">Alibaba Cloud ECS Console. Create a new ECS instance, choosing Ubuntu 16.04 as the operating system with at least 2GB RAM. Connect to your ECS instance and log in as the root user.

Once you are logged into your Ubuntu 16.04 instance, run the following command to update your base system with the latest available packages.

Install LAMP Server

LibreNMS runs on the web server, written in PHP and uses MariaDB for database. So you will need to install Apache, PHP and MariaDB to your system.

First, install Apache and MariaDB by running the following command:

Once the installation is completed, start Apache and MariaDB service and enable them to start on boot:

By default, the latest version of PHP is not available in Ubuntu 16.04 default repository. So you will need to add the repository for that. You can add it by running the following command:

Next, update the repository and install PHP along with all the libraries by running the following command:

Once all the packages are installed, enable required PHP modules with the following command:

Next, you will also set Time Zone in php.ini file:

Make the following changes:

Save and close the file.

Configure MariaDB

By default, MariaDB installation is not secured. So you will need to secure it first. You can secure it by running the following script:

Answer all the questions as shown below:

Once the MariaDB is secured, login to MariaDB shell using the following command:

Enter your root password, then create a database and user for LibreNMS:

Next, grant all privileges to the LibreNMS user:

Next, flush the privileges and exit from the MariaDB shell:

Download LibreNMS

First, add new user with name librenms and make a member of the www-data group:

Next, change the directory to the /opt and download the latest version of LibreNMS using the following command:

Next, change the directory to the librenms and install all required dependencies by running the following command:

Next, give proper permissions to the librenms directory:

Configure Apache for LibreNMS

Next, you will need to create an apache virtual host file for LibreNMS. You can do this with the following command:

Add the following lines:

Save and close the file, then enable virtual host and apache rewrite module with the following command:

Finally, restart the Apache service to apply all the changes:

Access LibreNMS Web Installation Wizard

Open your web browser and type the URL http://example.com, you will be redirected to the following page:

Make sure all the status is green, then click on the Next Stage button. You should see the following page:

Provide your database details, then click on the Next Stage button, you should see the following page:

Now, click on the Goto Add User button, you should see the following page:

Now, provide admin username, password and email address as you wish, then click on the Add User button. Once the user added successfully, you should see the following page:

Now, click on the Generate Config button, you should see the following page:

Now, click on the Finish install button, you should see the following page:

Now, click on “validate your install and fix any issues”, you will be redirected to the following page:

Here, provide your admin login details, then click on the Login button, you should see the following page:

Next, you will also need to configure Crontab and Logrotate for LibreNMS. so that automatic discovery and polling for newly added devices can happen automatically. First, change the directory to the librenms:

Copy the sample configuration file for crontab and logrotate with the following command:

Next, restart cron and logrotate using the following command:

Now, validate the configuration by running the following command:

If everything is ok, you should see the following output:

Congratulations! You have successfully installed LibreNMS on Ubuntu 16.04 server. You can now add server and network devices to LibreNMS and monitor it from the central location.

Related Alibaba Cloud Products

Cloud Enterprise Network provides a hybrid and distributed global network, ideal for enterprise users with high demand on network coverage. Cloud Enterprise Network can be used to facilitate communication between VPC to VPC and VPC to IDC. With its stable transmission and next-generation network environment, the network provides high transmission speed and low latency for end-users.

Reference:

https://www.alibabacloud.com/blog/how-to-install-librenms-on-ubuntu-16-04_593975?spm=a2c4.11999589.0.0

Follow me to keep abreast with the latest technology news, industry insights, and developer trends.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store