一、关闭防火墙:
systemctl stop firewalld.service #停止firewalld服务
systemctl disable firewalld.service #设置开机默认不启动
生产环境单独在防火墙上开启端口和策略
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --reload
二、关闭selinux
getenforce #查看状态
vi /etc/sysconfig/selinux #开机不启动
SELINUX=disabled
三、安装zabbix5.0源
rpm -Uvh https://repo.zabbix.com/zabbix/5.1/rhel/8/x86_64/zabbix-release-5.1-1.el8.noarch.rpm
官方5.1的源
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
官方5.0的源
dnf clean all *清理yum缓存
四、修改下载源:/etc/yum.repos.d/zabbix.repo**
五、安装zabbix5.0服务端和客户端
dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-agent
六、配置数据库
1.安装MariaDB
dnf install -y mariadb-server # yum安装MariaDB
systemctl start mariadb.service #启动mariadb
systemctl enable mariadb.service #设置开机启动
mysqladmin -uroot password '123456'; #创建管理员密码 自己更改
2.创建数据库
mysql
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix. to zabbix@localhost identified by '123456';
mysql> quit;
3.导入zabbix表结构和初始数据
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p123456 zabbix
检查zabbix库是否导入成功
mysql -uroot zabbix -e 'show tables'
提示输入的密码为:123456
mysql> create user zabbix@localhost identified by 'password';
4.配置启动zabbix-server
vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456
七、安装配置PHP
dnf install -y zabbix-nginx-conf
为Zabbix前端配置PHP,编辑配置文件 /etc/nginx/conf.d/zabbix.conf
listen 80;
server_name example.com; //ip 或 域名
7、编辑配置文件 /etc/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Shanghai
八、启动Zabbix5.0
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm