Professional Documents
Culture Documents
BY RAMNEEK
It’s feature set includes automatic discovery, customizable alerts, API access, billing
system for ports on the network, automatic updates and many more. It also has
multiple authentication methods like MySQL, HTTP, LDAP, Radius, Active Directory.
We can also get the LibreNMS native Android and iOS app so that we can monitor
our devices while roaming everywhere.
Installation
For this tutorial, we will be using CentOS 8 as the host operating system. Here is a
brief overview of the steps we will be following in the tutorial.
Step 1: Pre-Requisites
Before we begin with the installation let us make sure that our system is up to date.
dnf -y update
Now let’s install all repos which are required to install LibreNMS on Centos 8. All
dependencies are found in both Epel and Remi repository. Remi repo to get the
latest PHP package and EPEL repo to satisfy the dependencies.
Before we can start with our installation it is advised that we disable SELinux or set it
to permissive mode so that it will not hinder the installation process. To do this, we
will edit the SELinux config file.
vi /etc/selinux/config
Step 3: Dependencies
Let’s install the packages required for LibreNMS to run on Ubuntu 20.
dnf install bash-completion cronie fping git ImageMagick mariadb-server mtr net-
snmp net-snmp-utils nginx nmap php74-php-fpm php74-php-cli php74-php-common php74-
php-curl php74-php-gd php74-php-json php74-php-mbstring php74-php-process php74-
php-snmp php74-php-xml php74-php-zip php74-php-mysqlnd python3 python3-PyMySQL
python3-redis python3-memcached python3-pip rrdtool unzip
Since we have a new user to manage LibreNMS, we are required to provide the user
with the privileges and set permissions for directories.
We are provided with a PHP script that will install the composer dependencies. To
execute that script we need to switch to librenms user.
*Install Composer*
mv composer.phar /usr/local/bin/composer
*IMPORTANT*
su - librenms
exit
Step 4: Setting up Database
mysql_secure_installation
Here we will:
We will now create our database which will be used by LibreNMS. First login as the
root user with the password you set.
mysql -u root -p
Next we are required to create a database and a user, Do not forget to change the
‘password’ below to something secure
FLUSH PRIVILEGES;
exit
vi /etc/my.cnf.d/mariadb-server.cnf
innodb_file_per_table=1
lower_case_table_names=0
Then restart MariaDB
For PHP-FPM to work with Nginx, we are required to make changes to the config file
cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/librenms.conf
vi /etc/php-fpm.d/librenms.conf
[librenms]
user = librenms
group = librenms
listen = /run/php-fpm/www.sock
*to*
listen = /run/php-fpm-librenms.sock
vi /etc/nginx/conf.d/librenms.conf
Now add the following lines in the librenms.conf file and replace server_name with
your IP Address or FQDN.
server {
listen 80;
server_name librenms.example.com;
root /opt/librenms/html;
index index.php;
charset utf-8;
gzip on;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
location ~ /\.(?!well-known).* {
deny all;
Also, we should not forget to remove the default server section from the nginx.conf
file.
vi /etc/nginx/nginx.conf
Here
we removed the contents of server section
Now start and enable the Nginx so that it will start with system restart
Step 6: Miscellaneous:
FIREWALLD ACCESS
We can either disable the firewalld
Or we can allow access through the firewalld by using the following commands.
SNMPD CONFIG
Copy the sample config file to its required destination
cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
Now we will run the following commands to get it set up and started
chmod +x /usr/bin/distro
CRON JOB
LibreNMS has it’s own cron jobs that are used to poll and discover the devices in
your network, copy it’s cron file and paste it inside /etc/cron.d directory.
cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms
LOGROTATE
LibreNMS logs can be found in /opt/librenms/logs directory which can grow up to be
quite large at some time in future. We can use the logrotate config provided to
counter this problem.
cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms
TIMEZONES
It is important for each component that we have installed to work on the same
timezone as our server.
On CentOS
To check timezone on CentOS 8 we can use
timedatectl
PHP-FPM
Time zone can be set in the php.ini file found in /etc
vi /etc/php.ini
Edit the date_timezone under the [Module Setting] section. Use the same timezone
as used above.
Now on your browser, open the address of your server, In our case, it was
192.168.122.86. Yours might be different. It will take you to the web interface for the
next steps in the setup process.
Enter the database user password when prompted.
Next, it will build the Database. If you do not see any errors then we are good to go.
We will be adding a Linux device running Debian 10. We will be using SNMP to
collect and organize information from our device
Now replace the snmpd.conf file with the example below. And also change the
community string appropriately.
# Change RANDOMSTRINGGOESHERE to your preferred SNMP community string
#Distro Detection
Now we will head to the add device section in the Web Interface
Add your hostname or IP in its respective section. The default SNMP port is 161 so
we will enter the port as 161. At last enter the community string in the Community
section
After a few minutes, you will be able to see your device in the devices section.
You have successfully installed your LibreNMS server on Centos 8.Thank you for
reading this blog, if you guys have any questions or you got stuck anywhere please
feel free to mention in the comment section below.