← Back to Blog
Draft — not yet published

Installing LibreNMS: A Practical Setup Guide

LibreNMS is the device health layer of my observability stack. It polls switches and routers over SNMP, auto-discovers topology, and tracks performance history. Here is how to get it running.

Prerequisites

  • A dedicated LXC container or VM (Ubuntu 22.04/24.04 recommended)
  • 2 vCPU, 2GB RAM minimum for small deployments (under 50 devices)
  • SNMP enabled on the devices you want to monitor

1. Install dependencies

sudo apt update && sudo apt upgrade -y
sudo apt install -y software-properties-common
sudo add-apt-repository universe
sudo apt install -y acl curl fping git graphviz imagemagick mariadb-client \
  mariadb-server mtr-tiny nginx-full nmap php php-cli php-curl php-fpm \
  php-gd php-gmp php-json php-mbstring php-mysql php-snmp php-xml php-zip \
  python3-pymysql python3-dotenv python3-redis python3-setuptools \
  python3-systemd rrdtool snmp snmpd unzip whois

2. Create the LibreNMS user and pull the code

sudo useradd librenms -d /opt/librenms -M -r -s "$(which bash)"
cd /opt
sudo git clone https://github.com/librenms/librenms.git
sudo chown -R librenms:librenms /opt/librenms
sudo chmod 771 /opt/librenms

3. Install PHP dependencies

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

4. Configure MariaDB

sudo mysql -u root
CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'CHOOSE_A_STRONG_PASSWORD';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
FLUSH PRIVILEGES;
exit

5. Configure PHP timezone and web server

Set your timezone in /etc/php/*/fpm/php.ini and /etc/php/*/cli/php.ini:

date.timezone = "Your/Timezone"

Set up an Nginx site pointing to /opt/librenms/html with the PHP-FPM socket, then reload:

sudo systemctl restart nginx
sudo systemctl restart php*-fpm

6. Run the web installer

Visit http://your-server/install in a browser and complete the guided setup. It will validate PHP extensions, connect to the database, and create the admin account.

7. Enable SNMP polling and cron

sudo cp /opt/librenms/librenms.nonroot.cron /etc/cron.d/librenms

8. Add your first device

sudo su - librenms
./addhost.php <device-ip> <snmp-community> v2c
./discovery.php -h all
exit

Production notes from my own setup

  • I run LibreNMS inside an LXC container, isolated from config backup and alerting workloads, so a heavy SNMP polling cycle never starves other services
  • SNMPv2c is fine for internal segments; use SNMPv3 if any polling crosses an untrusted network
  • Autodiscovery via CDP/LLDP and BGP/OSPF peering saves significant manual device entry once your seed devices are added
  • Enable syslog-ng and snmptrapd integration early. Historical syslog data is far more useful once you actually need to look back at an incident

What I'd check before going to production

  • Confirm rrdtool and Redis are configured if you plan to scale past a handful of devices
  • Set up distributed poller mode if you have more than one site or a large device count
  • Back this box up like any other critical system. Your monitoring platform going down during an outage is the worst possible time to lose visibility
← Back to Blog