编译安装Zabbix 5.0 LTS

编译安装Zabbix 5.0 LTS

Zabbix 5.0 LTS新增功能

新版本附带了可用性,安全性和完整性方面的重大改进列表。Zabbix团队遵循的主要策略是使Zabbix尽量可用。Zabbix是一种开源,免费的监视解决方案,如今能够在内部和云中部署。在RedHat / IBM,SuSE,Ubuntu的最新版本的平台,容器和Linux发行版中可用。如今,一键式Zabbix部署也能够在Azure,AWS,Google Cloud,IBM / RedHat Cloud,Oracle和Digital Ocean上使用。如今,在Red Hat和Azure市场上提供Zabbix技术支持服务。html

此外,Zabbix监视工具还提供了与Messenger,票务和警报系统的大量现成集成。新版本扩展了能够轻松监控的受支持服务和应用程序的列表。前端

知足一些新功能:mysql

  • 自动化和发现:新的Zabbix版本具备改进的自动化功能。新版本增长了自动发现硬件组件,与Windows相关的资源以及Java度量的高级发现的功能。
  • 可扩展性:Zabbix UI已通过优化,能够简化对数百万个设备的监视。
  • 新的Zabbix监视代理程序具备“官方支持”状态。新的可扩展代理为最苛刻的客户和复杂的用例提供了高级功能。它基于插件体系结构,具备使用各类方法和技术收集度量标准数据的能力。咱们相信它是市场上最早进的监控代理。
  • 安全性方面的重大改进:新的改进确保全部Zabbix组件以安全的方式进行通讯,而且还使用安全协议进行出站通讯,而不会以任何方式影响性能。对于在高度敏感的环境中使用Zabbix的用户而言,可配置的密码以及为度量定义黑名单和白名单的能力相当重要。
  • TimescaleDB的压缩:时间序列数据压缩有助于提升性能和效率,同时下降运营成本。
  • 可用性改进:新版本针对宽屏进行了优化,除了Zabbix UI的其余加强功能以外,还引入了对第三方UI模块的支持。

Zabbix 5.0是具备5年官方支持的LTS(长期支持)版本。它结合了创新和稳定性,并包括通过时间检验的功能,这些功能已在Zabbix 4.2和4.4的非LTS版本中引入,这使其成为大型企业环境的理想选择。linux

注:Zabbix 5.0 版本对基础环境的要求有大的变化,最大的就是对 php 版本的要求,最低要求 7.2.0 版本,对 php 扩展组件版本也有要求,详见官网文档https://www.zabbix.com/documentation/current/manual/installation/requirementsnginx

系统初始化

# 配置主机名称 hostnamectl --static --transient set-hostname ZabbixServer # 关闭防火墙 systemctl stop firewalld systemctl disable firewalld iptables -F && iptables -X && iptables -F -t nat && iptables -X -t nat iptables -P FORWARD ACCEPT # 关闭swap分区 swapoff -a sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab # 关闭SELinux setenforce 0 sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config # 配置时钟同步 # 配置时区 timedatectl set-timezone Asia/Shanghai # 查看同步状态 timedatectl status # 注:System clock synchronized: yes,表示时钟已同步; NTP service: active,表示开启了时钟同步服务。 # 将当前的 UTC 时间写入硬件时钟 timedatectl set-local-rtc 0 # 重启依赖于系统时间的服务 systemctl restart rsyslog systemctl restart crond # 关闭无关服务 systemctl stop postfix && systemctl disable postfix # 重启主机 sync reboot 
Bash

编译安装LNMP

编译安装Nginx v1.18.0

Nginx官方网站:http://nginx.org/en/download.htmlc++

Nginx v1.18.0下载地址:http://nginx.org/download/nginx-1.18.0.tar.gzgit

咱们直接去上面的地址下载 Nginx v1.18.0 版本、下载完成之后采用下面的命令解压并编译安装Nginx:sql

