How to install LibreNMS on Debian 9?

0
11619
Servers
Servers

This article is intended to teach you how to install LibreNMS on Debian 9.

For any system administrator it is essential to monitor the network it manages. At the same time, it is very important to have the right tool to do that task.

LibreNMS is a tool with a web interface for monitoring services within a network. It is released under GPLV3, so it is open source. It includes support for a wide range of network hardware and operating systems including Cisco, Linux, FreeBSD, Juniper, Brocade, Foundry, HP and many more.

You can install it in the main Linux distributions oriented to it, for example, Debian, Ubuntu Server, CentOS, Suse and RHEL. It requires a web server, PHP and a database manager like MariaDB.

Let’s start.

0.- What you need

Installing LibreNMS is not as complicated as it may seem, but the following must be taken into account:

  • It is necessary to have knowledge about the Linux terminal.
  • You must be able to access through ssh.
  • Commands must be run as root user. So your user must be able to have that privilege.

Let’s get to work.

1.- Upgrade the system

It’s always a good idea to have your operating system updated when you start an installation like this one. With this you will have the latest security patches on your system and it will be safer.

1.- Upgrading the system
1.- Upgrading the system

And with this it’s done.

2.- Install Apache Web server

The second step to install LibreNMS in Debian is to install a web server. In this case, I will use Apache Web server.

2.- Installing apache2
2.- Installing apache2

Then enable the service to start with the system.

Finally, go to your web browser and access from the IP address of the server. http://IP_SERVER

3.- Apache default page on Debian 9
3.- Apache default page on Debian 9

If you see the image above, apache web server is correctly installed.

2. Install PHP

In order to run LibreNMS you need to install PHP.

4.- Installing PHP
4.- Installing PHP

At the end of the installation, you must test the installation. Create a file in /var/www/html/ and put some simple PHP code like this.

5.- Testing PHP
5.- Testing PHP

Now, try open it from the browser.

6.- PHP is installed
6.- PHP is installed

If the code works then PHP is correctly installed.

3. Install MariaDB

In order to continue installing LibreNMS you have to install MariaDB. LibreNMS requires a database manager and MariaDB is simple, powerful and free.

7.- Installing MariaDB
7.- Installing MariaDB

Now start, and enable the MariaDB service.

8.- Enabling the MariaDB service
8.- Enabling the MariaDB service

Now you have to configure MariaDB. So, run the mysql_secure_installation script. There you will be able to define the password and other things.

9.- Running the mysql_secure_installation
9.- Running the mysql_secure_installation

After defining the password, you will be asked other questions. Answer as you like, I did it Y, N, Y, Y.

The next step to install LibreMNS in Debian 9 is to create a database dedicated to the tool. It is also necessary to create a new user and assign necessary permissions.

10.- Creating the new database for Librenms
10.- Creating the new database for Librenms

Obviously, it replaces the data with what you consider appropriate. Choose a secure password.

Finally, edit the file /etc/mysql/mariadb.conf.d/50-server.cnf and leave it as in the image. You just nedd to add the following in mysqld section.

11.- Editing the mariadb configuration file
11.- Editing the mariadb configuration file

Then, restart the service:

MariaDB is done.

4. Install some required packages

In order for the installation to be ideally achieved, it is necessary to install some extra packages. Run:

12.- Installing some required packages
12.- Installing some required packages

5. Install LibreNMS

Now it is the turn to install LibreNMS. First, create a system user with home located at /opt/librenms

13.- Creating a new system user
13.- Creating a new system user

You can now download LibreNMS cloning its repository thanks to Git.

14.- Cloning the LibreNMS repository
14.- Cloning the LibreNMS repository

Now, change the owner of the folder.

It is now necessary to copy the initial configuration file.

15.- Configuring LibreNMS
15.- Configuring LibreNMS

Replace RANDOMSTRINGGOESHERE line and set your own.

16.- Replacing the ramdom string
16.- Replacing the random string

Then, you must download a distro detection script.

The next thing is to make the script executable and then restart the snmpd service.

17.- Downloading the distro script
17.- Downloading the distro script:

Next, copy the cron script provided by LibreNMS to the /ect/cron.d directory.

And finally, Copy the logrotate script too.

18.- Copying the script
18.- Copying the script

Next, move the folder from /opt/ to /var/www/html

Finally run:

19.- Running composer
19.- Running composer

6. Access from the web browser

Now you must complete the installation from the web. Go to http://IP_SERVER/libremns/html/

You will see this:

20.- Completing the Librenms Installation
20.- Completing the Librenms Installation

Now enter the parameters of the database you configured previously.

21.- Setting the Database Parameters
21.- Setting the Database Parameters

Then, it will start the configuration of the database. If you don’t see any errors, you can continue.

22.- Database without errors
22.- Database without errors

Now you have to configure your username and password.

23.- Creating the new user
23.- Creating the new user

If all goes well, you’ll see this. Click on generate config.

24.- User created
24.- User created

After creating the whole process. You access the log in screen. http://IP_SERVER/librenms/html/index.php/login

25.- LibreNMS log in screen
25.- LibreNMS log in screen

That’s it.

Conclusion

This type of tool is of great help to system administrators. LibreNMS is easy to install but you have to have a certain level of knowledge.

Spread this article on your social networks.

 

 

 

Spread the love

PS. If you like this post please share it with your friends on the social networks using the buttons above.Thanks.

LEAVE A REPLY

Please enter your comment!
Please enter your name here