zabbix-server 部署
#下载zabbix仓库 zabbix-release-5.0-1.el7.noarch.rpm
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
#安装zabbix-服务器和代理
yum -y install zabbix-server-mysql zabbix-agent
#安装zabbix前端
yum -y install centos-release-scl
#编辑文件/etc/yum.repos.d/zabbix.repo并启用zabbix-frontend存储库。
vim /etc/yum.repos.d/zabbix.repo
[zabbix-frontend]
...
enabled=1
...
#安装zabbix前端软件包
yum -y install zabbix-web-mysql-scl zabbix-nginx-conf-scl
安装mysql
#下载mysql源仓库
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
#安装源仓库
yum -y install mysql80-community-release-el7-3.noarch.rpm
#设置安装版本
vim /etc/yum.repos.d/mysql-community.repo
关闭8.0版本 enable=0 开启5.7版本 enable=1
#安装mysql
yum -y install mysql-community-server
#启动mysql
systemctl restart mysqld
#查看初始密码
grep password /var/log/mysqld.log
#更改密码
mysqladmin -uroot -p'初始密码' password '1New_password'
#登陆MySQL
mysql -uroot -p'1New_password'
#创建zabbix库
create database zabbix character set utf8 collate utf8_bin;
#创建用户
create user zabbix@localhost identified by '1Password.';
#授权该账户
grant all privileges on zabbix.* to zabbix@localhost;
quit;
导入数据并进行前端设置
#导入初始架构和数据
vim /usr/share/doc/zabbix-server-mysql-5.0.10/create.sql.gz
use zabbix; #在第一行添加
zcat /usr/share/doc/zabbix-server-mysql-5.0.10/create.sql.gz | mysql -uzabbix -p'1Password.'
#配置zabbix服务器数据库
vim /etc/zabbix/zabbix_server.conf
DBPassword=1Password. #password为授权用户密码
#为zabbix前端配置php
vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
listen 80;
server_name 192.168.64.137 #zabbix服务端的IP地址
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
listen.acl_users = apache,nginx #添加nginx
#添加时区
echo php_value[date.timezone] = Asia/Shanghai >> /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf #更改时区
启动服务
systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
使用浏览器访问: 192.168.64.137
zabbix-client 部署
#关闭防火墙及selinux
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
#下载zabbix仓库
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
#安装zabbix-agent程序
yum -y install zabbix-agent
#修改配置问价
vim /etc/zabbix/zabbix_agentd.conf
Hostname=web #主机名
Server=192.168.64.137 #被动模式zabbix-server-ip
ServerActive=192.168.64.137 #主动模式zabbix-server-ip
#启动程序并开机自启
systemctl restart zabbix-agent
systemctl enable zabbix-agent
#查看程序是否启动
netstat -tnlp #看到10051端口即为程序启动