How to Install LibreNMS on EndeavourOS

LibreNMS is a free and open-source network monitoring tool that can be used to monitor network infrastructure, servers, and applications. In this tutorial, we will show you how to install LibreNMS on EndeavourOS.

Prerequisites

Before starting with the installation process, make sure that you have the following prerequisites:

Step 1: Update the System

Before installing any new package, it is always recommended to update the system's existing packages. To do so, open the terminal and run the following command:

sudo pacman -Syu

This command will update all installed packages on your system.

Step 2: Install Required Packages

LibreNMS has some required packages that need to be installed before installation. Open the terminal and run the following command to install them:

sudo pacman -S git sudo nginx mariadb mariadb-clients php php-gd php-mysql php-mcrypt php-pear snmp fping composer git memcached python python-pip python-memcached python-mysqldb rrdtool

When prompted, type 'y' to confirm the installation.

Step 3: Install LibreNMS

Once all the required packages are installed, proceed to download LibreNMS using Git.

sudo git clone https://github.com/librenms/librenms.git /opt/librenms

Run the below command to set the recommended permissions and ownership:

sudo chown -R nginx:nginx /opt/librenms
sudo chmod -R 775 /opt/librenms/bootstrap/cache/ /opt/librenms/storage/ /opt/librenms/logs/

Step 4: Install PHP Dependencies

Navigate to the LibreNMS directory and install PHP dependencies using the following command:

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

Step 5: Configure NGINX

Create a new nginx configuration file using the following command:

sudo nano /etc/nginx/conf.d/librenms.conf

Add the following configuration:

server {
    listen 80;
    server_name your_domain_name_here;
    root /opt/librenms/html/;
    index index.php;
    charset utf-8;
    gzip on;
    gzip_types text/css application/javascript text/javascript application/x-javascript image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
    location /api/v0 {
        try_files $uri $uri/ /api_v0.php?$query_string;
    }
    location ~ \.php {
        include fastcgi.conf;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_index index.php;
        fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
        fastcgi_read_timeout 300;
        fastcgi_buffer_size 32k;
        fastcgi_buffers 4 32k;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
    location ~ /\.ht {
        deny all;
    }
    location /rrd/ {
        alias /opt/librenms/rrd/;
    }
    location /munin/ {
        alias /var/cache/munin/www/;
        index index.html;
    }
    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }
    location /health-check {
        access_log off;
        return 200;
    }
}

Save and close the file by pressing 'Ctrl + X', then 'y' to confirm the changes, and finally 'Enter' to exit.

Restart the Nginx service using the following command:

sudo systemctl restart nginx

Step 6: Configure MariaDB

Create a new MariaDB database and user for LibreNMS using the following commands:

sudo mysql -u root
CREATE DATABASE librenms CHARACTER SET utf8 COLLATE utf8_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'your_password_here';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit

Step 7: Setup Cronjob

LibreNMS needs a cron job that runs every 5 minutes to update and store the data. Open the crontab configuration file using the following command:

sudo nano /etc/cron.d/librenms

Add the following line:

*/5 * * * * librenms /opt/librenms/cronic /opt/librenms/cron.php >> /dev/null 2>&1

Save and close the file.

Step 8: Access LibreNMS Web Interface

Open a web browser and enter the following URL:

http://your_domain_name_here/

You will be redirected to the LibreNMS installation wizard page. Follow the instructions and provide the required information, including database credentials and administrator credentials.

Once the installation is complete, you should be able to access LibreNMS's web interface, where you can add devices and start monitoring your network.

Conclusion

In this tutorial, you learned how to install LibreNMS, a free and open-source network monitoring tool, on EndeavourOS. You also configured NGINX, set up the database, and added the necessary cronjob, allowing you to access the web interface and start monitoring your network.

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!