前言

操作系统为Centos



[root@ops ~]# uname -a
Linux ops.cluster105.cc 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@ops ~]# cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)


部署zabbix

部署zabbix源



rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all
yum makecheck


zabbix5.X部署_vimzabbix5.X部署_php_02


1 [root@ops ~]# cat /etc/yum.repos.d/zabbix.repo 
2 [zabbix]
3 name=Zabbix Official Repository - $basearch
4 baseurl=https://repo.huaweicloud.com/zabbix/zabbix/5.0/rhel/7/x86_64/
5 enabled=1
6 gpgcheck=1
7 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
8
9 [zabbix-frontend]
10 name=Zabbix Official Repository frontend - $basearch
11 baseurl=https://repo.huaweicloud.com/zabbix/zabbix/5.0/rhel/7/x86_64/frontend
12 enabled=1
13 gpgcheck=1
14 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
15
16 [zabbix-debuginfo]
17 name=Zabbix Official Repository debuginfo - $basearch
18 baseurl=https://repo.huaweicloud.com/zabbix/zabbix/5.0/rhel/7/x86_64/debuginfo/
19 enabled=0
20 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
21 gpgcheck=1
22
23 [zabbix-non-supported]
24 name=Zabbix Official Repository non-supported - $basearch
25 baseurl=https://repo.huaweicloud.com/zabbix/zabbix/5.0/rhel/7/x86_64/
26 enabled=1
27 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
28 gpgcheck=1
29
30
31 [root@ops ~]# cd /etc/pki/rpm-gpg/
32 [root@ops rpm-gpg]# wget https://repo.huaweicloud.com/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591

华为云zabbix源

安装zabbix



yum install zabbix-server-mysql zabbix-agent


前端安装先决条件Zabbix前端需要额外的基本安装包。 您需要在将运行Zabbix前端的系统中启用可选rpms的存储库:



yum-config-manager --enable rhel-server-rhscl-7-rpms

vim /etc/yum.repos.d/zabbix.repo
[zabbix-frontend]
...
enabled=1
...


安装前端组件



yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl


创建初始数据库



# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@"127.0.0.1" identified by '123456';
mysql> grant all privileges on zabbix.* to zabbix@"127.0.0.1";
mysql> quit;


导入数据库



zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix


编辑配置文件



vim /etc/zabbix/zabbix_server.conf
......
DBHost=127.0.0.1
DBName=zabbix
DBUser=zabbix
DBPassword=123456
......


配置前端及时区



vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
......
listen 80;
server_name zabbix.superops.top;
......

vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
listen.acl_users = apache,nginx
php_value[date.timezone] = Asia/Shanghai


启动程序



systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
systemctl status zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm


前端操作

浏览器访问

访问地址: http://server_ip_or_name

zabbix5.X部署_php_03

检查必要条件

 

zabbix5.X部署_php_04

 

连接数据库

 zabbix5.X部署_centos_05

 

配置zabbix server 地址

 zabbix5.X部署_vim_06

 

安装预览

 zabbix5.X部署_php_07

 

安装

 zabbix5.X部署_php_08

 

登录测试

用户名: Admin

密码: zabbix

 zabbix5.X部署_vim_09