Centos7.9 一键脚本部署 LibreNMS 网络监控系统

前言:

LibreNMS 是个以 PHP/MySQL 为基底的自动探索网络监控系统

LibreNMS 官网

|------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 版本 | 23.8.2-52-g7bbe0a2 - Thu Sep 14 2023 22:33:23 GMT+0700 |
| 数据库纲要 | 2023_09_01_084057_application_new_defaults (259) |
| Web 服务器 | nginx/1.20.1 |
| PHP | 8.1.23 |
| Python | 3.6.8 |
| Database | MariaDB 10.5.22-MariaDB |
| Laravel | 10.16.1 |
| RRDtool | 1.4.8 |

LibreNMS 是建基于社群开发的项目

您随时都可以加入社群贡献您的程序代码、文件以及问题回报:
官方网站 | 文件 | GitHub | 问题追踪 | Merch Shop | 社群论坛 | Twitter | LinkedIn | 变更记录 | 本机 Git 记录

贡献者

See the list of contributors on GitHub.

特别感谢

Bruno Pramont Collectd code.
Dennis de Houx Application monitors for PowerDNS, Shoutcast, NTPD (Client, Server).
Erik Bosrup Overlib Library.
Jonathan De Graeve SNMP code improvements.
Observium Codebase for fork.

第一步、安装准备

1.1.1 准备 一键安装脚本 librenms_install.sh librenms_configfile.tar remi-release-7

bash 复制代码
#!/bin/bash
yum localinstall -y remi-release-7.rpm
yum install -y epel-release yum-utils
yum-config-manager --enable remi-php81
cat > /etc/yum.repos.d/MariaDB.repo << \EOF
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=0 
EOF
yum -y install gcc composer cronie fping git ImageMagick jwhois mariadb mariadb-server mtr MySQL-python net-snmp net-snmp-utils nginx nmap php-fpm php-cli php-common php-curl php-gd php-mbstring php-process php-snmp php-xml php-zip php-memcached php-mysqlnd python-memcached rrdtool python3 python3-pip python3-devel
cd /opt 
git clone https://github.com/librenms/librenms.git
useradd librenms -d /opt/librenms -M -r
usermod -a -G librenms nginx
chown -R librenms:librenms /opt/librenms
chmod 775 /opt/librenms
chgrp apache /var/lib/php/session/
su - librenms -c "/opt/librenms/scripts/composer_wrapper.php install --no-dev"
systemctl start mariadb
mysqladmin -u root password "Root@2023"
mysql -u root -pRoot@2023  << EOF
CREATE DATABASE librenms CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'librenms'@'localhost' IDENTIFIED BY 'librenms@2023';
GRANT ALL PRIVILEGES ON librenms.* TO 'librenms'@'localhost';
FLUSH PRIVILEGES;
exit
EOF
mkdir /opt/configfile_backup
mkdir /opt/librenms_temp
cd /root/
tar -zxvf librenms_configfile.tar.gz -C /opt/librenms_temp
mv /etc/my.cnf.d/server.cnf  /opt/configfile_backup
mv /opt/librenms_temp/server.cnf /etc/my.cnf.d/
systemctl enable mariadb
systemctl restart mariadb
mv /etc/php.ini /opt/configfile_backup
cp -rf /opt/librenms_temp/php.ini /etc/php.ini
mv /etc/php-fpm.d/www.conf /opt/configfile_backup
cp -rf /opt/librenms_temp/www.conf  /etc/php-fpm.d/www.conf
systemctl enable php-fpm
systemctl restart php-fpm
cp -rf /opt/librenms_temp/librenms.conf  /etc/nginx/conf.d/librenms.conf
systemctl enable nginx
systemctl restart nginx
firewall-cmd --permanent --zone public --add-service http
firewall-cmd --reload
cp -rf /opt/librenms_temp/snmpd.conf /etc/snmp/snmpd.conf
cp -rf /opt/librenms_temp/distro /usr/bin/distro
chmod +x /usr/bin/distro
systemctl enable snmpd
systemctl restart snmpd
cp -rf /opt/librenms/dist/librenms.cron /etc/cron.d/librenms
cp -rf /opt/librenms/misc/librenms.logrotate /etc/logrotate.d/librenms

1.1.2 将 remi-release-7.rpm、librenms_configfile.tar.gz和librenms_install.sh 到 /root/ 根目录下:

1.1.3 先别着急执行安装,先关闭 selinux 注意---需要重启机器才能生效

bash 复制代码
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config  #永久关闭 selinux(需要重启机器才能生效):
getenforce               #查看是否成功关闭:
cat /etc/selinux/config  #查看是否成功关闭:

第二步、安装阶段

2.2.1 需要在服务器连接外网的情况下进行安装 :

2.2.2 执行 sh librenms_install.sh 执行过程不用管理,可以去喝杯茶:

第三步、初始化 LibreNMS

3.3.1 安装完成之后不要着急、肯能需要等几到十几分钟左右后台跑完就可以 web 访问了:

3.3.2 访问直接输入主机 IP http://192.168.108.128/install/checks

3.3.3 密码为 librenms@2023 ""一键安装脚本一键设置好了""

bash 复制代码
mysql     root      Root@2023"
librenms  librenms  librenms@2023';

3.3.4 新建一个管理员账号 admin

3.3.5 登录系统

第四步、 LibreNMS 设置

4.4.1 设置语言

4.4.2 添加主机 linux win huaw cisco 添加过程略 需要 IP 团体名称和 端口号 对了就可以:


第五步、 LibreNMS 查看状态:

相关推荐
Gaoithe2 小时前
ubuntu 端口复用
linux·运维·ubuntu
德先生&赛先生3 小时前
Linux编程:1、文件编程
linux
程序猿小D3 小时前
第16节 Node.js 文件系统
linux·服务器·前端·node.js·编辑器·vim
多多*4 小时前
微服务网关SpringCloudGateway+SaToken鉴权
linux·开发语言·redis·python·sql·log4j·bootstrap
IT界小黑的对象6 小时前
virtualBox部署ubuntu22.04虚拟机 NAT+host only 宿主机ping不通虚拟机
linux·运维·服务器
SilentCodeY6 小时前
Ubuntu 系统通过防火墙管控 Docker 容器
linux·安全·ubuntu·系统防火墙
weixin_527550406 小时前
Linux 环境下高效视频切帧的实用指南
linux·运维·音视频
keson要进步6 小时前
CICD实战(二)-----gitlab的安装与配置
linux·运维·gitlab
藥瓿亭6 小时前
K8S认证|CKS题库+答案| 4. RBAC - RoleBinding
linux·运维·服务器·云原生·容器·kubernetes·cks
吐泡泡_7 小时前
Linux(线程控制)
linux