# 下载Nginx wget http://nginx.org/download/nginx-1.18.0.tar.gz # 解压Nginx tar -zxvf nginx-1.18.0.tar.gz # 编译安装Nginx cd nginx-1.18.0 mkdir -p /usr/local/nginx/ ./configure --prefix=/usr/local/nginx/ --without-http_rewrite_module --without-http_gzip_module --with-pcre && make && make install 
Bash

注:若是须要安装特定模块也能够自行添加、Nginx支持模块详情能够查看Nginx官方文档:http://nginx.org/en/docs/shell

而后咱们将Nginx注册为Centos7系统服务,将下面的内容插入到 /etc/init.d/nginx 文件中:

#!/bin/sh # # nginx - this script starts and stops the nginx daemon # # chkconfig: - 85 15 # description: NGINX is an HTTP(S) server, HTTP(S) reverse \ # proxy and IMAP/POP3 proxy server # processname: nginx # config: /usr/local/nginx/conf/nginx.conf # pidfile: /usr/local/nginx/logs/nginx.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 # :set ff=unix # 修改成实际配置文件目录 nginx="/usr/local/nginx/sbin/nginx" prog=$(basename $nginx) # 修改成实际配置文件目录 NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx lockfile=/var/lock/subsys/nginx make_dirs() { # make required directories user=`$nginx -V 2>&1 | grep "configure arguments:.*--user=" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -` if [ -n "$user" ]; then if [ -z "`grep $user /etc/passwd`" ]; then useradd -M -s /bin/nologin $user fi options=`$nginx -V 2>&1 | grep 'configure arguments:'` for opt in $options; do if [ `echo $opt | grep '.*-temp-path'` ]; then value=`echo $opt | cut -d "=" -f 2` if [ ! -d "$value" ]; then # echo "creating" $value mkdir -p $value && chown -R $user $value fi fi done fi } start() { [ -x $nginx ] || exit 5 [ -f $NGINX_CONF_FILE ] || exit 6 make_dirs echo -n $"Starting $prog: " daemon $nginx -c $NGINX_CONF_FILE retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { echo -n $"Stopping $prog: " killproc $prog -QUIT retval=$? echo [ $retval -eq 0 ] && rm -f $lockfile return $retval } restart() { configtest || return $? stop sleep 1 start } reload() { configtest || return $? echo -n $"Reloading $prog: " killproc $prog -HUP retval=$? echo } force_reload() { restart } configtest() { nginx -t -c $NGINX_CONF_FILE } rh_status() { status $prog } rh_status_q() { rh_status >/dev/null 2>&1 } case "$1" in start) rh_status_q && exit 0 $1 ;; stop) rh_status_q || exit 0 $1 ;; restart|configtest) $1 ;; reload) rh_status_q || exit 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || exit 0 ;; *) echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" exit 2 esac 
Bash

注:上面那个文件里面要修改的地方有,这两处改成本身的nginx 安装位置。保存必定要保存成UNIX格式(notepad++:编辑–文档格式转换–转为UNIX格式),不然会报错的。

而后咱们就能够把Nginx注册成服务并设置为开机自动启动了:

# 设置执行权限 chmod +x /etc/init.d/nginx # 注册成服务 chkconfig --add nginx # 设置开机启动 chkconfig nginx on # 而后咱们就可使用下面的命令来管理nginx(使用下面的命令以前先执行/usr/local/nginx/sbin/nginx) systemctl status nginx systemctl start nginx systemctl stop nginx 
Bash

而后咱们在浏览器中输入主机IP地址就能够看到久违的页面啦。

编译安装PHP v7.2.25

在编译安装PHP以前、咱们须要准备安装环境:

# 下载安装编译工具 yum groupinstall 'Development Tools' # 安装依赖包 yum install -y libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel 
Bash

PHP官方网站:https://www.php.net/

PHP v7.2.25下载地址:https://www.php.net/distributions/php-7.2.25.tar.gz

