1. 安装前配置
//关闭防火墙
$ systemctl stop firewalld
$ systemctl disable firewalld
//关闭selinux
$ setenforce 0
$ sed -i "/^SELINUX/s/enforcing/disabled/" /etc/selinux/config
//安装 epel
$ yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
//mysql 安装
$ dnf -y install wget
$ yum -y install https://repo.mysql.com/mysql80-community-release-el8-1.noarch.rpm
$ yum install mysql-server -y
$ systemctl start mysqld && systemctl status mysqld
$ systemctl enable mysqld
$ mysql -uroot -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
2. Zabbix 安装
参考:https://www.zabbix.com/download?zabbix=5.0&os_distribution=red_hat_enterprise_linux&os_version=8&db=mysql&ws=nginx
//安装 zabbix 源
$ rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
//安装 Zabbix server,frontend,agent
$ dnf install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-agent
//创建数据库
$ mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'Xiodi.cn123';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;
//在Zabbix服务器主机上导入初始模式和数据。
$ zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
//配置 zabbix_server.conf
$ vi /etc/zabbix/zabbix_server.conf
...
DBPassword=Xiodi.cn123
...
//为Zabbix前端配置PHP
$ vi /etc/nginx/conf.d/zabbix.conf //取消这两行注释
...
listen 80;
server_name zabbixtest.xiodi.cn;
...
$ vi /etc/php-fpm.d/zabbix.conf //取消注释,并修改时区
...
php_value[date.timezone] = Asia/Shanghai
...
//启动服务
$ systemctl restart zabbix-server zabbix-agent nginx php-fpm
$ systemctl enable zabbix-server zabbix-agent nginx php-fpm
3. zabbix 配置
浏览器打开:http://zabbixtest.xiodi.cn
//确保所有的要求都 ok
//配置数据库
//配置当前 Zabbix Server 的信息
//登录
默认用户名密码:Admin/zabbix
//修改为中文语言