• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

BeginnersBox

How to Guides, Tutorials and Much More

  • Home
  • Tutorials
  • Opinions
You are here: Home / Tutorials / How to Install and Configure LibreNMS on Ubuntu 24?

How to Install and Configure LibreNMS on Ubuntu 24?

By Sourabh Verma | November 11, 2025 | Updated on: December 7, 2025

Facebook Share on Facebook Twitter Share on Twitter LinkedIn Share on LinkedIn Reddit Share on Reddit WhatsApp Share on WhatsApp Email Share via Email

LibreNMS is a powerful, fully featured open-source network monitoring tool. It is developed on PHP and MySQL. LibreNMS is a community-driven tool that uses the SNMP protocol for various network-based monitoring. To monitor a server in real time, you can install and configure OpenSearch.

In this tutorial, you will learn how to install and configure LibreNMS on Ubuntu 24. We will use Nginx as our web server, MariaDB for MySQL database, and PHP for PHP compilations.

In this tutorial, you will learn

  • Prerequisites
  • Step 1 – Installing all the dependencies
  • Step 2 – Configure MariaDB
  • Step 3 – Install LibreNMS
  • Step 4 – Configure PHP
  • Step 5 – Configure Nginx
  • Step 6 – Configure the firewall
  • Step 7 – Configuring SSL
  • Step 8 – Enable LNMS command completion
  • Step 9 – Configure SNMP
  • Step 10 – Configure cron job
  • Step 11 – Restart all the services and finalize the setup
  • Conclusion

Prerequisites

  • An Ubuntu 24 server with initial configuration done. You can check out my post on initial server setup with Ubuntu for initial server configuration.
  • A user with sudo privileges
  • A domain name

Step 1 – Installing all the dependencies

The first step is to install all dependencies, including Nginx, MariaDB, and PHP.

# sudo apt update
# sudo apt upgrade -y

Let’s first add the ppa:ondrej repository and update our repository

# sudo add-apt-repository ppa:ondrej/php -y
# sudo apt update

Now, let’s install dependencies

# sudo apt install -y acl curl fping git graphviz imagemagick mariadb-client mariadb-server mtr-tiny nginx-full nmap php8.3-cli php8.3-curl php8.3-fpm php8.3-gd php8.3-gmp php8.3-json php8.3-mbstring php8.3-mysql php8.3-snmp php8.3-xml php8.3-zip php8.3-ldap rrdtool snmp snmpd unzip python3-pymysql python3-dotenv python3-redis python3-setuptools python3-systemd python3-pip whois traceroute

Step 2 – Configure MariaDB

The second step is to install and configure MariaDB, which includes creating a database and a user for LibreNMS.

# sudo mariadb-secure-installation

Follow the steps given below

Enter current password for root (leave blank if none): {Just hit Enter key here}
Switch to unix_socket authentication? (Y/n):N {Press N and hit Enter}
Change the root password? (Y/n):Y {Press Y and hit Enter to setup root password}
Remove anonymous users? (Y/n):Y {Press Y and hit Enter}
Disallow root login remotely? (Y/n):Y {Press Y and hit Enter}
Remove test database and access to it? (Y/n): Y {Press Y and hit Enter}
Reload privilege tables now? (Y/n): Y {Press Y and hit Enter}
# sudo mysql -u root -p
CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'strong_password';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Note: Make sure to enter a strong password in place of “strong_password“.

Step 3 – Install LibreNMS

Now, let’s install LibreNMS and configure PHP to work with it. First, let’s create a user

# sudo useradd librenms -d /opt/librenms -M -r -s "$(which bash)"

Now, let’s download LibreNMS

# cd /opt
# sudo git clone https://github.com/librenms/librenms.git /opt/librenms

Now, let’s set proper permissions

# sudo chown -R librenms:librenms /opt/librenms
# sudo chmod 771 /opt/librenms
# 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/

Step 4 – Configure PHP

The next step is to install some dependencies and configure PHP

# sudo su - librenms
# ./scripts/composer_wrapper.php install --no-dev
# exit

Note: Sometimes, because of proxies, the above command may cause errors; in that case, ignore the above command and run the commands given below.

# sudo wget https://getcomposer.org/composer-stable.phar
# sudo mv composer-stable.phar /usr/bin/composer
# sudo chmod +x /usr/bin/composer

Now edit both the files given below and set the timezone

