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 基本一致


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM