今天在CentOS7下使用一键脚本部署Librenms网络监控系统。
本文安装脚本基于官方安装文档在CentOS7下安装Librenms实践的过程整理而成。
一、脚本如下
librenms_install.sh
#!/bin/bash yumlocalinstall-yremi-release-7.rpm yuminstall-yepel-releaseyum-utils yum-config-manager--enableremi-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
二、安装测试
上传remi-release-7.rpm、librenms_configfile.tar.gz和librenms_install.sh到/root/目录下并执行
Tips:说明:
1、需要在服务器连接外网的情况下进行安装
2、SELINUX且关闭的情况
3、每个人的CentOS7系统环境及网络环境不一样,安装时可能出现未知错误,脚本只是基于安装部署的步骤整理而成,难免会有不健壮的情况,若出现请自行排查原因
三、安装完成后初始化Librenms
(图片点击放大查看)
(图片点击放大查看)
(图片点击放大查看)
(图片点击放大查看)
(图片点击放大查看)
(图片点击放大查看)
(图片点击放大查看)
(图片点击放大查看)
(图片点击放大查看)
(图片点击放大查看)
审核编辑:汤梓红
-
监控系统
+关注
关注
21文章
3914浏览量
174662 -
网络
+关注
关注
14文章
7565浏览量
88765 -
脚本
+关注
关注
1文章
389浏览量
14864 -
CentOS
+关注
关注
0文章
77浏览量
13744
原文标题:CentOS7中使用一键脚本部署Librenms网络监控系统
文章出处:【微信号:释然IT杂谈,微信公众号:释然IT杂谈】欢迎添加关注!文章转载请注明出处。
发布评论请先 登录
相关推荐
评论