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
刷新