Zabbix安裝(rpm包安裝)
Index of /zabbix/zabbix/5.5/rhel/8/x86_64/ | 清華大學開源軟件鏡像站 | Tsinghua Open Source Mirror
rpm包鏈接:https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.5/rhel/8/x86_64/zabbix-release-5.5-1.el8.noarch.rpm
[root@zabbix ~]# yum install https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.5/rhel/8/x86_64/zabbix-release-5.5-1.el8.noarch.rpm -y
[root@zabbix ~]# cd /etc/yum.repos.d/
[root@zabbix yum.repos.d]# ls
bak Rocky-NFV.repo
Rocky-AppStream.repo Rocky-Plus.repo
Rocky-BaseOS.repo Rocky-PowerTools.repo
Rocky-Debuginfo.repo Rocky-ResilientStorage.repo
Rocky-Devel.repo Rocky-RT.repo
Rocky-Extras.repo Rocky-Sources.repo
Rocky-HighAvailability.repo zabbix.repo
Rocky-Media.repo[root@zabbix yum.repos.d]# vim zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://repo.zabbix.com/zabbix/5.5/rhel/8/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://repo.zabbix.com/non-supported/rhel/8/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1#將baseurl后面的地址進行替換,提高下載速度
[root@zabbix yum.repos.d]# cat zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/5.5/rhel/8/x86_64/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/non-supported/rhel/8/x86_64/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1[root@zabbix yum.repos.d]# yum list | grep ^zabbix
zabbix-release.noarch 5.5-1.el8
zabbix-agent.x86_64 5.4.12-1.el8
zabbix-agent2.x86_64 5.4.12-1.el8
zabbix-apache-conf.noarch 5.4.12-1.el8
zabbix-get.x86_64 5.4.12-1.el8
zabbix-java-gateway.x86_64 5.4.12-1.el8
zabbix-js.x86_64 5.4.12-1.el8
zabbix-nginx-conf.noarch 5.4.12-1.el8
zabbix-proxy-mysql.x86_64 5.4.12-1.el8
zabbix-proxy-pgsql.x86_64 5.4.12-1.el8
zabbix-proxy-sqlite3.x86_64 5.4.12-1.el8
zabbix-sender.x86_64 5.4.12-1.el8
zabbix-server-mysql.x86_64 5.4.12-1.el8
zabbix-server-pgsql.x86_64 5.4.12-1.el8
zabbix-sql-scripts.noarch 5.4.12-1.el8
zabbix-web.noarch 5.4.12-1.el8
zabbix-web-deps.noarch 5.4.12-1.el8
zabbix-web-japanese.noarch 5.4.12-1.el8
zabbix-web-mysql.noarch 5.4.12-1.el8
zabbix-web-pgsql.noarch 5.4.12-1.el8
zabbix-web-service.x86_64 5.4.12-1.el8
[root@zabbix yum.repos.d]# yum install -y zabbix-server-mysql
[root@zabbix yum.repos.d]# yum install -y zabbix-web-mysql zabbix-apache-conf.noarch zabbix-sql-scripts.noarch httpd
[root@zabbix yum.repos.d]# yum install zabbix-agent2.x86_64 -y
[root@zabbix yum.repos.d]# yum install mariadb-server -y
[root@zabbix ~]# systemctl enable --now mariadb
#將selinux配置為disabled模式
[root@zabbix ~]# getenforce
Enforcing
[root@zabbix ~]# sed -i 's/^SELINUX=/SELINUX=Disabled/' /etc/selinux/config
[root@zabbix ~]# systemctl stop firewalld#創建數據庫
[root@zabbix ~]# mysql
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.001 sec)
#創建用戶并授權
MariaDB [(none)]> create user 'zabbix'@'localhost' identified by 'zabbix';
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to 'zabbix'@'localhost';
Query OK, 0 rows affected (0.001 sec)#導入數據
[root@zabbix ~]# zcat /usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz | mysql -uzabbix -pzabbix zabbix
[root@zabbix ~]# mysql -uzabbix -pzabbix zabbix#為zabbix server配置數據庫
[root@zabbix ~]# vim /etc/zabbix/zabbix_server.conf
DBName=zabbix #默認,不需改
DBUser=zabbix #默認,不需改
DBPassword=zabbix #自行添加#配置php時區
[root@zabbix ~]# vim /etc/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Shanghai #添加#啟動服務,web界面安裝
[root@zabbix ~]# systemctl enable --now httpd zabbix-server.service php-fpm.service zabbix-agent2.service
輸入ip/zabbix訪問
點擊下一步
默認用戶名Admin和密碼zabbix
部分中文亂碼
解決方案
#找字體路徑
[root@zabbix ~]# find / -name fonts
/boot/grub2/fonts
/etc/fonts
/usr/share/fonts
/usr/share/zabbix/assets/fonts
[root@zabbix ~]# cd /usr/share/zabbix/assets/fonts
[root@zabbix fonts]# ll
total 0
lrwxrwxrwx. 1 root root 33 Aug 4 07:45 graphfont.ttf -> /etc/alternatives/zabbix-web-font
[root@zabbix fonts]# ll /etc/alternatives/zabbix-web-font
lrwxrwxrwx. 1 root root 38 Aug 4 07:45 /etc/alternatives/zabbix-web-font -> /usr/share/fonts/dejavu/DejaVuSans.ttf
[root@zabbix fonts]# cd /usr/share/fonts/dejavu
[root@zabbix dejavu]# ls
DejaVuSans-BoldOblique.ttf DejaVuSansCondensed-Oblique.ttf DejaVuSans.ttf
DejaVuSans-Bold.ttf DejaVuSansCondensed.ttf DejaVuSans.ttf.bak
DejaVuSansCondensed-BoldOblique.ttf DejaVuSans-ExtraLight.ttf
DejaVuSansCondensed-Bold.ttf DejaVuSans-Oblique.ttf#從Windows系統中選擇中文字體,替代默認字體DejaVuSans.ttf,先進行備份
[root@zabbix ~]# cd /usr/share/fonts/dejavu/
[root@zabbix dejavu]# mv DejaVuSans.ttf DejaVuSans.ttf.bak
#在C:\Windows\Fonts下尋找后綴為ttf的字體,導入到/usr/share/fonts/dejavu/
#將名字改為DejaVuSans.ttf
[root@zabbix dejavu]# mv simkai.ttf DejaVuSans.ttf
刷新