編譯安裝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的編譯安裝;感興趣的小夥伴趕忙去試試吧。

相關文章
相關標籤/搜索