下载完成之后咱们一样采用下面的命令解压并编译安装PHP:

# 下载PHP wget https://www.php.net/distributions/php-7.2.25.tar.gz # 解压PHP tar -zxvf php-7.2.25.tar.gz # 在编译钱咱们须要新增用户组和用户用于编译使用 groupadd www useradd -g www www useradd www # 编译PHP(具体模块根据本身状况自行增减) cd php-7.2.25 ./configure --prefix=/usr/local/php --with-config-file-path=/etc --with-fpm-user=www --with-fpm-group=www --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip --enable-fpm # 编译没有问题,咱们就能够直接安装PHP了 make && make install 
Bash

注:在PHP 7.4版本中编译参数 –with-gd 改为了 –enable-gd

安装完成之后咱们就能够来配置PHP的环境变量并把PHP添加到系统服务中:

# 验证PHP版本 /usr/local/php/bin/php -v # 添加环境变量,把下面的的命令添加到/etc/profile文件的最后 PATH=$PATH:/usr/local/php/bin export PATH # 更新环境变量 source /etc/profile # 查看PHP版本 php -v # 配置PHP-FPM cd php-7.2.25 cp php.ini-production /etc/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm # 启动PHP-FPM /etc/init.d/php-fpm start 注:而后咱们就能够经过systemctl命令来管理PHP啦! 
Bash

Nginx和PHP都编译安装完成之后、咱们须要把Nginx和PHP集成起来;这里咱们须要去修改Nginx的配置文件、让Nginx支持PHP,咱们去/usr/local/nginx/conf下面修改nginx.conf文件:

[root@localhost conf]# grep -v "#" nginx.conf worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; # 添加index.php location / { root html; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # 放开有关php的location注释 location ~ \.php{ root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; # 修改路径 fastcgi_param SCRIPT_FILENAMEdocument_root$fastcgi_script_name; include fastcgi_params; } } } [root@localhost conf]# 
Bash

修改完成之后咱们重启Nginx和PHP并到/usr/local/nginx/html目录下面新建index.php文件并插入下面的内容:

# 重启Nginx systemctl restart nginx # 重启PHP systemctl restart php-fpm 
Bash

而后咱们刷新浏览器页面,能够获得下面的页面就表明Nginx和PHP已经集成成功了:

img

安装MySQL 5.6

Nginx和PHP编译安装完成之后咱们开始部署数据库;下午咱们就能够来安装MySQL数据库了。这里咱们安装MySQL5.6.48版本:

MySQL官方网站:https://www.mysql.com/

MySQL 5.6下载地址:https://cdn.mysql.com//Downloads/MySQL-5.6/MySQL-5.6.48-1.el7.x86_64.rpm-bundle.tar

这里咱们离线安装的方式安装MySQL5.6.48:

# 下载MySQL wget https://cdn.mysql.com//Downloads/MySQL-5.6/MySQL-5.6.48-1.el7.x86_64.rpm-bundle.tar # 解压MySQL tar -xf MySQL-5.6.48-1.el7.x86_64.rpm-bundle.tar # 安装以前须要把系统自带的Mariadb卸载 [root@ZabbixServer ~]# rpm -qa | grep mariadb mariadb-libs-5.5.64-1.el7.x86_64 [root@ZabbixServer ~]# yum remove mariadb-libs-5.5.64-1.el7.x86_64 -y # 建立mysql用户组和用户 groupadd mysql && useradd mysql # 安装MySQL rpm -ivh MySQL-server-5.6.48-1.el7.x86_64.rpm rpm -ivh MySQL-client-5.6.48-1.el7.x86_64.rpm rpm -ivh MySQL-devel-5.6.48-1.el7.x86_64.rpm rpm -ivh MySQL-embedded-5.6.48-1.el7.x86_64.rpm rpm -ivh MySQL-shared-5.6.48-1.el7.x86_64.rpm rpm -ivh MySQL-shared-compat-5.6.48-1.el7.x86_64.rpm # 验证MySQL是否安装成功 rpm -qa | grep MySQL 
Bash

