apache下安装zabbix
#进入zabbix官网
https://www.zabbix.com/
#选择好要配置的服务
#安装zabbix存储库
[root@zabbix-server ~]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
[root@zabbix-server ~]# yum clean all #清理缓存
[root@zabbix-server ~]# yum install zabbix-server-mysql zabbix-agent #安装zabbix server,web前端,agent
[root@zabbix-server ~]# yum install centos-release-scl #安装zxbbix前端
[root@zabbix-server ~]# vim /etc/yum.repos.d/zabbix.repo #编辑配置文件
[root@zabbix-server ~]# yum install zabbix-web-mysql-scl zabbix-apache-conf-scl #安装zabbix前端软件包
#创建初始化数据库
[root@zabbix-server ~]# mysql -uroot -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;
[root@zabbix-server ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix #导入初始架构和数据,系统将提示您输入新创建的密码
[root@zabbix-server ~]# mysql -uroot -p
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
[root@zabbix-server ~]# vim /etc/zabbix/zabbix_server.conf #为Zabbix server配置数据库
DBPassword=password #这里写数据库的密码
root@zabbix-server ~]# vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf #为Zabbix前端配置PHP
; php_value[date.timezone] = Asia/shanghai #将前面的;删掉,时区改成上海
root@zabbix-server ~]# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm #启动Zabbix server和agent进程
root@zabbix-server ~]# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm #设置开机自启
#浏览器输入ip/zabbix访问
nginx安装zabbix
#进入zabbix官网
https://www.zabbix.com/
#选择好要配置的服务
[root@zabbix-server ~]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
[root@zabbix-server ~]# yum clean all
[root@zabbix-server ~]# yum install zabbix-server-mysql zabbix-agent
[root@zabbix-server ~]# yum install centos-release-scl #安装zabbix前端
[root@zabbix-server ~]# vim /etc/yum.repos.d/zabbix.repo
[root@zabbix-server ~]# yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl
#创建初始化数据库
[root@zabbix-server ~]# mysql -uroot -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@'%' identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@'%';
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;
[root@zabbix-server ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix #导入初始架构和数据,系统将提示您输入新创建的密码。
[root@zabbix-server ~]# mysql -uroot -p
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
[root@zabbix-server ~]# vim /etc/zabbix/zabbix_server.conf #为Zabbix server配置数据库
DBPassword=password #这里写数据库的密码
[root@zabbix-server ~]# vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf #为Zabbix前端配置PHP
# listen 80;
# server_name example.com;
#取消前面的注释
[root@zabbix-server ~]# vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
[zabbix]
user = nginx
group = nginx
listen.acl_users = apache,nginx
....
; php_value[date.timezone] = Asia/shanghai #将前面的;删掉,时区改成上海
[root@zabbix-server ~]# vim /etc/opt/rh/rh-php72/php-fpm.d/www.conf
user = nginx
group = nginx #将其中的这两个参数改为nginx
[root@zabbix-server ~]# vim /etc/opt/rh/rh-nginx116/nginx/nginx.conf
server {
# listen 80 default_server;
# listen [::]:80 default_server;
server_name _;
root /opt/rh/rh-nginx116/root/usr/share/nginx/html;
}#将server模块中的两个监听80端口参数注释
[root@zabbix-server ~]# chown .nginx /var/opt/rh/rh-php72/lib/php/session/ #修改文件的属组
[root@zabbix-server ~]# chown nginx.nginx /usr/share/zabbix/include/classes/core/CSession.php
[root@zabbix-server ~]# chown nginx.nginx -R /etc/zabbix/web/
[root@zabbix-server ~]# systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm #启动
[root@zabbix-server ~]# systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm #设置开机自启
#在浏览器访问
#可以看到zabbix已经安装成功
#现在点击next step
#用户名是Admin
#密码是zabbix
[外链图片转存中…(img-8HTPcO4j-1715391874469)]
#用户名是Admin
#密码是zabbix
[外链图片转存中…(img-LaxcPdFz-1715391874470)]