systemctl stop firewalld;systemctl disable firewalld;setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
zabbix源地址,可以自己选版本,安装都大差不差
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
sed -i 's/gpgcheck=1/gpgcheck=0/g' /etc/yum.repos.d/zabbix.repo
同时把[zabbix-frontend]打开
yum clean all;yum makecache
yum install zabbix-server-mysql zabbix-agent -y
yum install centos-release-scl -y
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y
yum install mariadb mariadb-server mariadb-devel -y
systemctl enable --now mariadb
mysql_secure_installation
# 中间有个设置root密码的,其余全部y回车
mysql -uroot -p
create schema zabbix character set utf8 collate utf8_bin;
# 修改成你的数据库密码
grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'your_password';
flush privileges;
exit;
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
# 修改成你的数据库密码,DBPassword=your password ,填密码是不要加引号,不然后面启动也会成功有web,但是没有端口10051,因为连接数据库失败
sed -i 's/# DBPassword=/DBPassword=your password/g' /etc/zabbix/zabbix_server.conf
sed -i 's/; php_value\[date\.timezone\] = Europe\/Riga/php_value\[date\.timezone\] = Asia\/Shanghai/g' /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
# 修改成你的zabbix-server端ip
sed -i 's/Server=127.0.0.1/Server=your Zabbix-Server-IP/g' /etc/zabbix/zabbix_agentd.conf
# 修改成你的zabbix-server端ip
sed -i 's/ServerActive=127.0.0.1/ServerActive=your Zabbix-Server-IP/g' /etc/zabbix/zabbix_agentd.conf
# 修改你的zabbix-agent端的hostname
hostname zabbix-server
# 修改成你的zabbix-agent端的hostname
sed -i 's/Hostname=Zabbix server/Hostname=zabbix-server/g' /etc/zabbix/zabbix_agentd.conf
# 中文配置
yum -y install wqy-microhei-fonts
cp /usr/share/fonts/dejavu/DejaVuSans.ttf{,.bak}
cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm