Skip to content
Follow
CMS

Install LibreNMS with Nginx on Ubuntu 24.04

Richard
Written by
Richard
Feb 17, 2025 Updated Jul 13, 2026 8 min read
Install LibreNMS with Nginx on Ubuntu 24.04
Install LibreNMS with Nginx on Ubuntu 24.04

Install LibreNMS with Nginx on Ubuntu 24.04 to set up a free system for watching your network.

LibreNMS is an open-source tool that finds and monitors your network devices, like routers and servers. It shows you how well they are working and sends alerts if there’s a problem.

Nginx is a fast web server that works well with LibreNMS to show you this information. This guide explains how to put them both together on Ubuntu 24.04 LTS.

⚡ Quick Answer

Install LibreNMS with Nginx on Ubuntu 24.04 by first installing Nginx via `sudo apt install nginx`. Then install MariaDB using `sudo apt install mariadb-server`. Create a database and user for LibreNMS within MariaDB, and finally install the necessary PHP and Python modules.

Install Nginx HTTP server on Ubuntu

Nginx is a popular web server that you need to install on your Ubuntu 24.04 system to serve LibreNMS. Open the Ubuntu terminal and run the commands to install Nginx, and then you can start, stop, or set it to run automatically when your server starts up.

To do that, open the Ubuntu terminal and run the commands below to install the Nginx web server.

🐧Bash / Shell
sudo apt update
sudo apt install nginx

Once Nginx is installed, the commands below can start, stop, and enable the Nginx web server to start automatically when your server boots up.

🐧Bash / Shell
sudo systemctl stop nginx
sudo systemctl start nginx
sudo systemctl enable nginx

You can test the Nginx web server by opening your web browser and browsing to the server’s localhost or IP address.

http://localhost

Nginx welcome page displayed on Ubuntu 24.04
Nginx welcome page displayed on Ubuntu 24.04

When you see the Welcome to nginx!, it means the Nginx HTTP server is successfully installed.

Additional help on installing Nginx on Ubuntu is in the link below.

How to install Nginx on Ubuntu

Install the MariaDB database server on Ubuntu

LibreNMS needs a database to store all its information, so installing the MariaDB database server on Ubuntu is your next step. Open the Ubuntu terminal and use the commands provided to install MariaDB, which will then be ready for its configuration.

To install and use the MariaDB database server, use the instructions below.

Open the Ubuntu terminal and run the commands below to install the MariaDB database server.

🐧Bash / Shell
sudo apt update
sudo apt install mariadb-server

Once the MariaDB database server is installed, use the commands below to stop, start, and enable the MariaDB server to start automatically when the server boots.

🐧Bash / Shell
sudo systemctl stop mariadb
sudo systemctl start mariadb
sudo systemctl enable mariadb

Run the following commands to validate and test if the MariaDB database server is installed successfully.

🐧Bash / Shell
sudo mariadb

Once you run the commands above, it will log you onto the MariaDB console and display a message similar to the one below.

💻Code
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 32
Server version: 10.11.2-MariaDB-1 Ubuntu 23.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]> 

The message tells you that the server is installed successfully.

Additional help on installing MariaDB.

Create a LibreNMS database

Now that MariaDB is set up, you need to create a dedicated database and a user specifically for LibreNMS. This involves creating a database named ‘librenmsdb’ and a user account called ‘librenmsdbuser’, then giving that user full access to the database.

As part of the setup, we will create a librenmsdb database and a user account called librenmsdbuser.

The `librenmsdbuser` receives full access to the `librenmsdb` database, allowing LibreNMS to perform necessary read and write operations for monitoring network devices.

All the database steps above can be done using the commands below:

But first, log on to the MariaDB database server:

🐧Bash / Shell
sudo mariadb

Then run the commands below to complete the steps:

💻Code
CREATE DATABASE librenmsdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER librenmsdbuser@localhost IDENTIFIED BY 'type_your_password_here';
GRANT ALL ON librenmsdb.* TO librenmsdbuser@localhost WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
⚠️Warning
Ensure to replace ‘type_your_password_here ‘with your password.

Install PHP and Python modules

LibreNMS relies on PHP to work, so installing the right PHP modules on Ubuntu is essential for it to function correctly. The commands that follow will install the latest PHP version along with all the necessary modules like php-fpm, php-mysql, and others that LibreNMS needs.

Then, run the commands below to install the latest PHP version.

🐧Bash / Shell
sudo apt install php-fpm php-intl php-mysql php-curl php-cli php-zip php-xml php-gd php-common php-mbstring php-xmlrpc php-bcmath php-json php-sqlite3 php-soap php-zip php-ldap php-imap php-redis acl curl fping git graphviz imagemagick mtr-tiny nmap php-gmp php-snmp rrdtool snmp snmpd unzip python3-command-runner python3-pymysql python3-dotenv python3-redis python3-setuptools python3-psutil python3-systemd python3-pip whois traceroute

