1、先关闭防火墙和selinux高级权限管理
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service
[root@localhost ~]# setenforce 0
[root@localhost ~]# cat /etc/sysconfig/selinux
[root@localhost ~]# vi /etc/sysconfig/selinux 修改为SELINUX=disabled
2、 先安装repo、server、agent以及frontend:
[root@localhost ~]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
[root@localhost ~]# yum install zabbix-server-mysql zabbix-agent -y
[root@localhost ~]# yum install centos-release-scl -y
[root@localhost ~]# yum install zabbix-server-mysql zabbix-agent -y
[root@localhost ~]# yum install centos-release-scl -y
[root@localhost ~]# sed -i '11s/0/1/' /etc/yum.repos.d/zabbix.repo
[root@localhost ~]# vim /etc/yum.repos.d/zabbix.repo
将zabbix-frontend模块
enabled=0改成enabled=1
继续安装frontend包
[root@localhost ~]# yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y
3、安装并配置mariadb数据库
[root@localhost ~]# yum install mariadb mariadb-server -y
启动数据库:
[root@localhost ~]# service mariadb start
设置开机启动mariadb数据库:
[root@localhost ~]# systemctl enable mariadb
[root@localhost ~]# mysql -u root -p
#进入mysql数据库,没有密码,直接回车;
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
#创建一个数据库,数据库名称为zabbix;
MariaDB [(none)]> create user zabbix@localhost identified by '123456';
#创建一个用户,用户名为zabbix;密码为:123456;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
#授予zabbix用户对zabbix数据库拥有完全权限;
MariaDB [(none)]> quit;
#退出数据库;
导入Mysql数据库初始架构和数据
[root@localhost ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
4、安装与配置Zabbix
[root@localhost ~]# vim /etc/zabbix/zabbix_server.conf
将124行改密码为创建数据库时所设置密码;
更改PHP配置文件,设置时区
[root@localhost ~]# vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
在末行添加:
php_value[date.timezone] = Asia/Shanghai
启动Zabbix server和agent进程;并查看服务状态
[root@localhost ~]# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
[root@localhost ~]# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
[root@localhost ~]# systemctl status zabbix-server zabbix-agent httpd rh-php72-php-fpm
服务状态全部正常,接下来通过过滤IP在浏览器输入访问;
[root@localhost ~]# ifconfig | grep inet | cut -d " " -f 10 | head -1
点击Next Step
用户名为:Admin 密码为:zabbix