Zabbix 5.0 版本于 5 月 12日正式发布,是最新的 LTS(长期支持)版本,5.0 带来很多功能和特性,后面会陆续推出文章介绍,下面主要介绍 5.0 版本的安装。
一、环境要求
5.0 版本对基础环境的要求有大的变化,最大的就是对 php 版本的要求,最低要求 7.2.0 版本,对 php 扩展组件版本也有要求,详见官网文档。
(https://www.zabbix.com/documentation/current/manual/installation/requirements)
二、YUM 安装
基本环境
操作系统:CentOS Linux release 7.8.2003 (Core) x86_64
安装方式:最小化安装
sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config
systemctl disable --now firewalld
reboot
rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
sed -i ‘s#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#‘ /etc/yum.repos.d/zabbix.repo
yum clean all
yum install zabbix-server-mysql zabbix-agent -y
yum install centos-release-scl -y
enabled=1
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl -y
yum install mariadb-server -y
systemctl enable --now mariadb
mysql_secure_installation
create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by ‘password‘;
grant all privileges on zabbix.* to zabbix@localhost;
quit;
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
DBPassword=password
php_value[date.timezone] = Asia/Shanghai
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
三、编译安装
01
基础环境配置
鉴于 5.0 对 php 等组件版本的要求,编译安装前建议参考版本,使用对应的版本进行安装,lnmp 环境采用 dnf 方式安装,使用编译安装 Zabbix。
基本环境
操作系统:CentOS Linux release 8.1.1911 (Core) x86_64
安装方式:最小化安装
sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config
systemctl disable --now firewalld
reboot
dnf install httpd php php-gd php-ldap php-mysqlnd php-json php-bcmath php-mbstring php-xml mysql mysql-server mysql-devel libevent-devel pcre-devel gcc gcc-c++ make libcurl-devel curl-* net-snmp* libxml2-* wget tar -y
useradd zabbix
3.启动相关组件并配置开机启动
systemctl enable --now httpd mysqld php-fpm
02
安装配置
cd /opt
wget https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.0.tar.gz
tar zxvf zabbix-5.0.0.tar.gz
cd zabbix-5.0.0
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
make
make install
create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by ‘password‘;
grant all privileges on zabbix.* to zabbix@localhost;
quit
mysql -uzabbix -p zabbix < /opt/zabbix-5.0.0/database/mysql/schema.sql
mysql -uzabbix -p zabbix < /opt/zabbix-5.0.0/database/mysql/images.sql
mysql -uzabbix -p zabbix < /opt/zabbix-5.0.0/database/mysql/data.sql
DBPassword=password
vi /lib/systemd/system/zabbix-server.service
内容如下
[Unit]
Description=Zabbix Server
After=syslog.target
After=network.target
After=mysql.service
After=mysqld.service
After=mariadb.service
After=postgresql.service
[Service]
Environment="CONFFILE=/usr/local/zabbix/etc/zabbix_server.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-server
Type=forking
Restart=on-failure
PIDFile=/tmp/zabbix_server.pid
KillMode=control-group
ExecStart=/usr/local/zabbix/sbin/zabbix_server -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
TimeoutSec=0
[Install]
WantedBy=multi-user.target
vi /lib/systemd/system/zabbix-agent.service
内容如下
[Unit]
Description=Zabbix Agent
After=syslog.target
After=network.target
[Service]
Environment="CONFFILE=/usr/local/zabbix/etc/zabbix_agentd.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-agent
Type=forking
Restart=on-failure
PIDFile=/tmp/zabbix_agentd.pid
KillMode=control-group
ExecStart=/usr/local/zabbix/sbin/zabbix_agentd -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID``RestartSec=10s
User=zabbix
Group=zabbix
[Install]
WantedBy=multi-user.target
systemctl enable --now zabbix-server
systemctl enable --now zabbix-agent
03
前端安装
cp -r /opt/zabbix-5.0.0/ui/* /var/www/html/
chown -R apache:apache /var/www/html/
sed -i ‘s#post_max_size = 8M#post_max_size = 16M#‘ /etc/php.ini
sed -i ‘s#max_execution_time = 30#max_execution_time = 300#‘ /etc/php.ini
sed -i ‘s#max_input_time = 60#max_input_time = 300#‘ /etc/php.ini
sed -i ‘s#;date.timezone =#date.timezone = Asia/Shanghai#‘ /etc/php.ini
systemctl restart php-fpm
四、WEB 初始化
下一步
下一步
下一步
登录账号为 Admin,密码:zabbix
首页
完成页面初始化。
百家号?Zabbix China?
知乎 Zabbix中国
头条 Zabbix中国
哔哩哔哩?Zabbix中国
抖音?Zabbix中国
原文:https://www.cnblogs.com/jonnyan/p/13023783.html