LibreNMS架設
運行環境
安裝nginx mariadb php
apt update
apt install php-mbstring php-cli php-common php-curl php-fpm php-gd php-mbstring php-mysql php-opcache php-readline php-snmp php-xml php-zip acl curl fping git graphviz imagemagick mariadb-client mariadb-server mtr-tiny nginx-full nmap rrdtool snmp snmpd whois unzip python3-pymysql python3-dotenv python3-redis python3-setuptools python3-systemd python3-pip -y
安裝 Composer
cd /usr/local/bin && \
curl -sS https://getcomposer.org/installer | php && \
mv composer.phar composer
新增使用者
useradd librenms -d /opt/librenms -M -r -s "$(which bash)"
下載LibreNMS
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/
安裝 LibreNMS和套件
su librenms
./scripts/composer_wrapper.php install --no-dev
pip3 install --user --break-system-packages -r /opt/librenms/requirements.txt
exit
修改PHP時區
sed -i "s|^;date.timezone =.*$|date.timezone = Asia/Taipei|" /etc/php/8.2/fpm/php.ini
sed -i "s|^;date.timezone =.*$|date.timezone = Asia/Taipei|" /etc/php/8.2/cli/php.ini
系統設定時區
timedatectl set-timezone Asia/Taipei