Install LibreNMS on Debian/Ubuntu
#LibreNMS #NetworkMonitoring #Linux
Full steps can be found at https://i12bretro.github.io/tutorials...
01. Log into the Debian device
02. Run the following commands in a terminal:
update software repositories
sudo apt update
install software updates
sudo apt upgrade -y
install pre-requisites
sudo apt install acl curl composer fping git graphviz imagemagick mariadb-client mariadb-server mtr-tiny nmap rrdtool snmp snmpd whois unzip python3-pymysql python3-dotenv python3-redis python3-setuptools python3-systemd python3-pip -y
install Apache and MySQL
sudo apt install apache2 libapache2-mod-fcgid mariadb-server mariadb-client -y
install PHP components
sudo apt install php7.3-cli php7.3-curl php7.3-fpm php7.3-gd php7.3-json php7.3-mbstring php7.3-mysql php7.3-snmp php7.3-xml php7.3-zip -y
create librenms user
sudo useradd librenms -d /opt/librenms -M -r -s "$(which bash)"
clone librenms github repo
sudo git clone https://github.com/librenms/librenms.git /opt/librenms
set permissions
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/
install composer dependencies
sudo su - librenms
./scripts/composer_wrapper.php install --no-dev
exit
set time zone for PHP fpm
sudo nano /etc/php/7.3/fpm/php.ini
03. Press CTRL+W to search ≫ type timezone ≫ Press Enter
04. Remove the ; to uncomment the line
05. Type in a valid timezone (https://php.net/manual/en/timezones.php)
06. Press CTRL+O, Enter, CTRL+X to write the changes to php.ini
07. Continue with the following commands in a terminal:
set time zone for PHP cli
sudo nano /etc/php/7.3/cli/php.ini
08. Press CTRL+W to search ≫ type timezone ≫ Press Enter
09. Remove the ; to uncomment the line
10. Type in a valid timezone (https://php.net/manual/en/timezones.php)
11. Press CTRL+O, Enter, CTRL+X to write the changes to php.ini
12. Continue with the following commands in a terminal:
13. # set system time zone
sudo timedatectl set-timezone America/New_York
edit mariaDB configuration
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
14. Paste the following under the [mysqld] section
innodb_file_per_table=1
lower_case_table_names=0
15. Press CTRL+O, Enter, CTRL+X to write the changes to 50-server.cnf
16. Continue with the following commands in a terminal:
restart mariadb service
sudo systemctl restart mariadb
configure the MySQL database
sudo su
mysql_secure_installation
17. Press Enter to login as root
18. Type Y and press Enter to set a root password, type the password twice to confirm
19. Type Y and press Enter to remove anonymous users
20. Type Y and press Enter to disallow root login remotely
21. Type Y and press Enter to remove the test database
22. Type Y and press Enter to reload privilege tables
23. Run the following command to login into MySQL:
mysql -u root -p
24. Authenticate with the root password set earlier
25. Run the following commands to create the LibreNMS database and database user
CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'librenms_rw'@'localhost' IDENTIFIED BY 'Libr3NM$!';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms_rw'@'localhost';
FLUSH PRIVILEGES;
EXIT;
exit
26. Continue with the following commands:
make a copy of www.conf
sudo cp /etc/php/7.3/fpm/pool.d/www.conf /etc/php/7.3/fpm/pool.d/librenms.conf
edit librenms.conf
sudo nano /etc/php/7.3/fpm/pool.d/librenms.conf
27. Replace [www] with [librenms]
28. Change the user and group to librenms
user = librenms
group = librenms
29. Change the listen to php-fpm-librenms.sock
listen = /run/php-fpm-librenms.sock
30. Press CTRL+O, Enter, CTRL+X to write the changes to librenms.conf
31. Continue with the following commands:
create librenms apache conf
sudo nano /etc/apache2/sites-available/librenms.conf
32. Paste the following configuration into librenms.vhost
≪VirtualHost *:80≫
DocumentRoot /opt/librenms/html/
#ServerName librenms.example.com
....Full steps can be found on GitHub [link at the top]
Connect with me and others ###
★ Discord: / discord
★ Reddit: / i12bretro
★ Twitter: / i12bretro