3)安装zabbix前端
# 1、安装centos-release-scl [root@zabbix-server ~]# yum install centos-release-scl -y # 2、配置/etc/yum.repos.d/zabbix.repo [root@zabbix-server ~]# vim /etc/yum.repos.d/zabbix.repo [zabbix-frontend] name=Zabbix Official Repository frontend - $basearch baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend enabled=1 #配置zabbix-frontend生效 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 # 3、安装zabbix前端包 [root@zabbix-server ~]# yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl -y4)安装mysql并初始化
# 安装mysql5.7 [root@zabbix-server ~]# cd /usr/local/src/ [root@zabbix-server src]# wget [root@zabbix-server src]# rpm -ivh mysql57-community-release-el7-8.noarch.rpm [root@zabbix-server src]# yum -y install mysql-server # 启动mysql并查看初始化密码 [root@zabbix-server src]# systemctl start mysqld [root@zabbix-server src]# systemctl enable mysqld [root@zabbix-server src]# netstat -lntp|grep 3306 tcp6 0 0 :::3306 :::* LISTEN 2045/mysqld [root@zabbix-server src]# grep \'temporary password\' /var/log/mysqld.log 2021-02-13T02:27:31.983845Z 1 [Note] A temporary password is generated for root@localhost: .&Ewqebl*31, # 登录mysql并修改密码 [root@zabbix-server src]# mysql -uroot -p\'.&Ewqebl*31,\' mysql> set password for root@localhost = password(\'Root123@@\'); #密码需要尽可能复杂 # 初始化mysql mysql> create database zabbix character set utf8 collate utf8_bin; mysql> create user zabbix@localhost identified by \'Zabbix123@@\'; mysql> grant all privileges on zabbix.* to zabbix@localhost; mysql> quit # 导入zabbix初始数据(166张表) [root@zabbix-server src]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix5)配置Zabbix server连接数据库
[root@zabbix-server src]# vim /etc/zabbix/zabbix_server.conf DBPassword=Zabbix123@@6)zabbix前端配置
# 打开注释并配置域名 [root@zabbix-server src]# vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf listen 80; server_name dianchou.com; #配置php-fpm [root@zabbix-server src]# vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf listen.acl_users = apache,nginx #添加nginx用户 php_value[date.timezone] = Asia/Shanghai #修改时区 # 配置nginx,注释默认配置 [root@zabbix-server src]# vim /etc/opt/rh/rh-nginx116/nginx/nginx.conf # server { # listen 80 default_server; # listen [::]:80 default_server; # server_name _; # root /opt/rh/rh-nginx116/root/usr/share/nginx/html; ....7)启动zabbix server及agent
[root@zabbix-server src]# systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm [root@zabbix-server src]# systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm8)访问zabbix并配置
浏览器访问:或http