安装完成之后MySQL会把默认生成的密码放在 /root/.mysql_secret ,咱们能够直接查看该文件并用该密码登陆到MySQL数据中;在登陆以前咱们须要先启动MYSQL数据库:

# 启动MySQL数据库并添加到开机启动项 systemctl start mysql systemctl enable mysql # 获取MySQL随机密码 [root@ZabbixServer zabbix-5.0.0]# cat /root/.mysql_secret # The random password set for the root user at Mon Jun 8 17:02:46 2020 (local time): aFj3rwYAdEsLQUSN [root@ZabbixServer zabbix-5.0.0]# # 初始化MySQL数据库 [root@ZabbixServer]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] ... Success! By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] ... Success! All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! Cleaning up... [root@ZabbixServer]# # 受权远程访问 [root@ZabbixServer]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 14 Server version: 5.6.48 MySQL Community Server (GPL) Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. 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. # root是登录数据库的用户,123456是登录数据库的密码,*就是意味着任何来源任何主机。 mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION; Query OK, 0 rows affected (0.01 sec) # 刷新生效 mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) mysql> mysql> quit Bye [root@ZabbixServer]# 
Bash

而后咱们用Navicat Premium看看可否正常链接数据库,若是能够正常链接、就表明数据库已经基本配置完成。

img

到这里、LNMP基本环境就已经配置完成了;下面咱们开始安装Zabbix 5.0 LTS。

安装zabbix

Zabbix官方网站:https://www.zabbix.com/cn/

Zabbix 5.0 下载地址:https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.0.tar.gz

在安装Zabbix 5.0以前咱们先把相关依赖包安装好,直接执行下面的命令便可:

yum install gcc gcc-c++ make unixODBC-devel net-snmp-devel libssh2-devel OpenIPMI-devel libevent-devel pcre-devel libcurl-devel curl-* net-snmp* libxml2-* wget tar -y 
Bash

而后咱们开始安装Zabbix5.0:

# 下载zabbix 5.0 wget https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.0.tar.gz # 解压Zabbix tar -zxvf zabbix-5.0.0.tar.gz # 配置Zabbix mkdir -p /usr/local/zabbix cd zabbix-5.0.0 ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 # 编译并安装Zabbix make && make install 
Bash

zabbix编译安装完成之后咱们须要建立zabbix所需的用户和组:

groupadd --system zabbix useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix 
Bash

而后咱们再次回到zabbix解压目录、复制启动脚本到 /etc/init.d/ 目录并对文件受权:

cd zabbix-5.0.0 cp misc/init.d/fedora/core/zabbix_* /etc/init.d/ ll -d /etc/init.d/zabbix_* chmod +x /etc/init.d/zabbix_* 
Bash

建立zabbix数据库并依次导入数据文件:

# 进入MySQL Cli交互式命令行 mysql -u root -p # 建立数据库并受权访问 create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to zabbix@localhost identified by '123456'; grant all privileges on zabbix.* to zabbix@127.0.0.1 identified by '123456'; GRANT ALL PRIVILEGES ON *.* TO 'zabbix'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION; flush privileges; # 导入相关数据(切记导入顺序) [root@ZabbixServer mysql]# mysql -u zabbix -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 37 Server version: 5.6.48 MySQL Community Server (GPL) Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. 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> use zabbix; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> source /root/zabbix-5.0.0/database/mysql/schema.sql //表结构 mysql> source /root/zabbix-5.0.0/database/mysql/image.sql //图片相关数据 mysql> source /root/zabbix-5.0.0/database/mysql/data.sql //模版相关数据 
Bash

配置zabbix_server.conf相关参数:

