LibreNMS installation in Ubuntu 16.04 (Apache)


838
1 comment, 838 points

LibreNMS is a fully featured network monitoring system that provides a wealth of features and device support. Let’s begin your installation with some packages installation. LibreNMS supports maximum PHP version 5.6.4.

First of all, install required packages:

Note: You may need to be root first to run this command.

ubuntu@ubuntu >~$ apt install acl apache2 composer fping git graphviz imagemagick libapache2- mod-php7.0 mariadb-client mariadb-server mtr-tiny nmap php7.0-cli php7.0-curl php7.0-gd php7.0-json php7.0-mbstring php7.0-mcrypt php7.0-mysql php7.0-snmp php7.0-xml php7.0-zip python-memcache python-mysqldb rrdtool snmp snmpd whois

Now, install Librenms in /opt folder:

ubuntu@ubuntu >~$ cd /opt

ubuntu@ubuntu >~$ composer create-project --no-dev --keep-vcs librenms/librenms librenms dev-master

Add user of librenms

ubuntu@ubuntu >~$ useradd librenms -d /opt/librenms -M -r

ubuntu@ubuntu >~$ usermod -a -G librenms www-data

Configure DB Server (MySQL)

ubuntu@ubuntu >~$ systemctl restart mysql

ubuntu@ubuntu >~$ mysql -uroot -p

mysql > CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;

mysql > CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'password';

mysql > GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';

mysql > FLUSH PRIVILEGES;

mysql > exit

Configure Web Server

  • Configure PHP

Make sure date.timezone is set in php.ini to your preferred time zone. For example: “Asia/Kathmandu”, “Etc/UTC”.

ubuntu@ubuntu >~$ vi /etc/php/7.0/apache2/php.ini

ubuntu@ubuntu >~$ vi /etc/php/7.0/cli/php.ini

ubuntu@ubuntu >~$ a2enmod php7.0

ubuntu@ubuntu >~$ a2dismod mpm_event

ubuntu@ubuntu >~$ a2enmod mpm_prefork

ubuntu@ubuntu >~$ phpenmod mcrypt

  • Configure Apache

ubuntu@ubuntu >~$ vi /etc/apache2/sites-available/librenms.conf

On file librenms.conf, add the following line and make sure you change IP or domain in yourdomain.com’.  

<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>

If you want to host only this site then disable ‘a2dissite 000-default’.

ubuntu@ubuntu >~$ a2ensite librenms.conf                                            ubuntu@ubuntu >~$ a2enmod rewrite                                                    ubuntu@ubuntu >~$ systemctl restart apache2

Configure SNMPD

ubuntu@ubuntu >~$ cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf             ubuntu@ubuntu >~$ vi /etc/snmp/snmpd.conf 

ubuntu@ubuntu >~$ curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro                                                                      ubuntu@ubuntu >~$ chmod +x /usr/bin/distro                                           ubuntu@ubuntu >~$ systemctl restart snmpd

Set up Cron job

ubuntu@ubuntu >~$ cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms

Copy Logrotate config

ubuntu@ubuntu >~$ cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms

Set permissions for file or folder

ubuntu@ubuntu >~$ chown -R librenms:librenms /opt/librenms                                 ubuntu@ubuntu >~$ setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs                                       /opt/librenms/bootstrap/cache/ /opt/librenms/storage/                         ubuntu@ubuntu >~$ setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs                                      /opt/librenms/bootstrap/cache/ /opt/librenms/storage/

Now, move on to the web installer, and follow the instruction on screen.

http://yourdomain.com/install.php

At the final step, you may asked to create a config.php file manually, for this follow the on screen instruction and set the permission for file config.php as:

ubuntu@ubuntu >~$ chown librenms:librenms /opt/librenms/config.php

Also run validate command as being root to identify problems:

ubuntu@ubuntu >~$ cd /opt/librenms

ubuntu@ubuntu >~$ ./validate.php

After all the configuration, you may be able login by using url :

Note: If you want to run your librenms in a specific port 8080 For eg: http://192.168.10.1:8080. Make sure you make the port listen in /etc/apache2/ports.conf.


Like it? Share with your friends!

838
1 comment, 838 points

What's Your Reaction?

hate hate
0
hate
confused confused
0
confused
fail fail
0
fail
fun fun
0
fun
geeky geeky
1
geeky
love love
1
love
lol lol
0
lol
omg omg
0
omg
win win
0
win
admin

One Comment

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

Send this to a friend