资源描述
1台rockey8.8的云主机
资源配置:2C,4G,40G
防火墙配置
云主机请打开安全组的80端口(web用什么端口就放开什么端口)
#检查firewalld和selinux
[root@m2 ~]#systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
[root@m2 ~]# ufw status
-bash: ufw: command not found
[root@iZf8zibmzf4vsa5aze8uymZ ~]# ps -ef| grep selinux
root 99924 1618 0 10:47 pts/0 00:00:00 grep --color=auto selinux
[root@m2 ~]# getenforce
Disabled
#如果状态为启动,请执行以下步骤,否则请忽略
systemctl stop firewalld.service
systemctl diable firewalld
systemctl stop ufw
systemctl diable ufw
setenforce 0
sed -i 's/=enforcing/=disabled/' /etc/selinux/config
安装zabbix6.4
(直接是zabbix官网的步骤)
#a. Install Zabbix repository
rpm -Uvh https://repo.zabbix.com/zabbix/6.4/rhel/8/x86_64/zabbix-release-6.4-1.el8.noarch.rpm
dnf clean all
#b. Switch DNF module version for PHP
dnf -y module switch-to php:7.4
#c. 安装Zabbix server,Web前端,agent
dnf -y install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
安装mysql8.0
#d. 创建初始数据库
#安装MySQL源
rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm
dnf clean all
#安装MySQL相关依赖
dnf -y install gcc-c++ mysql-devel net-snmp-devel libevent-devel libcurl-devel mysql-server mysql-common
#启动MySQL以及设置开机自启
systemctl start mysqld
systemctl enable mysqld
zabbix库配置
#进去数据库配置用户,此种安装mysql可以本地免密登录
mysql -uroot -p
mysql> create database zabbix character set utf8mb4 collate utf8mb4_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> flush privileges;
mysql> quit;
#导入初始架构和数据,系统将提示您输入新创建的密码。
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
#passWord
#Disable log_bin_trust_function_creators option after importing database schema.
mysql -uroot -p
mysql> set global log_bin_trust_function_creators = 0;
mysql> flush privileges;
mysql> quit;
修改zabbix配置以及设置相关服务开机自启
#e. 为Zabbix server配置数据库
vim /etc/zabbix/zabbix_server.conf
...
DBPassword=password
#systemctl status httpd查看如果有下面问题,可以忽略也可执行以下步骤解决
#解决httpd[10695]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name,
vim /etc/httpd/conf/httpd.conf
...
ServerName localhost:80
#f. 启动Zabbix server和agent进程
#启动Zabbix server和agent进程,并为它们设置开机自启:
systemctl restart zabbix-server zabbix-agent httpd php-fpm
systemctl enable zabbix-server zabbix-agent httpd php-fpm
浏览器访问以及初始化
#g. Open Zabbix UI web page
The default URL for Zabbix UI when using Apache web server is http://host/zabbix
访问以下地址
http://ip/zabbix
登录密码
Admin
zabbix