How to Install LibreNMS with Apache on Ubuntu 24.04
Installing LibreNMS with Apache on Ubuntu 24.04 sets up a free system for watching over your network.
LibreNMS is a network monitoring tool that helps you see and track all your connected devices, like routers, switches, and servers. It uses information from your network to show you how well everything is running.
Apache is a web server that displays the LibreNMS system through your web browser. This guide shows you how to get both working together on Ubuntu 24.04.
Install Apache2 and MariaDB server using `apt install apache2 mariadb-server`. Create the `librenmsdb` database and `librenmsdbuser` within MariaDB. Then, install necessary PHP and Python modules for LibreNMS.
Install Apache HTTP server on Ubuntu
Apache is the web server software that lets you view LibreNMS in your browser. Installing Apache on Ubuntu is simple and can be done using commands in the terminal. These commands update your package list and then install the Apache web server package.
To do that, open the Ubuntu terminal and run the commands below to install the Apache web server.
sudo apt update
sudo apt install apache2
Once Apache is installed, the commands below can start, stop, and enable the Apache web server to start automatically when your server boots up.
sudo systemctl stop apache2
sudo systemctl start apache2
sudo systemctl enable apache2
You can test that the Apache web server is running by opening your web browser and browsing to the server’s localhost or IP address.
http://localhost

When you see the Apache2 Default Page, it means the Apache HTTP server is successfully installed.
Additional help on installing Apache on Ubuntu is in the link below.
Install the MariaDB database server on Ubuntu
LibreNMS needs a database to store your network data, and MariaDB is a great choice. Installing the MariaDB database server on Ubuntu is easy using terminal commands. These commands will install MariaDB and prepare it for use with LibreNMS.
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.
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.
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.
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.
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.
- How to install MariaDB on Ubuntu Linux
- MariaDB without password prompt
Create a LibreNMS database
After installing MariaDB, you must create a specific database and user for LibreNMS to manage its data securely. This setup involves creating a database named ‘librenmsdb’ and a user named ‘librenmsdbuser’ with full permissions. This ensures LibreNMS has its own dedicated and protected space for network information.
As part of the setup, we will create a librenmsdb database and a user account called librenmsdbuser.
The `librenmsdbuser` gets full access to the `librenmsdb` database for LibreNMS to store and retrieve monitoring data correctly. This step ensures the LibreNMS application can manage its database operations without permission issues.
All the database steps above can be done using the commands below:
But first, log on to the MariaDB database server:
sudo mariadb
Then run the commands below to complete the steps:
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
Install PHP and Python modules
LibreNMS requires PHP and several specific PHP add-ons, along with some Python tools, to function correctly. We will install the latest PHP version and all necessary modules using simple terminal commands. This step ensures LibreNMS has the required software environment on your Ubuntu system.
Then, run the commands below to install the latest PHP version.
sudo apt install php libapache2-mod-php 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
Download and install LibreNMS files
It’s time to download and install the core LibreNMS software onto your server. First, a dedicated user account named ‘librenms’ is created for running its services securely. Then, we navigate to the correct directory and use Git to download the latest LibreNMS files, preparing your server to host the application.
First, create a new account called ‘librenms‘ for LibreNMS to run its services.
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.
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.
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.
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.
sudo nano /etc/php/8.3/apache2/php.ini
sudo nano /etc/php/8.3/cli/php.ini
Update the data.timezone line in the file.
[Date]
; Defines the default timezone used by the date functions
; https://php.net/date.timezone
date.timezone = America/Chicago
Remember to set the system timezone as well.
sudo timedatectl set-timezone "America/Chicago"
Once you have completed all the above steps, continue configuring the Apache web server below to serve the LibreNMS content.
Run the commands below to create an Apache virtual host file for LibreNMS.
sudo nano /etc/apache2/sites-available/librenms.conf
Then, copy and paste the content block below into the Apache server block.
<VirtualHost *:80>
ServerName librenms.example.com
ServerAdmin admin@example.com
DocumentRoot /opt/librenms/html
<Directory /opt/librenms/html/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Save the file.
Add the `www-data` account to the `librenms` group to give it the necessary permissions for LibreNMS to function. Run the command `sudo usermod -a -G librenms www-data` to complete this step.
sudo usermod -a -G librenms www-data
Then, run the commands below to enable the virtual host and restart the Apache server.
sudo a2ensite librenms.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Setup Let’s Encrypt SSL/TLS for LibreNMS
Setting up a free SSL/TLS certificate with Let’s Encrypt makes your LibreNMS connection secure by encrypting data between your browser and the server. This process protects your sensitive network information. We will guide you through the steps to install and configure Let’s Encrypt with Apache for LibreNMS on Ubuntu.
Please read the post below for additional resources on installing and creating Let’s Encrypt SSL certificates for Apache.
How to set up Let’s Encrypt SSL certificate for Apache on Ubuntu Linux
Once you have restarted the Apache web server, open your browser and browse to the server hostname or IP address defined in the Apache server block.
http://librenms.example.com/install
The LibreNMS installation wizard should appear.

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

Create an admin account and continue.

Finish the installation.

LibreNMS should be ready to use.

Fix all warnings in the portal.
That should do it!
Conclusion
Installing LibreNMS on Ubuntu with Apache is straightforward, providing a powerful network monitoring tool. Here are the key takeaways:
- Comprehensive Setup: The installation process covers the essential components, including Apache, MariaDB, PHP, and necessary Python modules.
- User-Friendly: Follow the step-by-step instructions to ensure a smooth setup, with detailed commands for each stage.
- Secure Configuration: Implementing Let’s Encrypt SSL/TLS enhances the security of your LibreNMS installation, adding an essential layer of protection.
- Monitor Effectively: Once installed, LibreNMS offers robust features for effectively monitoring network devices, servers, and services.
- Community Support: As an open-source tool, LibreNMS has a strong community that can provide assistance and additional resources for users.
With the preceding configuration steps finished, you possess a fully functional LibreNMS installation. This LibreNMS setup is ready to monitor your network environment, providing real-time data and alerts, making your network management more efficient.
Was this guide helpful?
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.
No comments yet — be the first to share your thoughts!