« Linux Support

LibreNMS on Debian 12/11/10

Netzwerkmonitoring per SNMP

LibreNMS installieren..

#### Install Required Packages
@sudo apt install lsb-release ca-certificates wget acl curl fping git graphviz imagemagick mariadb-client mariadb-  server mtr-tiny nginx-full nmap php-cli php-curl php-fpm php-gd php-gmp php-mbstring php-mysql php-snmp php-xml php-  zip python3-dotenv python3-pymysql python3-redis python3-setuptools python3-systemd python3-pip rrdtool snmp snmpd   unzip whois
#### Add librenms user
@sudo useradd librenms -d /opt/librenms -M -r -s "$(which bash)"
#### Download LibreNMS
@cd /opt
@git clone https://github.com/librenms/librenms.git
#### Set permissions
@chown -R librenms:librenms /opt/librenms
@chmod 771 /opt/librenms
@setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
@setfacl -R -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
#### Install PHP dependencies
@su - librenms
#### Führen Sie dann das Composer-Wrapper-Skript aus und beenden Sie das Programm, um zum Root-Benutzer   zurückzukehren:
@./scripts/composer_wrapper.php install --no-dev
@exit
#
# #################### zusätzliche php Version installieren wenn gewünschtt START
# php8.3 und 8.4 install
@sudo apt install ca-certificates apt-transport-https software-properties-common lsb-release -y
@curl -sSL https://packages.sury.org/php/README.txt | sudo bash -x
@sudo apt update
@sudo apt install php8.3 libapache2-mod-php8.3
@sudo apt install php8.4 libapache2-mod-php8.4
@sudo apt-get install php8.3-common
@sudo apt-get install php8.3-cli
@sudo apt-get install php8.3-fpm
@sudo apt-get install php8.3-json
@sudo apt-get install php8.3-pdo php8.3-mysql
@sudo apt-get install php8.3-zip php8.3-gd  php8.3-mbstring
@sudo apt-get install php8.3-curl
@sudo apt-get install php8.3-xml
@sudo apt-get install php8.3-pear
@sudo apt-get install php8.3-pear php8.3-bcmath
@sudo apt-get install php8.3-cli php8.3-fpm php8.3-json php8.3-pdo php8.3-mysql php8.3-zip php8.3-gd  php8.3-  mbstring php8.3-curl php8.3-xml php8.3-pear php8.3-bcmath
# Danach die anderen beiden versionen installieren muss nur noch jeweils fpm
# php8.0 install
@sudo apt install php8.0 libapache2-mod-php8.0
@sudo apt-get install php8.0-fpm
# php8.1 install
@sudo apt install php8.1 libapache2-mod-php8.1
@sudo apt-get install php8.1-fpm
# #################### zusätzliche php Version installieren wenn gewünschtt ENDE
#
#### PHP Setting
#### Set timezone
###### date.timezone = "Europe/Zurich"
###### Jeweils in cli und fpm Verzeichnis /etc/php/8.4/fpm/php.ini
#### Jeweils in Zeile 976
@sudo nano /etc/php/8.2/fpm/php.ini
@sudo nano /etc/php/8.2/cli/php.ini
#### speicher undschliessen
#### Zusätzlich
timedatectl set-timezone Europe/Zurich
#### Configure MariaDB
@sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
#### Within the [mysqld] section add:
innodb_file_per_table=1
lower_case_table_names=0
#### Then restart MariaDB
@systemctl enable mariadb
@systemctl restart mariadb
#### Start MariaDB client
@mysql -u root
CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
exit
#### Configure PHP-FPM
@sudo cp /etc/php/8.2/fpm/pool.d/www.conf /etc/php/8.2/fpm/pool.d/librenms.conf
@sudo nano /etc/php/8.2/fpm/pool.d/librenms.conf
#### Change [www] to [librenms]:
[librenms]
#### Change user and group to "librenms":
user = librenms
group = librenms
#### Change listen to a unique path that must match your webserver's config (fastcgi_pass for NGINX and SetHandler   for Apache) :
listen = /run/php-fpm-librenms.sock
#### Configure Web Server
@nano /etc/nginx/sites-enabled/librenms.vhost
#### Add the following config, edit server_name as required:
#### Datei Inhalt Start #########
server {
 listen      80;
 server_name librenms.example.com;
 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 ~ [^/]\.php(/|$) {
  fastcgi_pass unix:/run/php-fpm-librenms.sock;
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  include fastcgi.conf;
 }
 location ~ /\.(?!well-known).* {
  deny all;
 }
}
#### Datei Inhalt ENDE ###########
@rm /etc/nginx/sites-enabled/default
@systemctl reload nginx
@systemctl restart php8.2-fpm
#### Aktivieren Sie die lnms-Befehlsvervollständigung
###### Diese Funktion bietet Ihnen die Möglichkeit, zur Vervollständigung von LNMS-Befehlen die Tabulatortaste zu   verwenden, wie Sie es bei normalen Linux-Befehlen tun würden.
@ln -s /opt/librenms/lnms /usr/bin/lnms
@cp /opt/librenms/misc/lnms-completion.bash /etc/bash_completion.d/
#### Configure snmpd (v2c)
#### If you would like to use SNMPv3 then please see here https://docs.librenms.org/Support/SNMP-Configuration-  Examples/#linux-snmpd-v3
@cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf
@sudo nano /etc/snmp/snmpd.conf
#### Anpaasen und speichern
@curl -o /usr/bin/distro https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/distro
@chmod +x /usr/bin/distro
@systemctl enable snmpd
@systemctl restart snmpd
#### Cron job
@cp /opt/librenms/dist/librenms.cron /etc/cron.d/librenms
#### Enable the scheduler
@cp /opt/librenms/dist/librenms-scheduler.service /opt/librenms/dist/librenms-scheduler.timer /etc/systemd/system/
@systemctl enable librenms-scheduler.timer
@systemctl start librenms-scheduler.timer
#### Enable logrotate
###### LibreNMS keeps logs in /opt/librenms/logs. Over time these can become large and be rotated out.
###### Um die alten Protokolle auszulagern, können Sie die bereitgestellte Logrotate-Konfigurationsdatei   verwenden:
@cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms
#### Web installer
#### Fügen Sie das erste Gerät hinzu
#### Wir empfehlen Ihnen nun, localhost als Ihr erstes Gerät innerhalb der WebUI hinzuzufügen.   https://librenms.example.com/addhost
#### Troubleshooting
@sudo su - librenms
@./validate.php