1.1 部署zabbix
1.1.1 关闭防火墙和selinux
#关闭firewalld centos7
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
#关闭selinux
sed -i.bak 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config
setenforce 0
getenforce
1.1.2 安装 zabbix 服务端
##step 1 下载安装zabbix yum源文件
#官方yum源
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all
##step 2 下载安装zabbix服务端相关软件
#zabbix服务程序软件: zabbix-server-mysql
#zabbix客户端软件 zabbix-agent
yum install zabbix-server-mysql zabbix-agent
##step3 安装Zabbix frontend
yum install centos-release-scl
##step4 编辑配置文件 /etc/yum.repos.d/zabbix.repo and enable zabbix-frontend repository.
[zabbix-frontend]
...
enabled=1
...
##step5 安装Zabbix frontend packages.
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl
##step6 安装Mysql数据库
cd /usr/local/src/
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
yum -y install mysql-server
##step7 配置数据库
#启动数据库
systemctl start mysql
#修改数据库默认密码
[root@localhost ~]# grep 'temporary password' /var/log/mysqld.log
2021-02-10T05:25:40.016192Z 1 [Note] A temporary password is generated for root@localhost: :QtQ+Vpdh1>Q
mysql -uroot -p: :QtQ+Vpdh1>Q
mysql>ALTER USER 'root'@'localhost' IDENTIFIED BY nWoo>o0rXtr4';
#创建zabbix数据库
mysql> create database zabbix character set utf8 collate utf8_bin;
#创建zabbix mysql账户
mysql> create user zabbix@localhost identified by 'nWoo>o0rXtr4';
#将在zabbix数据库授权给zabbix账户
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;
#在zabbix数据库中导入相应的表信息
zcat /usr/share/doc/zabbix-server-mysql-4.0.28/create.sql.gz |mysql -uzabbix -pnWoo>o0rXtr4 zabbix
##step 8 软件配置
#修改126行
vim /etc/zabbix/zabbix_server.conf
126 DBPassword=password
#修改21行
vim /etc/httpd/conf.d/zabbix.conf
21 php_value date.timezone Asia/Shanghai
##step 9 启动zabbix相关服务
systemctl start zabbix-server.service httpd zabbix-agent
systemctl enable zabbix-server.service httpd mysql zabbix-agent
##登录zabbix服务web页面
http://172.17.0.101/zabbix/setup.php
用户名Admin 密码zabbix
# 记录web页面初始化信息的文件
/etc/zabbix/web/zabbix.conf.php
10051 zabbix-server 服务端端口号
10050 zabbix-agent 客户端端口号
1.1.3 安装zabbix客户端
##step 1 下载安装zabbix yum源文件
#官方yum源
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all
#step 2 下载安装zabbix客户端软件
yum install -y zabbix-agent
#step 3 编写zabbix客户端配置文件
#编写98行 服务端地址
vim /etc/zabbix/zabbix_agentd.conf
98 Server=172.16.1.71
网友评论