系统环境
服务端IP: 10.0.0.61
客户端IP: 10.0.0.7
[root@web01 ~]
CentOS Linux release 7.5.1804 (Core)
[root@web01 ~]
3.10.0-862.el7.x86_64
服务端(10.0.0.61)
1)安装软件
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent mariadb-server
2)启动数据库服务
systemctl start mariadb && systemctl enable mariadb
3)配置zabbix数据库(先登录数据库)
MariaDB [(none)]>create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]>grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
MariaDB [(none)]>flush privileges;
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| zabbix |
+--------------------+
5 rows in set (0.00 sec)
MariaDB [(none)]> select user,host from mysql.user;
+--------+-----------+
| user | host |
+--------+-----------+
| root | 127.0.0.1 |
| root | ::1 |
| | localhost |
| root | localhost |
| zabbix | localhost |
| | m01 |
| root | m01 |
+--------+-----------+
4)导入zabbix数据库文件
zcat /usr/share/doc/zabbix-server-mysql-4.0.43/create.sql.gz |mysql -uzabbix -pzabbix zabbix
5)修改zabbix配置文件
grep "^DB" /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
6)修改时区
vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
7)重启mariadb数据库,开启和开机自启动相关服务
systemctl restart mariadb
systemctl start httpd zabbix-server zabbix-agent
systemctl enable httpd zabbix-server zabbix-agent mariadb
8)登陆zabbix
浏览器输入10.0.0.61/zabbix
登陆zabbix的初始用户名Admin初识密码zabbix
客户端(10.0.0.7)
1)安装软件
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.11-1.el7.x86_64.rpm
yum install -y zabbix-agent
2)修改配置文件
vim /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=10.0.0.61
ServerActive=10.0.0.61
Hostname=web01
Include=/etc/zabbix/zabbix_agentd.d/*.conf
3)重启zabbix
systemctl restart zabbix-agent