On Debian 13:
sudo apt update
sudo apt install -y composer php-cli php-mysql php-gd php-snmp php-ldap php-curl php-mbstring php-json php-zip php-bcmath php-xml php-fpm snmp snmpd fping graphviz imagemagick rrdtool mysql-server nginx php-fpm
On RHEL 10:
sudo dnf install -y epel-release
sudo dnf install -y composer php-cli php-mysqlnd php-gd php-snmp php-ldap php-curl php-mbstring php-json php-zip php-bcmath php-xml php-fpm snmp snmpd fping graphviz imagemagick rrdtool mariadb-server nginx php-fpm
On Debian 13:
sudo systemctl enable --now mysql
On RHEL 10:
sudo systemctl enable --now mariadb
Secure and create the database:
sudo mysql_secure_installation
sudo mysql -e "CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
sudo mysql -e "CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'StrongPassword123!';"
sudo mysql -e "GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';"
sudo mysql -e "FLUSH PRIVILEGES;"
cd /opt
sudo git clone https://github.com/librenms/librenms.git
cd librenms
sudo git checkout master
Set proper permissions:
sudo mkdir -p /opt/librenms/{logs,rrd}
sudo chown -R www-data:www-data /opt/librenms # Debian
# or on RHEL:
sudo chown -R nginx:nginx /opt/librenms
sudo chmod 775 /opt/librenms
Create PHP configuration:
sudo cp snmpd.conf.example /opt/librenms/snmpd.conf
sudo cp librenms.env.example /opt/librenms/librenms.env
Edit /opt/librenms/librenms.env:
sudo nano /opt/librenms/librenms.env
Set the database credentials:
DB_HOST=localhost
DB_NAME=librenms
DB_USERNAME=librenms
DB_PASSWORD=StrongPassword123!
Create Nginx config:
sudo tee /etc/nginx/sites-available/librenms >/dev/null <<'EOF'
server {
listen 80;
server_name librenms.example.com;
root /opt/librenms/html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
}
location ~ /\.ht {
deny all;
}
}
EOF
On Debian 13:
sudo ln -s /etc/nginx/sites-available/librenms /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
On RHEL 10:
sudo tee /etc/nginx/conf.d/librenms.conf >/dev/null <<'EOF'
server {
listen 80;
server_name librenms.example.com;
root /opt/librenms/html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
}
location ~ /\.ht {
deny all;
}
}
EOF
sudo nginx -t
sudo systemctl restart nginx
cd /opt/librenms
sudo ./scripts/install.sh
This will:
sudo cp librenms.nonroot.cron /etc/cron.d/librenms
sudo systemctl enable --now librenms.timer
Edit SNMP daemon config:
sudo tee /etc/snmp/snmpd.conf >/dev/null <<'EOF'
rocommunity public default
sysLocation Your Server Location
sysContact admin@example.com
EOF
Restart SNMP:
sudo systemctl enable --now snmpd
On UFW:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 161/udp
On firewalld:
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
Open http://SERVER_IP or http://librenms.example.com and log in with the admin credentials created during installation.
LibreNMS will automatically discover:
See LibreNMS Hardening.
Stuck on a step or need custom configuration? We provide paid consulting for LibreNMS deployments, from single-instance setups to distributed clusters.
📧 office@linux-server-admin.com
🌐 Contact Page
Prefer automation? See LibreNMS Ansible Setup for an example playbook.
Prefer containers? See LibreNMS Docker Setup.
See LibreNMS Configuration for configuration guidance.
See LibreNMS Security for hardening guidance.