環境
- centos 7
- mariadb 5.5
- zabbix 5.0
安裝步驟
- 環境
# 配置yum
[root@localhost home]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost home]# yum clean all
[root@localhost home]# yum update
[root@localhost home]# yum makecache
# 關閉SELINUX和firewalld
[root@localhost home]# setenforce 0
[root@localhost home]# systemctl stop firewalld
[root@localhost home]# systemctl disable firewalld
- 安裝zabbix庫
[root@localhost home]# rpm -Uvh https://repo.zabbix.com/zabbix/4.5/rhel/7/x86_64/zabbix-release-4.5-2.el7.noarch.rpm
- 安裝zabbinx web前端、server和agent
# 啓用scl軟件集
[root@localhost home]# yum install centos-release-scl
# 啓用zabbix倉庫
[root@localhost home]# vi /etc/yum.repos.d/zabbix.repo
[zabbix-deprecated]
...
enabled=1
...
# 安裝zabbix前端、server和agent
[root@localhost home]# yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl
[root@localhost home]# yum install zabbix-server-mysql zabbix-agent
- 初始化mariadb
[root@localhost home]# yum install -y mariadb mariadb-server
[root@localhost home]# mysql_secure_installation
[root@localhost home]# systemctl start mariadb
[root@localhost home]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 5.5.64-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
- 初始化zabbix庫
# sql位置:/usr/share/doc/zabbix-server-mysql*/create.sql.gz
[root@localhost home]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password:
[root@localhost home]# mysql -u zabbix -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 5.5.64-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| zabbix |
+--------------------+
2 rows in set (0.07 sec)
MariaDB [(none)]> use zabbix
Database changed
MariaDB [zabbix]> show tables;
+----------------------------+
| Tables_in_zabbix |
+----------------------------+
| acknowledges |
| actions |
| alerts |
... ... ... ...
| users |
| users_groups |
| usrgrp |
| valuemaps |
| widget |
| widget_field |
+----------------------------+
154 rows in set (0.00 sec)
MariaDB [zabbix]>
- 配置zabbix-server數據庫、用戶、密碼
[root@localhost home]# vi /etc/zabbix/zabbix_server.conf
- 配置nginx、PHP相關文件
# 配置nignx監聽端口及服務名
[root@localhost home]# vi /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
(如果你不從這臺服務器訪問的話,server_name要配置服務器IP地址)
# 配置php用戶及時區
[root@localhost home]# vi /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
- 啓動zabbix
[root@localhost home]# systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-nginx116-nginx.service to /usr/lib/systemd/system/rh-nginx116-nginx.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-php72-php-fpm.service to /usr/lib/systemd/system/rh-php72-php-fpm.service.
[root@localhost home]# systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
- web頁面初始化
http://192.168.0.104/
默認用戶名密碼:Admin/zabbix