1.系统基础设置
systemctl stop firewalld systemctl disable firewalld
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
reboot
2.加载zabbix的yum源
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
sed 's/enabled=0/enabled=1/g' /etc/yum.repos.d/zabbix.repo -i
3.安装zabbix-server,zabbix-agent,nginx,mariadb-server以及相关依赖
yum install -y centos-release-scl zabbix-server-mysql zabbix-agent #一定要分开安装,下边的安装包依赖cenos-release-scl
yum install -y zabbix-web-mysql-scl zabbix-nginx-conf-scl mariadb-server
4.初始化数据库
systemctl enable mariadb
systemctl start mariadb
mysql_secure_installation #一路y
5.创建zabbix用户与数据库,并授权
mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin; #创建zabbix数据库
create user zabbix@localhost identified by '123'; #创建zabbix用户,密码设置为123
grant all privileges on zabbix.* to zabbix@localhost; #授权zabbix用户有zabbix数据库的所有权限,限制localhost地址登录访问
set global log_bin_trust_function_creators = 1; #设置系统信任生成函数,不开启的话导入数据会报错
quit;
6.导入数据
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p123 zabbix
mysql -uroot -p'123'
set global log_bin_trust_function_creators = 0;
quit;
7.修改zabbix-server配置文件
vi /etc/zabbix/zabbix_server.conf #124行
DBPassword=123
8.修改nginx主配置文件
vi /etc/opt/rh/rh-nginx116/nginx/nginx.conf #注释38-80行(server模块)
9.修改nginx配置文件
vi /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf #取消注释以下两行
listen 80;
server_name example.com;
10.修改该php配置文件
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
listen.acl_users = apache,nginx #添加nginx 第六行
php_value[date.timezone] = Asia/Shanghai #取消注释并改成Asia/Shanghai 第25行
11.重启服务并加入开机自启
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
12.web UI初始化操作
浏览器键入主机IP回调到如图界面
修改语言