文章目录
一、部署环境说明
操作系统:CentOS 7.X
CentOS 7.X 系统默认不支持Yum方式安装Zabbix 6.0 服务端(CentOS 8.X支持),所以服务端采用编译安装方式!
部署组件:
序号 | 组件 | 版本 | 备注 |
---|---|---|---|
1 | Nginx | 1.20.1 | 基本环境(LNMP) |
2 | PHP | 72w | 基本环境(LNMP) |
3 | MySQL|MariaDB | 8.0.36|10.5.25 | 基本环境(LNMP),二选一 MariaDB版本要求在10.5及以上 |
4 | zabbix-server | 6.0 | 使用编译安装 |
5 | zabbix-agent2 | 6.0 | 使用Yum安装 |
二、基本环境部署步骤
1、环境初始化操作
1、关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
2、定时时间同步
yum -y install ntpdate
ntpdate ntp1.aliyun.com
echo "0 1 * * * ntpdate ntp1.aliyun.com" >> /var/spool/cron/root
crontab -l
2、部署并配置Nginx
1、部署Nginx
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum -y install nginx
nginx -v
2、添加Nginx虚拟主机配置
vim /etc/nginx/conf.d/zabbix.conf
server {
listen 9780;
location / {
root /usr/share/nginx/html/zabbix;
index index.php index.html index.htm;
}
location ~ \.php$ {
root /usr/share/nginx/html/zabbix;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
access_log /var/log/nginx/zabbix_access.log;
error_log /var/log/nginx/zabbix_error.log;
}
}
3、启动Nginx并且加入开机自启动
nginx -t
systemctl start nginx
systemctl enable nginx
3、部署并配置PHP
1、部署PHP
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm