准备开始
关闭防火墙
sed -ri '/^[^#]*SELINUX=/s#=.+$#=disabled#' /etc/selinux/config
# systemctl stop firewalld
# systemctl disable firewalld
setenforce 0
安装httpd包 yum install -y httpd
##启动开机服务
[root@localhost ~]# systemctl start httpd.service
[root@localhost ~]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
zabbix源地址
[root@localhost yum.repos.d]# cat zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE59
安装zabbix server 、agent 和安装 zabbix 前端源和相关环境
yum install zabbix-server-mysql zabbix-agent -y
yum install centos-release-scl -y
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y
##安装mysql
yum install -y mysql-community-server
启动mysql服务
[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# systemctl restart mysqld
[root@localhost ~]# systemctl enable mysqld
##查找mysql密码
grep "password" /var/log/mysqld.log
[root@localhost ~]# grep "password" /var/log/mysqld.log
2022-06-24T07:08:45.376755Z 1 [Note] A temporary password is generated for root@localhost: kgoMhJ?L=4:U ###为随机密码
##在mysql的配置文件末尾添加以下内容 意为:去掉mysql数据库密码复杂权限
vim /etc/my.cnf
plugin-load=validate_password.so
validate-password=OFF
character-set-server=utf8
innodb_file_per_table=1
保存退出
##重启mysql服务systemctl restart mysqld
##进入mysql更改密码并且给zabbix添加账户
[root@localhost ~]# systemctl restart mysqld
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.37
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> set password for root@localhost = password('admin');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.01 sec)
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
##导入数据至mysql的zabbix账户中,zabbix 数据库用户为 zabbix,密码为zabbix
[root@localhost ~]# zcat /usr/share/doc/zabbix-server-mysql-5.0.20/create.sql.gz | mysql -u zabbix -p zabbix
Enter password: zabbix ##密码
为Zabbix前端配置PHP文件里的时区
[root@localhost ~]#vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Shanghai
为Zabbix server配置数据库
[root@localhost ~]# vim /etc/zabbix/zabbix_server.conf
DBPassword=zabbix
启动zabbix ,http,rh-php72-php-fpm服务,并配置开机自动启动
[root@localhost ~]#systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
[root@localhost ~]#systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-php72-php-fpm.service to /usr/lib/systemd/system/rh-php72-php-fpm.service.
浏览器访问zabbix 的 web 页面,http://ip/zabbix
配置mysql数据库zabbix账号密码
此zabbix前端配置完成,输入账号Admin密码zabbix
将页面修改成中文