LibreNMS is an open-source network monitoring system built on PHP, MySQL/MariaDB, and SNMP. It provides auto-discovery of network devices, real-time alerting, customizable dashboards, and supports hundreds of device types out of the box. LibreNMS handles bandwidth monitoring, device health tracking, and performance analysis for networks of any size.
This guide walks through a full installation of LibreNMS network monitoring on Rocky Linux 10 or AlmaLinux 10, covering the LAMP/LEMP stack, database setup, web configuration, SSL, SNMP device monitoring, alerting integrations, distributed polling, and performance tuning.
Prerequisites
- A server running Rocky Linux 10 or AlmaLinux 10 with at least 2 CPU cores and 4GB RAM
- Root or sudo access to the server
- A fully qualified domain name (FQDN) pointing to your server, e.g.
librenms.example.com - Ports 80/TCP, 443/TCP (web UI), and 161/UDP (SNMP) open in the firewall
- SELinux set to permissive or configured with appropriate policies
- Internet access for package installation
Step 1: Update System and Install Required Packages
Start by updating the system and installing base dependencies that LibreNMS requires.
sudo dnf update -y
sudo dnf install -y epel-release
Install the core utilities needed during the setup process.
sudo dnf install -y bash-completion curl fping git ImageMagick mtr net-snmp net-snmp-utils nmap python3 python3-pip python3-PyMySQL rrdtool unzip wget whois cronie policycoreutils-python-utils
Set SELinux to permissive mode. LibreNMS requires write access to several directories and a strict SELinux policy can block those operations.
sudo setenforce 0
sudo sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/selinux/config
Verify the change took effect.
$ getenforce
Permissive
Step 2: Install PHP 8.3 on Rocky Linux 10 / AlmaLinux 10
LibreNMS requires PHP 8.1 or newer. PHP 8.3 is the recommended version for best performance and compatibility. Enable the Remi repository to get PHP 8.3 packages.
sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-10.rpm
sudo dnf module reset php -y
sudo dnf module enable php:remi-8.3 -y
Install PHP 8.3 with all the extensions that LibreNMS needs.
sudo dnf install -y php php-cli php-common php-curl php-fpm php-gd php-gmp php-json php-mbstring php-mysqlnd php-opcache php-pdo php-process php-snmp php-xml php-zip
Verify the PHP version is correct.
$ php -v
PHP 8.3.x (cli) (built: ...)
Copyright (c) The PHP Group
Zend Engine v4.3.x, Copyright (c) Zend Technologies
with Zend OPcache v8.3.x, Copyright (c), by Zend Technologies
Configure the PHP timezone. Open the PHP configuration file.
sudo vim /etc/php.ini
Find the date.timezone directive and set it to your timezone.
[Date]
date.timezone = Africa/Nairobi
Replace Africa/Nairobi with your local timezone from the PHP timezone list. Enable and start PHP-FPM.
sudo systemctl enable --now php-fpm
Step 3: Install and Configure MariaDB
LibreNMS stores all device data, alerts, and configuration in a MariaDB (or MySQL) database. Install MariaDB from the default Rocky Linux 10 / AlmaLinux 10 repositories. For dedicated MariaDB setup instructions, see our guide on installing MariaDB on CentOS / Rocky Linux.
sudo dnf install -y mariadb-server mariadb
Before starting MariaDB, configure the InnoDB settings that LibreNMS requires for optimal performance. Edit the MariaDB server configuration.
sudo vim /etc/my.cnf.d/mariadb-server.cnf
Add the following settings under the [mysqld] section.
[mysqld]
innodb_file_per_table=1
lower_case_table_names=0
sql-mode=""
Enable and start MariaDB.
sudo systemctl enable --now mariadb
Secure the installation by running the security script.
sudo mariadb-secure-installation
Set a strong root password and answer Y to all remaining prompts to remove anonymous users, disable remote root login, and drop the test database.
Create the LibreNMS Database and User
Log into MariaDB and create the database and a dedicated user for LibreNMS.
sudo mariadb -u root -p
Run the following SQL statements. Replace StrongDBPass2025 with your own secure password.
CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'StrongDBPass2025';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 4: Create the LibreNMS System User
LibreNMS runs under its own dedicated system user. Create the librenms user and add it to the necessary groups.
sudo useradd librenms -d /opt/librenms -M -r -s "$(which bash)"
Step 5: Download and Install LibreNMS
Clone the LibreNMS repository into the /opt/librenms directory.
cd /opt
sudo git clone https://github.com/librenms/librenms.git
Set proper ownership so the LibreNMS user can manage all files.
sudo chown -R librenms:librenms /opt/librenms
sudo chmod 771 /opt/librenms
Install PHP Dependencies with Composer
LibreNMS ships with a Composer wrapper script. Run the installation as the librenms user.
sudo su - librenms
./scripts/composer_wrapper.php install --no-dev
exit
This downloads all required PHP libraries into the /opt/librenms/vendor directory. The process may take a few minutes depending on your internet speed.
Step 6: Set Permissions and Directory Structure
Set the correct permissions on LibreNMS directories. The web server and LibreNMS user both need access to specific paths.
sudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache /opt/librenms/storage
sudo setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache /opt/librenms/storage
Ensure the acl package is installed if the commands above fail.
sudo dnf install -y acl
Step 7: Configure Apache as the Web Server
Install Apache (httpd) and configure a virtual host for LibreNMS.
sudo dnf install -y httpd
Create the LibreNMS Apache virtual host configuration file.
sudo vim /etc/httpd/conf.d/librenms.conf
Add the following virtual host configuration. Replace librenms.example.com with your actual domain name.
<VirtualHost *:80>
DocumentRoot /opt/librenms/html/
ServerName librenms.example.com
AllowEncodedSlashes NoDecode
<Directory "/opt/librenms/html/">
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
# Enable /api/ URL
<Directory "/opt/librenms/html/plugins/">
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
</VirtualHost>
Remove the default welcome page to prevent conflicts.
sudo rm -f /etc/httpd/conf.d/welcome.conf
Configure PHP-FPM to run as the librenms user. Edit the PHP-FPM pool configuration.
sudo vim /etc/php-fpm.d/www.conf
Change the user and group settings from apache to librenms.
user = librenms
group = librenms
Add the apache user to the librenms group so Apache can read files managed by LibreNMS.
sudo usermod -a -G librenms apache
Enable and start both Apache and PHP-FPM, then restart PHP-FPM to apply the user change.
sudo systemctl enable --now httpd
sudo systemctl restart php-fpm
Verify Apache is running.
$ systemctl status httpd
Active: active (running)
Alternative: Configure Nginx Instead of Apache
If you prefer Nginx over Apache, install it and create the server block. Do not install both – choose one.
sudo dnf install -y nginx
Create the Nginx server block configuration.
sudo vim /etc/nginx/conf.d/librenms.conf
Add the following configuration. Replace librenms.example.com with your domain.
server {
listen 80;
server_name librenms.example.com;
root /opt/librenms/html;
index index.php;
charset utf-8;
gzip on;
gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ [^/]\.php(/|$) {
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi.conf;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
When using Nginx, update the PHP-FPM pool user to librenms as described above, and also add nginx to the librenms group.
sudo usermod -a -G librenms nginx
sudo systemctl enable --now nginx
sudo systemctl restart php-fpm
Step 8: Configure SNMP on the LibreNMS Server
LibreNMS uses SNMP to communicate with monitored devices. Configure the local SNMP daemon first so the LibreNMS server can monitor itself.
sudo cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
sudo vim /etc/snmp/snmpd.conf
Replace the default community string RANDOMSTRINGGOESHERE with your own community string.
com2sec readonly default myCommunityString
Download the LibreNMS SNMP distribution detection script. This script allows LibreNMS to identify the operating system running on the monitored host.
sudo curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
sudo chmod +x /usr/bin/distro
Enable and start the SNMP daemon.
sudo systemctl enable --now snmpd
Step 9: Set Up Cron Jobs and Log Rotation
LibreNMS uses cron jobs for polling devices, discovering new devices, and running maintenance tasks. Copy the provided cron file and logrotate config.
sudo cp /opt/librenms/dist/librenms.cron /etc/cron.d/librenms
sudo cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms
Enable the LibreNMS scheduler service for more accurate polling intervals.
sudo cp /opt/librenms/dist/librenms-scheduler.service /opt/librenms/dist/librenms-scheduler.timer /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now librenms-scheduler.timer
Step 10: Configure Firewall Rules
Open the required ports in firewalld for web access and SNMP communication.
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-port=161/udp
sudo firewall-cmd --reload
Verify the rules are active.
$ sudo firewall-cmd --list-all
public (active)
services: cockpit dhcpv6-client http https ssh
ports: 161/udp
Step 11: Complete LibreNMS Web Installer
Open your browser and navigate to http://librenms.example.com/install. The web installer validates your environment and completes the setup in several steps.
The installer checks for required PHP extensions, verifies file permissions, and tests database connectivity. Enter the database credentials created in Step 3:
- Database Host: localhost
- Database Name: librenms
- Database User: librenms
- Database Password: StrongDBPass2025 (or whatever you set)
The installer runs the database migrations to create all required tables. After that, create your admin user account and finalize the setup. Once complete, you will be redirected to the LibreNMS login page.
After logging in, run the validation tool from the CLI to confirm everything is configured correctly.
sudo su - librenms
./validate.php
Fix any warnings or errors the validation script reports before proceeding.
Step 12: Secure LibreNMS with Let’s Encrypt SSL
Production deployments should always use HTTPS. Install Certbot and obtain a free SSL certificate from Let’s Encrypt. For detailed Nginx proxy with SSL setup, refer to the guide on configuring Nginx reverse proxy with Let’s Encrypt SSL.
sudo dnf install -y certbot
For Apache, install the Apache plugin and run the certificate request.
sudo dnf install -y python3-certbot-apache
sudo certbot --apache -d librenms.example.com
For Nginx, use the Nginx plugin instead.
sudo dnf install -y python3-certbot-nginx
sudo certbot --nginx -d librenms.example.com
Certbot automatically configures the virtual host for SSL and sets up auto-renewal. Verify the renewal timer is active.
$ sudo systemctl list-timers | grep certbot
certbot-renew.timer loaded active waiting
Test the renewal process to confirm it works.
sudo certbot renew --dry-run
Step 13: Add Devices to LibreNMS via SNMP
With LibreNMS running, add your first monitored device. The server itself is a good starting point. Navigate to Devices > Add Device in the web UI, or use the command line.
sudo su - librenms
./addhost.php localhost myCommunityString v2c
To add a remote device with SNMPv2c, provide the hostname or IP, community string, and SNMP version.
./addhost.php 192.168.1.1 myCommunityString v2c
After adding a device, trigger an initial discovery and poll cycle to populate data immediately.
./discovery.php -h 192.168.1.1
./poller.php -h 192.168.1.1
The device should appear in the dashboard within a few minutes with port utilization, CPU, memory, and storage graphs. For monitoring VMware hosts, see our article on monitoring VMware ESXi hosts using LibreNMS.
Step 14: Configure SNMPv3 for Secure Monitoring
SNMPv2c sends community strings in plaintext. For production environments, SNMPv3 provides authentication and encryption. Configure an SNMPv3 user on the target device first.
On a Linux target running net-snmp, stop the SNMP daemon and create a user.
sudo systemctl stop snmpd
sudo net-snmp-create-v3-user -ro -A AuthPass123 -X PrivPass456 -a SHA -x AES librenmsuser
Start SNMP again after creating the user.
sudo systemctl start snmpd
Add the device to LibreNMS with SNMPv3 credentials from the CLI.
sudo su - librenms
./addhost.php 192.168.1.50 ap v3 librenmsuser AuthPass123 PrivPass456 sha aes
You can also add SNMPv3 devices through the web UI under Devices > Add Device. Select SNMPv3 and fill in the authentication protocol (SHA), privacy protocol (AES), and the corresponding passwords.
Test SNMP connectivity from the LibreNMS server to verify the configuration.
snmpwalk -v3 -u librenmsuser -l authPriv -a SHA -A AuthPass123 -x AES -X PrivPass456 192.168.1.50 sysDescr
A successful response returns the device’s system description string.
Step 15: Configure Alerting in LibreNMS
LibreNMS supports alerting through multiple channels. Alert rules define what conditions trigger a notification, and alert transports define where notifications are sent.
Email Alerting
Configure email settings in the LibreNMS configuration. Edit the .env file or configure through the web UI at Settings > Alerting > Email Options.
sudo su - librenms
./lnms config:set alert.transports.mail.1.email [email protected]
Set the mail driver in the global config. Edit /opt/librenms/.env and add your SMTP settings.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=587
[email protected]
MAIL_PASSWORD=YourMailPassword
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME="LibreNMS Alerts"
Slack Alerting
To send alerts to a Slack channel, create an Incoming Webhook in your Slack workspace, then add it as a transport in LibreNMS. Go to Alerts > Alert Transports > Create Transport.
- Transport Type: Slack
- Webhook URL: https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
- Channel: #network-alerts
You can also add Slack transports via the CLI.
sudo su - librenms
./lnms config:set alert.transports.slack.1.url "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
PagerDuty Alerting
For PagerDuty integration, you need a PagerDuty service integration key. Navigate to Alerts > Alert Transports > Create Transport and select PagerDuty as the type.
- Transport Type: PagerDuty
- Integration Key: Your PagerDuty Events API v2 integration key
PagerDuty alerts include device name, alert severity, and the specific condition that triggered the notification. Resolved alerts automatically clear the incident in PagerDuty.
Create Alert Rules
LibreNMS ships with a set of default alert rules. Import them from Alerts > Alert Rules > Create Rule from Collection. Common rules include device down, port utilization over threshold, high CPU, and disk space warnings.
To create a custom rule, go to Alerts > Alert Rules > Create New Rule and define the condition using the rule builder. For example, to alert when a port exceeds 90% utilization:
- Rule: ports.ifInOctets_rate / ports.ifSpeed * 100 > 90
- Severity: Critical
- Recovery: Enabled
Assign the transport (email, Slack, or PagerDuty) to the alert rule to start receiving notifications.
Step 16: Add Distributed Pollers for Scalability
For large networks with hundreds or thousands of devices, a single poller may not complete all polls within the 5-minute polling interval. LibreNMS supports distributed polling to spread the workload across multiple servers.
Architecture Overview
The distributed polling setup consists of a central server (running the database, web UI, and RRD storage) and one or more remote pollers that run polling and discovery tasks. All pollers connect to the same MariaDB database and share the same RRD storage (via NFS or RRDcached).
Configure the Central Server
On the main LibreNMS server, enable distributed polling in the configuration.
sudo su - librenms
./lnms config:set distributed_poller true
./lnms config:set distributed_poller_memcached_host 10.0.1.10
./lnms config:set distributed_poller_memcached_port 11211
Install and start Memcached on the central server. Distributed polling requires Memcached for lock coordination between pollers.
sudo dnf install -y memcached
sudo systemctl enable --now memcached
Configure MariaDB on the central server to accept remote connections. Edit /etc/my.cnf.d/mariadb-server.cnf and set the bind address.
[mysqld]
bind-address = 0.0.0.0
Grant database access to the remote poller IP addresses.
sudo mariadb -u root -p
Run the following SQL to grant access from the remote poller.
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'10.0.1.20' IDENTIFIED BY 'StrongDBPass2025';
FLUSH PRIVILEGES;
EXIT;
Restart MariaDB to apply the bind address change.
sudo systemctl restart mariadb
Configure the Remote Poller
On the remote poller server, install LibreNMS following Steps 1 through 6 of this guide. Skip the web server and database server installation – the remote poller only needs PHP, SNMP tools, and the LibreNMS codebase.
Configure the remote poller to connect to the central database. Edit /opt/librenms/.env on the remote poller.
DB_HOST=10.0.1.10
DB_DATABASE=librenms
DB_USERNAME=librenms
DB_PASSWORD=StrongDBPass2025
Set up RRD storage sharing. The simplest option is to use RRDcached on the central server. Configure it in LibreNMS.
sudo su - librenms
./lnms config:set rrdcached "10.0.1.10:42217"
Copy the cron jobs to the remote poller and start polling. The poller will automatically pick up devices assigned to its polling group.
Step 17: Performance Tuning for LibreNMS
As the number of monitored devices grows, tuning becomes important to keep polls completing within the 5-minute window. For related monitoring approaches, check out monitoring MySQL/MariaDB with Prometheus.
Enable Fast Ping
Fast ping checks device availability without running a full SNMP poll. Enable it to reduce polling time.
sudo su - librenms
./lnms config:set ping_rrd true
./lnms config:set fping_options.count 3
./lnms config:set fping_options.interval 500
./lnms config:set fping_options.timeout 500
Increase Poller Threads
By default, LibreNMS uses 16 poller threads. Increase this based on your CPU count and device count.
./lnms config:set poller_threads 32
Enable RRDcached
RRDcached batches RRD file writes, reducing disk I/O significantly. Install and configure it on the LibreNMS server.
sudo dnf install -y rrdtool-cached
Edit the RRDcached service configuration.
sudo vim /etc/sysconfig/rrdcached
Set the following options to configure caching behavior and socket access.
OPTIONS="-w 1800 -z 900 -f 3600 -B -R -j /tmp -l unix:/run/rrdcached/rrdcached.sock -t 4 -F"
SOCKFILE=/run/rrdcached/rrdcached.sock
SOCKGROUP=librenms
Enable and start RRDcached.
sudo systemctl enable --now rrdcached
Tell LibreNMS to use the RRDcached socket.
sudo su - librenms
./lnms config:set rrdcached "unix:/run/rrdcached/rrdcached.sock"
Optimize MariaDB for LibreNMS
Tune the MariaDB InnoDB buffer pool based on your available RAM. A good starting point is 50-70% of total server memory dedicated to the buffer pool.
sudo vim /etc/my.cnf.d/mariadb-server.cnf
Add or update the following performance settings under [mysqld].
[mysqld]
innodb_buffer_pool_size = 2G
innodb_log_file_size = 256M
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT
max_connections = 256
query_cache_type = 0
Restart MariaDB after changing the buffer pool settings.
sudo systemctl restart mariadb
Enable PHP OPcache Tuning
Tune PHP OPcache for LibreNMS workloads. Edit the OPcache configuration.
sudo vim /etc/php.d/10-opcache.ini
Set these values for better caching.
opcache.enable=1
opcache.memory_consumption=256
opcache.max_accelerated_files=20000
opcache.validate_timestamps=0
opcache.revalidate_freq=0
Restart PHP-FPM to apply the OPcache changes.
sudo systemctl restart php-fpm
Conclusion
LibreNMS is now installed and running on Rocky Linux 10 / AlmaLinux 10 with PHP 8.3, MariaDB, and a web server secured with SSL. The system is ready to discover and monitor network devices, servers, and services using SNMP.
For production environments, enable regular database backups, configure SNMPv3 on all devices, set up distributed polling if you exceed 500 devices, and monitor the LibreNMS server itself with the local SNMP agent. Keep the installation updated by running ./daily.sh regularly or enabling automatic updates through the web UI.
Related Guides
- How To Install LibreNMS on Ubuntu 22.04 / 20.04
- Install LibreNMS on CentOS 7 with Let’s Encrypt and Nginx
- Top Open Source Network and Server Monitoring Tools
- Monitor Linux System with Grafana and Telegraf
- How To Monitor VMware ESXi Host Using LibreNMS




























































