安装服务
zabbix5.0的安装
#关闭防火墙
systemctl stop firewalld
setenforce 0
#安装zabbix源
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Media.repo epel.repo
CentOS-CR.repo CentOS-Sources.repo zabbix.repo
CentOS-Debuginfo.repo CentOS-Vault.repo
CentOS-fasttrack.repo CentOS-x86_64-kernel.repo
#把zabbix源替换成aliyun源
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo
cat /etc/yum.repos.d/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
#清空缓存
yum clean all
#安装zabbix
yum -y install zabbix-server zabbix-agent
#安装centos-release-scl可以在同一台设备安装多个版本的同程序,不会影响到原系统环境,全部安装/opt/rh目录下
yum -y install centos-release-scl
#修改zabbix前端源
vim /etc/yum.repos.d/zabbix.repo
[zabbix-frontend]
name=Zabbix Official Repository frontend - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/frontend
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
#同步时间
yum -y install ntpdate
ntpdate -u npt.aliyun
#安装zabbix前端环境,scl版本
yum -y install zabbix-web-mysql-scl zabbix-apache-conf-scl
#安装zabbix数据库
yum -y install mariadb-server
#设置数据库开机自启并立即启动
systemctl enable --now mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
#初始化数据库
mysql_secure_installation
Enter current password for root (enter for none): #输入密码,没有密码
Set root password? [Y/n] #是否设置密码
New password: #输入密码
Re-enter new password: #确认密码
Password updated successfully!
Reloading privilege tables..
... Success!
Remove anonymous users? [Y/n] #是否移除匿名用户
Disallow root login remotely? [Y/n] #是否禁止root远程登录,y禁止,n不禁止
Remove test database and access to it? [Y/n] #是否移除测试数据库
Reload privilege tables now? [Y/n] #是否刷新授权表
#添加数据库用户,以及zabbix数据库所需的信息
mysql -uroot -p'Root000.'
MariaDB [(none)]> create user zabbix@localhost identified by 'Root000.';
Query OK, 0 rows affected (0.00 sec)
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';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
#zabbix导入数据库信息
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p'Root000.' zabbix
#查看
MariaDB [zabbix]> use zabbix;
Database changed
MariaDB [zabbix]> show tables;
+----------------------------+
| Tables_in_zabbix |
+----------------------------+
| acknowledges |
| actions |
| alerts |
| application_discovery |
..............................
#修改zabbix-server配置文件,添加数据库密码
vim /etc/zabbix/zabbix_server.conf
DBUser=zabbix
### Option: DBPassword
# Database password.
# Comment this line if no password is used.
#
# Mandatory: no
# Default:
DBPassword=Root000.
#修改zabbix的php配置文件,如果没有安装scl,路径可能不一样
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Shanghai #时区修改
#启动zabbix相关服务
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd 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/httpd.service to /usr/lib/systemd/system/httpd.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.
#访问页面
Windows:http://192.168.5.4/zabbix/
linux:firefox 192.168.5.4
安装前端
欢迎页面
检查环境
输入密码
输入zabbix细节,直接下一步
显示安装信息
安装完成
登录:默认用户名Admin,密码zabbix
修改中文
图形乱码解决
安装此字体
yum -y install wqy-microhei-fonts
#复制字体文件,\不使用别命名
\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
码解决
安装此字体
yum -y install wqy-microhei-fonts
#复制字体文件,\不使用别命名
\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf