Server ?端
1. 下載源zabbix
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
2. 更換成aliyun源(速度快)
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo
3. 清理源
yum clean all
?yum makecache
4. 安裝包
yum install zabbix-server-mysql zabbix-server-agentzabbix-agent -y
?yum install centos-release-scl
?yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y
?5. vim zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/frontend
enabled=1?? #此處改成1,才能進行下面安裝
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/debuginfo/
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck=1
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
6. 繼續(xù)安裝包
?yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y
?yum install mariadb-server
7.啟動并設置mariadb
?systemctl enable --now mariadb
? netstat? -tnulp | grep mariab
? mysql_secure_installation
8. 設置zabbix用戶
MariaDB [(none)]> show databases;
+--------------------+
| Database ??????????|
+--------------------+
| information_schema |
| mysql ?????????????|
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create user zabbix@localhost identified by 'redhat';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]>
9. 導入zabbix文件
?cd /usr/share/doc/zabbix-server-mysql-5.0.21/
?zcat ?/usr/share/doc/zabbix-server-mysql-5.0.21/create.sql.gz | mysql -uzabbix -p zabbix #-p數據庫名
10. 登錄mariadb 檢查文件
?mysql -uzabbix -predhat
11.修改zabbix配置文件
?vim /etc/zabbix/zabbix_server.conf
DBPassword=redhat
12. 檢驗配置文件
grep DBP ?/etc/zabbix/zabbix_server.conf
13. 修改php配置文件
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/shanghai
14. 檢驗配置文件
?grep time ?/etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
15.啟動服務
systemctl enable zabbix-server ?zabbix-agent httpd rh-php72-php-fpm.service
16. 登錄測試
訪問入口:192.168.2.100/zabbix
用戶名:Admin
密碼:zabbix
#按照提示步驟執(zhí)行
客戶端配置
1. 執(zhí)行前述服務端1,2,3,5的命令
2.安裝包
?yum install zabbix-agent2
3.修改配置文件
[root@node1 ~]# grep -Ev '^#|^$' /etc/zabbix/zabbix_agent2.conf
PidFile=/var/run/zabbix/zabbix_agent2.pid
LogFile=/var/log/zabbix/zabbix_agent2.log
LogFileSize=0
Server=192.168.2.100
ServerActive=192.168.2.100
Hostname=node1
Include=/etc/zabbix/zabbix_agent2.d/*.conf
ControlSocket=/tmp/agent.sock
啟動服務
systemctl enable --now zabbix-agent2
命令測試連通性
yum install zabbix-get
zabbix_get -s '192.168.2.110' -p 10050 -k 'agent.ping'
zabbix_get -s '192.168.2.110' -p 10050 -k 'agent.hostname'
啟動服務并開機啟動
systemctl enable --now zabbix-agent2
默認圖形亂碼問題解決
?yum install wqy-microhei-fonts
?\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf