--- type: "topic" created: "2024-01-28T01:06:26.133Z" updated: "2024-01-28T01:06:26.133Z" --- # LibreNMS ```bash # https://learn.microsoft.com/en-us/windows/wsl/wsl-config code-insiders .wslconfig ``` ```conf [wsl2] networkingMode=mirrored ``` ```bash sudo -i apt-get update apt upgrade -y ip a lsb_release -a apt-get install links unzip git nano ncdu -y ncdu timedatectl set-timezone America/Phoenix timedatectl nano /etc/hosts exit exit ``` ```bash wsl --export Ubuntu "L:\Ubuntu\Ubuntu-LibreNMS-001.tar" wsl --unregister Ubuntu wsl --import Ubuntu-LibreNMS Ubuntu-LibreNMS "L:\Ubuntu\Ubuntu-LibreNMS-001.tar" # wsl --export Ubuntu-LibreNMS "L:\Ubuntu\Ubuntu-LibreNMS-002.tar" # del "L:\Ubuntu\Ubuntu-LibreNMS-002.tar" ``` ```yaml Name: Ubuntu-LibreNMS Command Line: wsl.exe -d Ubuntu-LibreNMS Tab Title: Ubuntu-LibreNMS ``` ```bash sudo -i apt install 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-json php-mbstring php-mysql php-snmp php-xml php-zip rrdtool snmp snmpd unzip python3-pymysql python3-dotenv python3-redis python3-setuptools python3-systemd python3-pip whois traceroute -y exit exit ``` ```bash wsl --export Ubuntu-LibreNMS "L:\Ubuntu\Ubuntu-LibreNMS-002.tar" wsl --unregister Ubuntu-LibreNMS wsl --import Ubuntu-LibreNMS Ubuntu-LibreNMS "L:\Ubuntu\Ubuntu-LibreNMS-002.tar" ``` ```bash # https://docs.librenms.org/Installation/Install-LibreNMS/#endpoints useradd librenms -d /opt/librenms -M -r -s "$(which bash)" # cd /opt git clone https://github.com/librenms/librenms.git # 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/ # su - librenms ./scripts/composer_wrapper.php install --no-dev exit ``` ```bash wget https://getcomposer.org/composer-stable.phar mv composer-stable.phar /usr/bin/composer chmod +x /usr/bin/composer code-insiders "\\wsl.localhost\Ubuntu-LibreNMS" # # America/Phoenix # nano /etc/php/8.1/fpm/php.ini # nano /etc/php/8.1/cli/php.ini nano /etc/mysql/mariadb.conf.d/50-server.cnf ``` ```conf innodb_file_per_table=1 lower_case_table_names=0 ``` ```bash systemctl enable mariadb systemctl restart mariadb mysql -u root ``` ```sql 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 ``` ```bash cp /etc/php/8.1/fpm/pool.d/www.conf /etc/php/8.1/fpm/pool.d/librenms.conf nano /etc/php/8.1/fpm/pool.d/librenms.conf nano /etc/nginx/conf.d/librenms.conf rm /etc/nginx/sites-enabled/default systemctl restart nginx systemctl restart php8.1-fpm # http://localhost/install/checks ``` ```bash wsl --export Ubuntu-LibreNMS "L:\Ubuntu\Ubuntu-LibreNMS-003.tar" wsl --unregister Ubuntu-LibreNMS wsl --import Ubuntu-LibreNMS Ubuntu-LibreNMS "L:\Ubuntu\Ubuntu-LibreNMS-003.tar" ``` ```bash # http://localhost ln -s /opt/librenms/lnms /usr/bin/lnms cp /opt/librenms/misc/lnms-completion.bash /etc/bash_completion.d/ cp /opt/librenms/snmpd.conf.example /etc/snmp/snmpd.conf nano /etc/snmp/snmpd.conf 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 cp /opt/librenms/dist/librenms.cron /etc/cron.d/librenms 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 cp /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms chown librenms:librenms /opt/librenms/config.php exit exit ```