(一)安装Zabbix服务
(1)首先下载YUM源
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
(2)下载管理端和客户端
yum install zabbix-server-mysql zabbix-agent -y
(3)下载依赖包
yum install centos-release-scl -y
(4)进入YUM源修改配置的前端源,修改完前端源之后情况仓库缓存
vim /etc/yum.repos.d/zabbix.repo
(5)下载前端源,无法下载加上–skip-broken
yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl -y –skip-broken
(6)下载数据库服务
yum install mariadb-server -y
(7)开启数据库服务,并设置开机自启
systemctl start mariadb.service
systemctl enable mariadb.service
(8)创建zabbix业务库并设置语言为utf8
create database zabbix character set utf8 collate utf8_bin;
(9)给Zabbix用户添加授权
grant all on zabbix.* to zabbix@localhost identified by ‘zabbix’;
(10)查看初始化数据库 找到存放文件路径
rpm -ql grep zabbix-server-mysql
(11)将初始化数据库到成为sql文件 (具体版本按照实际情况切换目录)
zcat /usr/share/doc/zabbix-server-mysql-5.0.21/create.sql.gz > zabbix.sql
(12)生成的zabbix.sql无切换到zabbix的Sql,需VIM打开文件在首行插入 use zabbix;
(13)将sql文件导入数据库
mysql -uzabbix -pzabbix < zabbix.sql
(14)进入zabbix库了,查看里面有没有表
use zabbix;
show tables;
(15)配置zabbix_server连接数据库配置账号和密码
vim /etc/zabbix/zabbix_server.conf
(16)修改nginx
vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
(17)修改php
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
(18)注释nginx住配置文件端口
vim /etc/opt/rh/rh-nginx116/nginx/nginx.conf
因为修改nginx的配置文件监听localhost,端口和nginx的住配置文件冲突,注释nginx配置文件的38-80行,批量注释方式,先ctrl+v按下下键选择要注释行,按大写I,在输入#,之后按esc,保存退出
(19)启动Zabbix服务,并设置为开机自启
systemctl start zabbix-server zabbix-agent rh-nginx116-nginx.service rh-php72-php-fpm.service
systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx.service rh-php72-php-fpm.service
(20)网页访问zabbix
默认账号密码
账号:Admin
密码:zabbix
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/270637.html