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. 继续安装包
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
#按照提示步骤执行
客户端配置
1. 执行前述服务端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
网友评论