cat /etc/redhat-release #查看系统版本
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config #关闭selinux
setenforce 0 #关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm # 进行这一步之后,/etc/yum.repos.d 目录下会生成 zabbix.repo 文件
yum clean all
yum makecache fast
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-get #会从zabbix服务器下载比较慢
yum -y install centos-release-scl
vi /etc/yum.repos.d/zabbix.repo # [zabbix-frontend]内,enable=0,设置为1
yum -y install zabbix-web-mysql-scl zabbix-apache-conf-scl
rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
yum -y install yum-utils
yum-config-manager --disable mysql80-community
yum-config-manager --enable mysql57-community
yum install mysql-community-server -y
systemctl start mysqld
systemctl enable mysqld
grep 'temporary password' /var/log/mysqld.log #root@localhost 后面为临时密码
mysql -uroot -p'Ir5ekTCyG?b:' #这里要将刚才查到的临时密码用英文格式单引号引起来
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Starunion@2020'; #设置的MySQL管理员root密码,
create database zabbix character set utf8 collate utf8_bin; #创建数据库“zabbix”
create user zabbix@localhost identified by 'Zabbix@123'; #创建数据库用户及密码
grant all privileges on zabbix.* to zabbix@localhost; #对用户授权
quit #退出数据库命令行
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p'Zabbix@123' zabbix
vi /etc/zabbix/zabbix_server.conf #找到如下字段取消注释,填入数据库连接信息
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=Zabbix@123
vi /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf #php_value[date.timezone] = Asia/Shanghai
yum -y install wqy-microhei-fonts
mv /usr/share/fonts/dejavu/DejaVuSans.ttf /usr/share/fonts/dejavu/DejaVuSans.ttf.bak
cp -f /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
systemctl restart zabbix-server httpd rh-php72-php-fpm
systemctl enable zabbix-server httpd rh-php72-php-fpm
浏览器访问http://ip/zabbix
默认用户名是Admin,密码是zabbix。