# sudo nano /etc/php/8.3/fpm/php.ini
# sudo nano /etc/php/8.3/cli/php.ini

Update as per below in both the files

date.timezone = Etc/UTC

Also, make sure to update the system time zone

# sudo timedatectl set-timezone Etc/UTC

Now we will copy the www.conf file and use it so that PHP won’t interfere with any other tool or website hosted on the same server

# sudo cp /etc/php/8.3/fpm/pool.d/www.conf etc/php/8.3/fpm/pool.d/librenms.conf

Now, let’s configure our copied file

# sudo nano /etc/php/8.3/fpm/pool.d/librenms.conf

change

[www]

to

[librenms]

Change user and group as per below

user = librenms
group = librenms

Also make sure to change the listen parameter as per below

listen = /run/php-fpm-librenms.sock

Now, save the file and exit

Step 5 – Configure Nginx

Next, what we have to do is to configure the Nginx web server. So let’s first create a configuration file for it and add the required configuration

# sudo nano /etc/nginx/sites-available/librenms.conf

Copy and paste the code mentioned below

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-librenms.sock;
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  include fastcgi.conf;
 }
 location ~ /\.(?!well-known).* {
  deny all;
 }
}

Note: Make sure to change “librenms.example.com” to your real domain name

Save and exit the file

Now, let’s enable the website

# sudo ln -s /etc/nginx/sites-available/librenms.conf /etc/nginx/sites-enabled/
# sudo systemctl restart nginx

Step 6 – Configure the firewall

The next step is to configure the firewall

# sudo ufw allow 80/tcp
# sudo ufw allow 443/tcp
# sudo ufw enable
# sudo ufw reload

Step 7 – Configuring SSL

The next step is to configure the Let’s Encrypt SSL

# sudo apt install certbot python3-certbot-nginx -y
# sudo certbot --nginx -d Your_Domain

Note: Make sure to change “Your_Domain” to your real domain name.

Step 8 – Enable LNMS command completion

Execute the command below to enable LNMS commands

# sudo ln -s /opt/librenms/lnms /usr/bin/lnms
# sudo cp /opt/librenms/misc/lnms-completion.bash /etc/bash_completion.d/

Step 9 – Configure SNMP

For SNMP to work with our setup, we need to configure it

# sudo cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
# sudo nano /etc/snmp/snmpd.conf

Replace RANDOMSTRINGGOESHERE with any community string of your choice

# sudo curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
# sudo chmod +x /usr/bin/distro
# sudo systemctl enable snmpd
# sudo systemctl restart snmpd

Step 10 – Configure cron job

Since LibreNMS uses various cron jobs for its tasks, let’s configure it

# sudo cp /opt/librenms/dist/librenms.cron /etc/cron.d/librenms

Enable the scheduler

# sudo cp /opt/librenms/dist/librenms-scheduler.service /opt/librenms/dist/librenms-scheduler.timer /etc/systemd/system/
# sudo systemctl enable librenms-scheduler.timer
# sudo systemctl start librenms-scheduler.timer

Step 11 – Restart all the services and finalize the setup

Now, let’s restart all the services and finalize the configuration

# sudo systemctl restart php8.3-fpm nginx snmpd
# sudo systemctl enable librenms-scheduler.timer
# sudo systemctl start librenms-scheduler.timer

Now, access the LibreNMS by entering your domain in any browser.

Conclusion

With this, you have configured LibreNMS on Ubuntu.

Category: Tutorials Tagged In: linux, Server, Ubuntu

Facebook Share on Facebook Twitter Share on Twitter LinkedIn Share on LinkedIn Reddit Share on Reddit WhatsApp Share on WhatsApp Email Share via Email

Reader Interactions

Leave a Reply Cancel reply

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

Primary Sidebar

About Sourabh

Hi, I am Sourabh. With over 12 years of experience in Linux, Windows, servers, databases and other I.T related areas, I make sure to publish easy and well tested tutorials and opinions. I hope you like my work. Thanks

Stay with BeginnersBox

FacebookFollow on FacebookTwitterFollow on TwitterLinkedInFollow on LinkedInYouTubeSubscribe on YouTubeInstagramFollow on InstagramRSSSubscribe to RSS Feed

Copyright © 2026 · BeginnersBox · All Rights Reserved.

  • Contact Us
  • Privacy Policy
  • Disclaimer