Cum se instalează și se configurează LibreNMS pe Ubuntu 16.04

Cum se instalează și se configurează LibreNMS pe Ubuntu 16.04

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. Actualizați sistemul

Login to your server via SSH as user root

ssh [email protected]_Address

și actualizați toate pachetele instalate

apt-get update && apt-get upgrade

2. Instalați serverul web Apache

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/

AllowEncodedSlashes NoDecode
<Directory "/opt/librenms/html/">
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews

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)]> exit

Nu uitați să înlocuiți "PASSWORD" cu o parolă puternică.

Open the MariaDB configuration file and add the following lines under [Mysqld] secțiune

nano /etc/mysql/mariadb.conf.d/50-server.cnf


Restart MariaDB for the changes to take effect.

systemctl restart mysql

4. Instalați 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 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

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 and follow the on-screen instructions to complete the LibreNMS installation.


Articolul original

Lasa un raspuns