Zabbix 5.0安装

OS: CentOS 8.1.1911
DB: MariaDB 10
Web: Nginx

关闭防火墙及SELinux

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
systemctl disable --now firewalld
reboot

列出可用的MariaDB模块流

dnf module list mariadb

输出显示可用的mariadb版本,目前为10.3版本

CentOS-8 - AppStream
Name                Stream               Profiles                               Summary                  
mariadb             10.3 [d]             client, server [d], galera             MariaDB Module           

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

安装MariaDB

sudo dnf install -y mariadb-server

启动MariaDB

sudo systemctl enable --now mariadb

初始化MariaDB数据库

mysql_secure_installation

配置Zabbix安装源

sudo rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo
sudo dnf clean all

安装Zabbix相应组件

sudo dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-agent

初始化Zabbix数据库(会提示输入密码)

mysql -uroot -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'zabbix';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;

初始化表结构

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pzabbix zabbix

编辑/etc/zabbix/zabbix_server.conf文件,修改数据库密码

DBPassword=zabbix

配置PHP,修改/etc/nginx/conf.d/zabbix.conf,取消listen及server_name两行的注释

listen 80;
server_name example.com;

修改PHP时区,修改/etc/php-fpm.d/zabbix.conf

php_value[date.timezone] = Asia/Shanghai

启动服务

systemctl enable zabbix-server zabbix-agent nginx php-fpm --now

发表评论

电子邮件地址不会被公开。 必填项已用*标注