shell 一键安装部署 zabbix6.0

部署环境:

[zabbix6 root ~] #cat deploy_zabbix6.sh
#!/bin/bash
# Author: demoduan
# Blog: https://www.cnblogs.com/demoduan
IP=$(ip -4 a show ens160 |grep inet |awk '{print $2}' |cut -d/ -f1)
systemctl disable firewalld --now
setenforce 0
rpm -Uvh http://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-1.el8.noarch.rpm
yum -y install zabbix-server-mysql.x86_64 zabbix-web-mysql.noarch zabbix-nginx-conf.noarch
yum -y install mariadb-server
systemctl enable mariadb.service --now
cat >zabbix.txt <<EOF
create database zabbix character set utf8 collate utf8_bin;
grant all on zabbix.* to zabbix@localhost identified by 'zabbix';
flush privileges;
exit
EOF
mysql <zabbix.txt
rm -f zabbix.txt
rpm -Uvh http://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-sql-scripts-6.0.0-1.el8.noarch.rpm
path1=`rpm -ql zabbix-sql-scripts |grep 'server.sql.gz' |grep mysql`
zcat $path1 |mysql -uzabbix -pzabbix zabbix
target1=`egrep -v "^#|^$" /etc/zabbix/zabbix_server.conf -n |grep DBUser |cut -d: -f1`
sed -i "${target1}a DBPassword=zabbix" /etc/zabbix/zabbix_server.conf
path2=`find /etc/ -name zabbix.conf |grep nginx`
sed -i "2,3s/#//; s/example.com/$IP/" $path2
systemctl restart zabbix-server.service php-fpm.service nginx.service
systemctl enable zabbix-server.service php-fpm.service nginx.service

上面脚本执行成功后,在 web 界面访问

点开语言后发现只有英文(原因是没有安装中文包)

 接下来安装中文包,然后重启 zabbix server,并刷新 web 界面

[zabbix6 root ~]# yum -y install langpacks-zh_CN glibc-common

[zabbix6 root ~]# systemctl restart zabbix-server.service 

刷新后就可以选择中文

 这里可以选择时区,相比 zabbix5 来说,少了修改时区的配置文件步骤,还可以选择主题颜色

 登录后,界面和 zabbix5 基本一致

posted @ 2022-02-16 17:47  demoduan  阅读(3894)  评论(0编辑  收藏  举报