一、环境部署
1.关闭防火墙和selinux
```
# systemctl stop firewalld
# systemctl disable firewalld
# sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
# setenforce 0
```
2.配置Yum源
# mv /etc/yum.repos.d/* /tmp/
# curl -o /etc/yum.repos.d/CentOS-7.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
# rpm -ivh?https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
3.部署LANP环境
# yum install httpd php php-mysql mariadb mariadb-server mariadb-devel -y
# systemctl start httpd mariadb
二、安装zabbxi
1.yum直接安装
# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent -y
三、数据库初始化
1.创建数据库,授权用户和密码
# mysql
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');
> create database zabbix character set utf8 collate utf8_bin;
> grant all privileges on zabbix.* to zabbix@% identified by "123456789";
flush privileges
> exit;
2.导入数据,系统将提示输入zabbix数据库用户的密码
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password:
四、修改配置文件
1.修改zabbix配置文件,指定数据库用户的密码
# vi /etc/zabbix/zabbix_server.conf
DBPassword=123456
2.修改zabbix网页配置文件,取消注释并设置时区
# vi /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
五、启动服务、网页初始化配置
1.启动zabbix和httpd服务
# systemctl restart zabbix-server zabbix-agent httpd
# systemctl enable zabbix-server zabbix-agent httpd
六.浏览器访问http://IP/zabbix做页面初始化配置