[root@ZabbixServer zabbix-5.0.0]# grep -v "#" /usr/local/zabbix/etc/zabbix_server.conf LogFile=/var/log/zabbix/zabbix_server.log PidFile=/tmp/zabbix_server.pid DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=123456 DBSocket=/var/lib/mysql/mysql.sock DBPort=3306 StartPollers=100 StartTrappers=10 StartPingers=10 StartDiscoverers=10 Timeout=4 LogSlowQueries=3000 Include=/usr/local/zabbix/etc/zabbix_server.conf.d/*.conf StatsAllowedIP=127.0.0.1 [root@ZabbixServer zabbix-5.0.0]# 
Bash

配置zabbix_agent.conf相关参数:

[root@ZabbixServer zabbix-5.0.0]# grep -v "#" /usr/local/zabbix/etc/zabbix_agentd.conf PidFile=/tmp/zabbix_agentd.pid LogFile=/var/log/zabbix/zabbix_agent.log LogFile=/tmp/zabbix_agentd.log DenyKey=system.run[*] Server=127.0.0.1 ServerActive=127.0.0.1 Hostname=Zabbix server Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/*.conf UnsafeUserParameters=1 [root@ZabbixServer zabbix-5.0.0]# 
Bash

上面咱们建立日志文件目录,这里必需要对日志文件目录进行受权,不然在启动zabbix的时候会报错的:

chown -R zabbix:zabbix /var/log/zabbix 
Bash

注:这里须要特别说明:必定要对日志文件目录受权、否则会报错的。

配置zabbix server启动文件 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 -SIGTERMMAINPID RestartSec=10s TimeoutSec=0 [Install] WantedBy=multi-user.target 
Bash

配置 zabbix agent 启动文件 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 -SIGTERMMAINPID RestartSec=10s User=zabbix Group=zabbix [Install] WantedBy=multi-user.target 
Bash

启动zabbix server和zabbix agent并添加到系统启动项:

systemctl enable --now zabbix-server systemctl enable --now zabbix-agent 
Bash

启动完成之后咱们能够经过netstat -nltp命令验证一下zabbix服务端口是否监听成功:

[root@ZabbixServer zabbix-5.0.0]# systemctl enable --now zabbix-server Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service. [root@ZabbixServer zabbix-5.0.0]# systemctl enable --now zabbix-agent Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service. [root@ZabbixServer zabbix-5.0.0]# netstat -nltp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 873/zabbix_agentd tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 536/zabbix_server tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 4267/php-fpm: maste tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4215/nginx: master tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1110/sshd tcp6 0 0 :::10050 :::* LISTEN 873/zabbix_agentd tcp6 0 0 :::10051 :::* LISTEN 536/zabbix_server tcp6 0 0 :::3306 :::* LISTEN 20496/mysqld tcp6 0 0 :::22 :::* LISTEN 1110/sshd [root@ZabbixServer zabbix-5.0.0]# 
Bash

而后咱们拷贝前端文件目录到Nginx服务目录:

cp -r /root/zabbix-5.0.0/ui/* /var/www/html/ chown -R www:www /var/www/html/ 
Bash

咱们把前端文件拷贝到Nginx运行目录以后,就能够经过浏览器来设置前端的配置信息了;依次点击下一步完成配置便可,这里须要注意的是,咱们还须要去配置PHP的环境参数以适配Zabbix:

# vi /etc/php.ini 修改内容以下 max_execution_time = 300 max_input_time = 300 post_max_size = 16M date.timezone = Asia/Shanghai pdo_mysql.default_socket=/var/lib/mysql/mysql.sock mysqli.default_socket =/var/lib/mysql/mysql.sock # 修改完成之后重启PHP systemctl restart php-fpm 
Bash

img
img
img
img
img
img
img

好了、如今咱们已经成功进入Zabbix管理页面;从上图能够看到Zabbix Server和Zabbix Agent已经成功启动;到这里,咱们就已经完成了Zabbix 5.0 LTS的编译安装;感兴趣的小伙伴赶忙去试试吧。