LibreNMS is an open source auto-discovering 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.
This tutorial will walk you through the steps to set up LibreNMS on Ubuntu 18.04.
Search for cgi.fix_pathinfo parameter, uncomment and change its value like below:
Save and close file.
Now edit /etc/php/7.4/fpm/php.ini file:
Uncomment and update its value with your timezone:
Save and close.
Edit the /etc/php/7.4/cli/php.ini file:
Uncomment date.time parameter and update its value with your timezone:
Save and close.
Restart PHP service to take changes into effect:
Type the following at mysql prompt to create a database, user and password:
Now edit 50-server.cnf file:
Within the [mysqld] section, add below parameters:
Save and close file when you finished.
Restart MariaDB service to take changes into effect:
Add the below parameters and make sure you replace server_name to reflect yours:
Save and close file when you are finished.
Now you need to create a symbolic link to librenms.conf file like below:
Restart the service to take changes into effect:
Replace the text which says RANDOMSTRINGGOESHERE and set your own community string like below:
Save and close when you are finished
You will see the output similar to the below while running composer wrapper script and it will take few minutes to complete.
When its done, type the exit command to return back to sudo non-root user terminal:
Run the 'ufw status' command to see the firewall status.
You will see the below install.php page showing the result of pre-install checks. Make sure all status are installed, yes as shown in the screenshot below.
Click 'Next Stage' to continue.
Provide database credentials you created earlier and click Next Stage.
This will import librenms database schema and when you see Success click Goto Add User
Add a user, this will be your librenms administrative user:
Click Generate Config
Now stop here and copy this entire script:
Go back to Ubuntu terminal and create config.php file like below:
Paste entire script into it, save and close the file when you are finished.
Update the permission
Now run the validation check
If you see any warning other than the adding host you got to fix it first before moving to next step:
Now go back to your browser you left unfinished and click Finish:
As you have already done with validation check so you just need to click on validate your install and fix any issues:
This will bring you to the below login page of librenms. You can log in with the user and password you created just a moment ago.
Once log in, you will see the below validation page says all well.
Start adding your devices:
Provide the below info and click Add Device
Device added successfully
Librenms will start collecting data from the added devices to monitor like below
See below memory utilization graph
This tutorial will walk you through the steps to set up LibreNMS on Ubuntu 18.04.
Prerequisites
You will need one Ubuntu 18.04 server installed on (physical or virtual) machine with sudo non-root user privileges.Set Timezone
Since this is your fresh installation of Ubuntu 18, you will need to correct timezone of your server and make sure you replace highlighted text to reflect yours:Installing PHP
You will need to install PHP and few of its extensions commonly used with librenms:Configuring PHP
You also need to make few changes in PHP configuration file like below:Search for cgi.fix_pathinfo parameter, uncomment and change its value like below:
Save and close file.
Now edit /etc/php/7.4/fpm/php.ini file:
Uncomment and update its value with your timezone:
Save and close.
Edit the /etc/php/7.4/cli/php.ini file:
Uncomment date.time parameter and update its value with your timezone:
Save and close.
Restart PHP service to take changes into effect:
Installing Database
We will install and use MariaDB as our database server:Securing Database
You will need to run following script and follow on screen instruction to secure your database like below:Installing Web Server
We will install and use Nginx as our web server:Adding LibreNMS User
Type the following commands to add a librenms user:Creating Database
You need to create a database to use with librenms like below:Type the following at mysql prompt to create a database, user and password:
Now edit 50-server.cnf file:
Within the [mysqld] section, add below parameters:
Save and close file when you finished.
Restart MariaDB service to take changes into effect:
Downloading LibreNMS
Now you need to download librenms on your Ubuntu server like below:Configuring Nginx
Create a librenms configuration file within nginx to make its web interface accessible:Add the below parameters and make sure you replace server_name to reflect yours:
Save and close file when you are finished.
Now you need to create a symbolic link to librenms.conf file like below:
Restart the service to take changes into effect:
Configuring SNMPD
Type the following commands to configure snmp to use with librenms:Replace the text which says RANDOMSTRINGGOESHERE and set your own community string like below:
Save and close when you are finished
Adding CronJob
LibreNMS keeps logs in /opt/librenms/logs. Over time these can become large and be rotated out. You can rotate out the old logs using the below logrotate config file:Applying Permissions
Run Composer Wrapper
You will need to run composer wrapper script from /opt/librenms directory like below:You will see the output similar to the below while running composer wrapper script and it will take few minutes to complete.

When its done, type the exit command to return back to sudo non-root user terminal:
Adding Firewall Rules
If you have activated firewall on your Ubuntu, you need to allow few ports from the firewall like below:Run the 'ufw status' command to see the firewall status.
LibreNMS Web Installer
In this step, you will run LibreNMS web installer by navigating to http://your_server_name or http://your_server_ip in the web browser address bar and press Enter.You will see the below install.php page showing the result of pre-install checks. Make sure all status are installed, yes as shown in the screenshot below.
Click 'Next Stage' to continue.

Provide database credentials you created earlier and click Next Stage.

This will import librenms database schema and when you see Success click Goto Add User

Add a user, this will be your librenms administrative user:

Click Generate Config

Now stop here and copy this entire script:

Go back to Ubuntu terminal and create config.php file like below:
Paste entire script into it, save and close the file when you are finished.
Update the permission
Now run the validation check
and you will see the output like below:

If you see any warning other than the adding host you got to fix it first before moving to next step:
Now go back to your browser you left unfinished and click Finish:
As you have already done with validation check so you just need to click on validate your install and fix any issues:

This will bring you to the below login page of librenms. You can log in with the user and password you created just a moment ago.

Once log in, you will see the below validation page says all well.

Start adding your devices:

Provide the below info and click Add Device

Device added successfully

Librenms will start collecting data from the added devices to monitor like below

See below memory utilization graph

Wrapping up
You have successfully completed librenms installation and added localhost as an example of adding device. Now you can start adding your devices like network switches, routers, firewalls, Windows, Linux and Unix servers to monitor their utilization.
when i use domain name or ip address it not redirects me to install.php please help
ReplyDeletepost /etc/nginx/conf.d/librenms.conf here and let me see if there is any miss-configuration
DeleteEverytime I restart the server I got 502 bad gateway error.
ReplyDeleteI have to issue the command :
sudo ln -s /var/run/php/php7.2-fpm.sock /var/run/php/php7.0-fpm.sock
for me to access librenms.
Is there way to solve this?
how i add multiple devices (aws instance vm ec2) to a single librenms server
ReplyDeleteI don't have much idea about how aws instance works but for librenms you will need SNMP running on your aws i.e. vm, instance etc.
Delete