Additional help on installing PHP

How to install PHP on Ubuntu Linux

Download and install LibreNMS files

To get LibreNMS running, you will download its latest application files to your Ubuntu server and create a special user account for it. First, create a new account called ‘librenms’ for LibreNMS to run its services, then navigate to the /opt directory to download the LibreNMS files using the git command.

First, create a new account called ‘librenms‘ for LibreNMS to run its services.

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

Next, navigate to the /opt directory and use the git command to download the content for LibreNMS.

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

After creating the LibreNMS account and downloading its content, execute the commands below to set the correct permissions for files and directories.

🐧Bash / Shell
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/

Next, switch to the librenms account and run the command below to download the required dependencies for LibreNMS.

🐧Bash / Shell
sudo su - librenms
./scripts/composer_wrapper.php install --no-dev
exit

Next, open the PHP configuration file and update the system’s timezone. Ensure that PHP has the same timezone as the server.

🐧Bash / Shell
sudo nano /etc/php/8.3/fpm/php.ini
sudo nano /etc/php/8.3/cli/php.ini

Update the data.timezone line in the file.

🐘PHP
[Date]
; Defines the default timezone used by the date functions
; https://php.net/date.timezone
date.timezone = America/Chicago
⚠️Warning
Remember to set the system timezone as well.
🐧Bash / Shell
sudo timedatectl set-timezone "America/Chicago"

Once you have completed all the above steps, continue configuring the Nginx web server below to serve the LibreNMS content.

Run the commands below to create an nginx virtual host file for LibreNMS.

🐧Bash / Shell
sudo nano /etc/nginx/sites-available/librenms.conf

Then, copy and paste the content block below into the Nginx server block.

🐘PHP
server {
listen 80;
listen [::]:80;
root /opt/librenms/html;
index index.php;
server_name librenms.example.com;

access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

Save the file.

The `www-data` account requires access to LibreNMS files for proper operation. You add the `www-data` account to the `librenms` group by running the command `sudo usermod -aG librenms www-data`. This action grants the web server user the necessary permissions.

🐧Bash / Shell
sudo usermod -a -G librenms www-data

Then, run the commands below to enable the virtual host and restart the Nginx server.

🐧Bash / Shell
sudo ln -s /etc/nginx/sites-available/librenms.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx.service
sudo systemctl restart php8.3-fpm

Setup Let’s Encrypt SSL/TLS for LibreNMS

Securing your LibreNMS installation with a free Let’s Encrypt SSL/TLS certificate is important for safe connections. This section guides you through setting up the certificate for Nginx on Ubuntu, ensuring your LibreNMS is protected. Refer to the linked guide for detailed steps on creating Let’s Encrypt certificates.

Please read the post below for additional resources on installing and creating Let’s Encrypt SSL certificates for Nginx.

How to set up Let’s Encrypt SSL certificate for Nginx on Ubuntu Linux

Once you have restarted the Nginx web server, open your browser and browse to the server hostname or IP address defined in the Nginx server block.

💻Code
http://librenms.example.com/install

The LibreNMS installation wizard should appear.

LibreNMS installation wizard
LibreNMS installation wizard

Click on the database icon to continue. Then, type in the database name and password.

Build the database when prompted.

LibreNMS installation wizard database
LibreNMS installation wizard database

Create an admin account and continue.

LibreNMS installation wizard admin
LibreNMS installation wizard admin

Finish the installation.

LibreNMS installation wizard finish
LibreNMS installation wizard finish

LibreNMS should be ready to use.

LibreNMS installation wizard portal
LibreNMS installation wizard portal

Fix all warnings in the portal.

That should do it!

Conclusion

  • Comprehensive Network Monitoring: LibreNMS provides a robust solution for effectively monitoring network devices, servers, and services.
  • Seamless Integration: When paired with Nginx, LibreNMS showcases enhanced performance and efficient resource usage.
  • Security Enhancements: Implementing SSL/TLS via Let’s Encrypt secures your LibreNMS installation, protecting data transmitted over the network.
  • User-Friendly Installation: The step-by-step setup guide allows users to configure LibreNMS on Ubuntu easily, ensuring a hassle-free deployment process.
  • Active Community Support: Being an open-source project, LibreNMS benefits from a vibrant community, offering support and continuous improvements.

With these features and enhancements, LibreNMS is an excellent choice for anyone seeking to implement an effective network monitoring solution.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

Install MySQL and MariaDB on Ubuntu: A Step-by-Step Guide
Ubuntu Linux Install MySQL and MariaDB on Ubuntu: A Step-by-Step Guide
How to Install Nginx on Ubuntu Linux
Ubuntu Linux How to Install Nginx on Ubuntu Linux
How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04
How to Install Emby Media Server on Ubuntu 24.04
Ubuntu Linux How to Install Emby Media Server on Ubuntu 24.04

No comments yet — be the first to share your thoughts!

Leave a Comment

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