LibreNMS is an open-source network monitoring system that can be easily installed and configured on Arch Linux. In this tutorial, we'll guide you through the process of installing LibreNMS on your Arch Linux system.
Before we start, make sure that you have the following prerequisites installed on your Arch Linux system:
To install the prerequisites, use the following commands:
sudo pacman -S nginx php php-fpm php-gd php-snmp php-mysql mariadb mariadb-clients git net-snmp
Let's start by configuring MySQL/MariaDB for use with LibreNMS. Run the following commands:
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
The mysql_secure_installation
command will guide you through the process of securing your MySQL/MariaDB installation. Follow the prompts and set a secure password for the root user.
Now, create a new database and user for LibreNMS:
sudo mysql -u root -p
MariaDB> CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
MariaDB> CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD';
MariaDB> GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
MariaDB> FLUSH PRIVILEGES;
MariaDB> EXIT;
Make sure to replace YOUR_PASSWORD with a strong password.
Next, we will install and configure LibreNMS.
cd /opt
sudo git clone https://github.com/librenms/librenms.git
sudo chown -R http:http librenms
cd librenms
sudo cp .env.defaults .env
sudo composer install --no-dev
Edit .env
file and update the following lines with your MySQL/MariaDB database information:
DB_HOST=localhost
DB_DATABASE=librenms
DB_USERNAME=librenms
DB_PASSWORD=YOUR_PASSWORD
Create a new Nginx server block for LibreNMS:
sudo nano /etc/nginx/conf.d/librenms.conf
Copy and paste the following configuration:
server {
listen 80;
server_name YOUR_DOMAIN;
root /opt/librenms/html;
index index.php;
charset utf-8;
# Redirect all HTTP requests to HTTPS
if ($scheme != "https") {
return 301 https://$host$request_uri;
}
# Access and Error Logging
access_log /var/log/nginx/librenms-access.log;
error_log /var/log/nginx/librenms-error.log;
# SSL Configuration
ssl_certificate /etc/ssl/certs/librenms.crt;
ssl_certificate_key /etc/ssl/private/librenms.key;
# SSL Security
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL;
# PHP Configuration
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location /api/v0 {
try_files /api_v0.php?$query_string /api_v0.php?$query_string;
}
location ~ .php$ {
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Replace YOUR_DOMAIN with your domain name.
Generate SSL certificate:
sudo mkdir /etc/ssl/private
sudo chmod 700 /etc/ssl/private
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/librenms.key -out /etc/ssl/certs/librenms.crt
Make sure to enter the correct information when prompted.
Finally, start and enable services:
sudo systemctl start php-fpm
sudo systemctl enable php-fpm
sudo systemctl start nginx
sudo systemctl enable nginx
You're all set! Open your web browser and navigate to https://YOUR_DOMAIN
. You should be able to log in with the default username librenms
and password librenms
.
Congratulations! You have successfully installed LibreNMS on Arch Linux.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!