CentOS 8.5安装ZABBIX5.0
0.Xshell远程连接到Centos8.5 连接 centos系统后,首先关闭防火墙和 SELINUX,如不关闭会各种拦截,网页访问等故障
#systemctl stop firewalld.service #关闭防火墙服务
#systemctl disable firewalld.service #开机不启动
#sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config #替换文本参数
#grep SELINUX=disabled /etc/selinux/config #查文本状态
#setenforce 0 #关闭当前SELINUX
1.下载阿里云zabbix源
rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
2.更换yum源的地址为阿里云地址
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo
3.清除缓存
dnf clean all
4.安装zabbix连接mysql的,和zabbix-agent,用于监控服务端
dnf install zabbix-server-mysql -y
dnf install zabbix-web-mysql -y
5.安装zabbix前端环境
dnf install zabbix-apache-conf -y
dnf install zabbix-agent -y
6.创建初始数据库
# dnf install -y mysql-server mysql-devel mysql-libs
# systemctl start mysqld
# mysql_secure_installation
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx
# mysql -uroot -p
输入密码,然后进入到mysql
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'XXXXXXXXXXXXXXXXXXXXXXX';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> flush privileges;
mysql> quit;
7.导入初始架构和数据。
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p'XXXXXXXXXXXXXXXXXXXXXX' zabbix
8.为Zabbix server配置数据库,编辑配置文件vim /etc/zabbix/zabbix_server.conf
DBPassword=XXXXXXXXXXXXXXXXXXXXXXXXXXXX
9.修改zabbix的php配置文件
vim /etc/php-fpm.d/zabbix.conf
; php_value[date.timezone] = Europe/Riga
替换成
php_value[date.timezone] = Asia/Shanghai
10.重启服务
systemctl restart zabbix-server zabbix-agent httpd php-fpm
systemctl enable zabbix-server zabbix-agent httpd php-fpm
11.使用浏览器通过本机IP地址访问
http://*.*.*.*/zabbix/setup.php
zabbix网页安装(浏览器版本太低打开错误,用火狐浏览器或谷歌浏览器打开即可)
记住输数据库密码的时候,是数据库的密码,而不是zabbix用户密码
12.最后成功会显示Configuration file "/etc/zabbix/web/zabbix.conf.php" created.
接下来就可以自己访问http://ip/zabbix了
用户默认Admin
密码zabbix
13.修改tomcat使访问时候直接到zabbix首页面
vim /etc/httpd/conf/httpd.conf
/index.html 快速定位到这行
DirectoryIndex index.html
在index.html 前面添加zabbix即可
DirectoryIndex zabbix index.html