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
# zabbix-server端
yum install zabbix-server-mysql zabbix-agent zabbix-get -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
# zabbix-agent端
yum install zabbix-agent -y
# zabbix-server端
systemctl enable --now mariadb
mysql_secure_installation
# 中间有个设置root密码的,其余全部y回车
mysql -uroot -p
# zabbix-server端
create schema zabbix character set utf8 collate utf8_bin;
# your_password自己设置
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
# 以下操作agent.conf为agent端,server.conf为server端
# 修改成你的数据库密码,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
# 修改当前主机的hostname
hostname zabbix-server
# 修改成当前主机的主机名
sed -i 's/Hostname=Zabbix server/Hostname=zabbix-server/g' /etc/zabbix/zabbix_agentd.conf
# 中文配置(可有可无,自带中文),zabbix-server端
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
# zabbix-server端
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
# zabbix-agent端
systemctl restart zabbix-agent
systemctl enable zabbix-agent