1. 程式人生 > >最詳細Zabbix3.4部署安裝教程—基於Centos7.3,內附PHP,Nginx,MySQL等架設教程

最詳細Zabbix3.4部署安裝教程—基於Centos7.3,內附PHP,Nginx,MySQL等架設教程

第一步,下載Zabbix3.4原始碼包,編譯安裝
    1.1原始碼包下載

# wget -O zabbix-3.4.9.tar.gz http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.4.9/zabbix-3.4.9.tar.gz/download

    1.2原始碼包解壓

# tar zxvf zabbix-3.4.9.tar.gz
# rm -rf zabbix-3.4.9.tar.gz

第二步,Nginx+MySQL+PHP環境搭建
    2.1Nginx部署搭建
        2.1.1下載Nginx原始碼,版本為1.14,並關閉防火牆開啟iptables

# systemctl stop firewalld.service
# systemctl disable firewalld.service
# yum install iptables-services
# systemctl restart iptables.service #最後重啟防火牆使配置生效
# systemctl enable iptables.service #設定防火牆開機啟動
# wget http://nginx.org/download/nginx-1.14.0.tar.gz #放置目錄為/usr/local/src
# tar zxvf nginx-1.14.0.tar.gz
# rm -rf nginx-1.14.0.tar.gz
        2.1.2安裝環境依賴
# yum install -y pcre pcre-devel
# yum install -y zlib zlib-devel
# yum install -y gcc-c++
# yum install -y openssl openssl-devel
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.42.tar.gz
# tar zxvf pcre-8.42.tar.gz
# wget https://www.openssl.org/source/openssl-1.1.1-pre7.tar.gz
# tar zxvf openssl-1.1.1-pre7.tar.gz
# wget http://zlib.net/zlib-1.2.11.tar.gz
# tar zxvf zlib-1.2.11.tar.gz

        2.1.3編譯及安裝

# cd pcre-8.42/
# mkdir /usr/local/pcre
# ./configure --prefix=/usr/local/pcre
# make && make install
# cd openssl-1.1.1-pre7/
# mkdir /usr/local/openssl
# ./config --prefix=/usr/local/openssl
# make && make install
# vi /etc/profile
###修改內容如下
export PATH=$PATH:/usr/local/openssl/bin
###修改完畢
# source /etc/profile
# cd zlib-1.2.11/
# mkdir /usr/local/zlib
# ./configure --prefix=/usr/local/zlib
# make && make instal
# cd /usr/local/src/nginx-1.14.0/
# groupadd nginx  #建立nginx使用者並給予許可權
# useradd -g nginx -d /home/nginx nginx
# passwd nginx
# ./configure --prefix=/usr/local/nginx --without-http_memcached_module --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/usr/local/src/openssl-1.1.1-pre7 --with-zlib=/usr/local/src/zlib-1.2.11 --with-pcre=/usr/local/src/pcre-8.42 
# make && make install
# cd /usr/local/nginx/sbin/
# ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx
# /usr/local/nginx/sbin/nginx  #啟動nginx
# 輸入伺服器IP地址,如192.168.1.14
### 結果如下圖,如打不開網頁,請檢查防火牆埠是否開放
    2.2MySQL部署搭建
        2.2.1下載MySQL
# rpm -ivh https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
# yum -y install mysql-community-server
        2.2.2啟動mysql服務,設定成開機啟動,Centos6開啟命令自行搜尋
# systemctl start mysqld.service
# systemctl enable mysqld.service
        2.2.3檢視並修改資料庫root密碼
# cat /var/log/mysqld.log | grep password    
# 顯示的結果末尾為資料庫密碼
# mysql -uroot -p
# 用預設密碼登入資料庫
mysql> set password = password('Mysql123!')
# 密碼自行修改
        2.2.4建立並匯入Zabbix資料庫
# cd zabbix-3.4.9/database/mysql/
# mysql -u root -p #輸入密碼,進入MySQL控制檯
mysql> create database zabbix character set utf8; #建立資料庫zabbix,並且資料庫編碼使用utf8
mysql> grant all privileges on zabbix.* to [email protected]'localhost' identified by '123456'; #新建賬戶zabbix,密碼123456
mysql> use zabbix;
mysql> source schema.sql; #匯入指令碼檔案到zabbix資料庫
mysql> source images.sql; #匯入指令碼檔案到zabbix資料庫
mysql> source data.sql; #匯入指令碼檔案到zabbix資料庫
mysql> quit; #退出資料庫
# cd /usr/lib64/mysql/
# ln -s libmysqlclient.so.16.0.0 libmysqlclient.so #新增軟連線
# ln -s libmysqlclient_r.so.16.0.0 libmysqlclient_r.so #新增軟連線
    2.3PHP部署搭建
        2.3.1安裝yasm
# wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
# tar zxvf yasm-1.3.0.tar.gz
# cd yasm-1.3.0/
# ./configure
# make && make install
        2.3.2安裝libmcrypt
# wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
# tar zxvf libmcrypt-2.5.8.tar.gz
# cd libmcrypt-2.5.8.tar.gz
# ./configure
# make $$ make install
    2.3.3安裝libvpx
# wget http://www.loongnix.org/cgit/libvpx/snapshot/libvpx-1.7.0.tar.
# tar zxvf libvpx-1.7.0.tar.gz
# cd libvpx-1.7.0/# ./configure --prefix=/usr/local/libvpx --enable-shared --enable-vp9
# make && make install
        2.3.4安裝tiff
# wget http://download.osgeo.org/libtiff/tiff-4.0.9.tar.gz
# tar zxvf tiff-4.0.9.tar.gz
# cd tiff-4.0.9/
# ./configure --prefix=/usr/local/tiff --enable-shared
# make && make install
        2.3.5安裝libpng
# wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.34.tar.gz
# tar zxvf libpng-1.6.34.tar.gz
# cd libpng-1.6.34
# ./configure --prefix=/usr/local/libpng --enable-shared
# make && make install
        2.3.6安裝freetype
# wget https://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.gz
# tar zxvf freetype-2.9.tar.gz
# cd freetype-2.9/
# ./configure --prefix=/usr/local/freetype --enable-shared
# make && make installa
        2.3.7安裝jpeg
# wget http://www.ijg.org/files/jpegsrc.v9c.tar.gz
# tar zxvf jpegsrc.v9c.tar.gz
# cd jpeg-9c/
# ./configure --prefix=/usr/local/jpeg --enable-shared
# make && make install
        2.3.8安裝libgd
# wget https://github.com/libgd/libgd/releases/download/gd-2.2.5/libgd-2.2.5.tar.gz
# tar zxvf libgd-2.2.5.tar.gz
# cd libgd-2.2.5/
# ./configure --prefix=/usr/local/libgd --enable-shared --with-jpeg=/usr/local/jpeg --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-xpm=/usr/ --with-tiff=/usr/local/tiff --with-vpx=/usr/local/libvpx
# make && make install
        2.3.9安裝t1lib
# wget http://download.freenas.org/distfiles/t1lib-5.1.2.tar.gz
# tar zxvf t1lib-5.1.2.tar.gz
# cd t1lib-5.1.2/
# ./configure --prefix=/usr/local/t1lib --enable-shared
# make without_doc && make install
        2.4.0安裝PHP
# wget http://cn2.php.net/distributions/php-5.6.36.tar.gz
# tar zxvf php-5.6.36.tar.gz
# cd php-5.6.36/
# yum install libxml2-devel -y
# yum install curl curl-devel
# yum install libXpm-devel
# yum install mysql-devel
# export LD_LIBRARY_PATH=/usr/local/libgd/lib
# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql --with-mysqli=/usr/bin/mysql_config --with-mysql-sock=/var/lib/mysql/mysql.sock --with-pdo-mysql --with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-xpm-dir=/usr/ --with-vpx-dir=/usr/local/libvpx/ --with-zlib-dir=/usr/local/zlib --with-t1lib=/usr/local/t1lib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --enable-ctype
# make && make install
# cp php.ini-production /usr/local/php/etc/php.ini #複製php配置檔案到安裝目錄
# rm -rf /etc/php.ini  #刪除系統自帶配置檔案
# ln -s /usr/local/php/etc/php.ini /etc/php.ini   #新增軟連結到 /etc目錄
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf  #拷貝模板檔案為php-fpm配置檔案
# ln -s /usr/local/php/etc/php-fpm.conf /etc/php-fpm.conf  #新增軟連線到 /etc目錄
# vi /usr/local/php/etc/php-fpm.conf #編輯
###編輯內容如下:
user = nginx #設定php-fpm執行賬號為nginx
group = nginx #設定php-fpm執行組為nginx
pid = run/php-fpm.pid #取消前面的分號
###修改內容結束
# cp /usr/local/src/php-5.6.36/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm #拷貝php-fpm到啟動目錄
# chmod +x /etc/rc.d/init.d/php-fpm #新增執行許可權
# chkconfig php-fpm on #設定開機啟動
# vi /usr/local/php/etc/php.ini #編輯配置檔案
###修改內容如下:
disable_functions = 
passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,
ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,
popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,
posix_ctermid,posix_get_last_error,posix_getcwd, 
posix_getegid,posix_geteuid,posix_getgid, 
posix_getgrgid,posix_getgrnam,posix_getgroups,
posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, 
posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, 
posix_getsid,posix_getuid,posix_isatty, posix_kill,
posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, 
posix_setpgid,posix_setsid,posix_setuid,posix_strerror,
posix_times,posix_ttyname,posix_uname
###修改內容結束
# vi /usr/local/nginx/conf/nginx.conf #配置nginx支援php
###修改內容如下:
user nginx nginx; #首行user去掉註釋,修改Nginx執行組為nginx nginx;
#必須與/usr/local/php/etc/php-fpm.conf中的user,group配置相同,否則php執行出錯
index index.html index.htm index.php; #新增index.php
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#取消FastCGI server部分location的註釋,注意fastcgi_param行的引數,改為$document_root$fastcgi_script_name,或者使用絕對路徑
###修改內容結束
# /etc/init.d/nginx restart #重啟nginx
# service php-fpm start #啟動php-fpm
        2.4.1測試
# cd /usr/local/nginx/html/ #進入nginx預設網站根目錄
# rm -rf /usr/local/nginx/html/* #刪除預設測試頁
# vi index.php #新建index.php檔案
###修改內容如下:
<?php
phpinfo();
?>
###修改結束
# chown nginx.nginx /usr/local/nginx/html/ -R #設定目錄所有者
# chmod 700 /usr/local/nginx/html/ -R #設定目錄許可權
# 輸入伺服器IP地址,如192.168.1.14
###結果如下圖:
第三步,安裝Zabbix
    3.1新增使用者
# groupadd zabbix #建立使用者組zabbix
# useradd zabbix -g zabbix -s /bin/false #建立使用者zabbix,並且把使用者zabbix加入到使用者組zabbix中
    3.2安裝依賴包
# yum install net-snmp-devel curl curl-devel mysql-devel

    3.3安裝Zabbix

# ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2 #新增軟連線
# /sbin/ldconfig #使配置立即生效
# cd zabbix-3.4.9
# yum install libevent-devel  -y
# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-net-snmp --with-libcurl --enable-proxy --with-mysql=/usr/bin/mysql_config #配置
# make && make install
# ln -s /usr/local/zabbix/sbin/* /usr/local/sbin/ #新增系統軟連線
# ln -s /usr/local/zabbix/bin/* /usr/local/bin/ #新增系統軟連線
    3.4新增Zabbix服務所對應的埠
# vi /etc/services
#修改內容如下:
zabbix-agent 10050/tcp # Zabbix Agent  #埠自行設定
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
zabbix-trapper 10051/udp # Zabbix Trapper
###修改完畢
    3.5修改Zabbix配置檔案
# cd /usr/local/zabbix/etc
# vi /usr/local/zabbix/etc/zabbix_server.conf
###修改內如下:
DBName=zabbix #資料庫名稱
DBUser=zabbix #資料庫使用者名稱
DBPassword=123456 #資料庫密碼
ListenIP=127.0.0.1 #資料庫ip地址
AlertScriptsPath=/usr/local/zabbix/share/zabbix/alertscripts #zabbix執行指令碼存放目錄
###修改完畢
# vi /usr/local/zabbix/etc/zabbix_agentd.conf
###修改內容如下:
Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/
UnsafeUserParameters=1 #啟用自定義key
###修改完畢
    3.6新增開機啟動指令碼
# cp /usr/local/src/zabbix-3.4.9/misc/init.d/fedora/core/zabbix_server /etc/rc.d/init.d/zabbix_server #服務端
# cp /usr/local/src/zabbix-3.4.9/misc/init.d/fedora/core/zabbix_agentd /etc/rc.d/init.d/zabbix_agentd #客戶端
# chmod +x /etc/rc.d/init.d/zabbix_server #新增指令碼執行許可權
# chmod +x /etc/rc.d/init.d/zabbix_agentd #新增指令碼執行許可權
# chkconfig zabbix_server on #新增開機啟動
# chkconfig zabbix_agentd on #新增開機啟動
    3.7修改zabbix開機啟動指令碼中的安裝目錄
# vi /etc/rc.d/init.d/zabbix_server #編輯服務端配置檔案
###修改內容如下:
BASEDIR=/usr/local/zabbix/ #zabbix安裝目錄
###修改完畢
# vi /etc/rc.d/init.d/zabbix_agentd #編輯客戶端配置檔案
###修改內容如下:
BASEDIR=/usr/local/zabbix/ #zabbix安裝目錄
###修改完畢
第四步,配置Web站點
    4.1,增加站點資訊
# cd /usr/local/src/zabbix-3.4.9/
# cp -r /usr/local/src/zabbix-3.4.9/frontends/php /usr/local/nginx/html/zabbix
# chown nginx.nginx -R /usr/local/nginx/html/zabbix
# service zabbix_server start
# systemctl daemon-reload
# service zabbix_agentd start

    4.2修改PHP配置

# vi /etc/php.ini #編輯修改
###修改內容如下:
post_max_size =16M
max_execution_time =300
max_input_time =300
###修改完畢
# vi /usr/local/php/etc/php-fpm.conf
###修改內容如下:
request_terminate_timeout = 300
###修改完畢
# service php-fpm reload #重啟php-fpm

第五步,安裝Zabbix Web介面
    5.1開啟瀏覽器輸入網址

# 在瀏覽器中開啟http://192.168.1.14/zabbix/setup.php  #其中192.168.1.14修改為你自己的IP地址

    5.2修正安裝問題

# 在php.ini中找到date.timezone選項,將其賦值Asia/Shangha
# 在php.ini中找到always_populate_raw_post_data選擇,將前面分號去掉
# cd /usr/local/src/php-5.6.36/ext/ldap/
# yum install autoconf
# yum install openldap openldap-devel  -y
# /usr/local/php/bin/phpize
# cp -frp /usr/lib64/libldap* /usr/lib/
# ./configure -with-ldap -with-php-config=/usr/local/php/bin/php-config
# make && make install
# service php-fpm reload  #重啟php-fpm
###顯示結果如下圖,全部ok:
    5.3輸入資料庫資訊
# Database:MySQL
# Database host:127.0.0.1
# Database port:use default port
# Database name:zabbix
# User:zabbix
# Password:123456
###顯示結果如下圖:
    5.4建立成功,輸入帳號密碼登入
# 帳號:admin
# 密碼:zabbix
#後期自行修改帳號密碼
###結果顯示如下圖:



    

相關推薦

詳細Zabbix3.4部署安裝教程基於Centos7.3PHPNginxMySQL架設教程

第一步,下載Zabbix3.4原始碼包,編譯安裝    1.1原始碼包下載# wget -O zabbix-3.4.9.tar.gz http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3

Zabbix3.4-部署安裝

inux 軟件 啟動 tar eat rop .sql vim 部署 Zabbix部署安裝: 系統環境:CentOS 7 Zabbix版本:Zabbix 3.4 關閉防火墻和SELINUX systemctl stop firewalld &&

Centos7.3安裝部署新版Zabbix3.4

centos7.3安裝部署最新版zabbix3.4一、系統環境 cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) 關閉防火墻及selinux systemctl stop firewalld.service systemctl dis

詳細的問win10vue安裝教程及cnpm安裝完之後一直說不是內部命令的原因詳解

由於 bcd 應用 前端知識 長時間 官網下載 text vue.js 學習 由於業務場景需要,學習了一點前端知識,需要用得到vue框架,下面對vue框架的詳細安裝以截圖和文字的形式展示,如有任何問題,請聯系我,共同學習。 一、Vue.js簡介? Vue (讀音 /vju

Centos6安裝CDH5.15.1詳細版-4 安裝Cloudera Manager

配置網路yum源為阿里雲源 完全離線的話可以不做 三臺伺服器都需要配置 1.1 備份原來的配置 mkdir -p /etc/yum.repos.d/bak mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak 1.

Cobbler部署詳細教程基於Centos7.5

當前環境介紹: 當前系統Centos7.5,關閉selinux,關閉firewalld(或自行設定相應規則),關閉當前路由dhcp功能,如果是虛擬機器安裝則網路介面卡要選擇NAT模式(因為同一區域網多個DHCP服務會有衝突),本機IP地址192.168.50.101 前提:cobbler由epel源提

史上詳細中文版Visual Studio2012安裝步驟圖解新手教程

下面是IT認證考試資源網總結的Visual Studio 2012的安裝方法: 1)注意:只有Visual Studio 2012才能進行“Windows 8 應用商店”(也就是Windows 8 風格應用程式)程式的開發。Visual Studio 2010等低版本的開

CentOS7+zabbix3.4+YUM安裝部署

版本資訊 作業系統:CentOS Linux release 7.5.1804 (Core) 資料庫:mysql 5.7.23 PHP Version 5.4.16 Apache/2.4.6 Zabbix 3.4 1.

詳細的Windows平臺安裝MongoDB教程

自己 all 文件 ces os x 對象 對組 安裝過程 自然 一、MongoDB簡介 MongoDB是一個基於分布式文件存儲的數據庫,由C++語言編寫,旨在為WEB應用提供可擴展的高性能數據存儲解決方案。 MongoDB將數據存儲為一個文檔,數據結構由鍵值(key=

基於centos7.3安裝部署jewel版本ceph集群實戰演練

集群 ceph 一、環境準備安裝centos7.3虛擬機三臺由於官網源與網盤下載速度都非常的慢,所以給大家提供了國內的搜狐鏡像源:http://mirrors.sohu.com/centos/7.3.1611/isos/x86_64/CentOS-7-x86_64-DVD-1611.iso在三臺裝好的

史上詳細Windows版本搭建安裝React Native環境配置

gin windows系統 adl 搭建環境 tools 想要 變量 rep home 說在前面的話: 感謝同事金曉冰傾情奉獻本環境搭建教程 之前我們已經講解了React Native的OS X系統的環境搭建以及配置,鑒於各大群裏有很多人反應在Windows環境搭建出現各種

Zabbix3.4安裝篇(一)

entos agent roo zabb com serve arc centos 7 mysql- 實驗環境:Centos 71.下載zabbix yum 文件 [root@xiaopeng /]# cd /etc/yum.repos.d/ [root@xiaop

Zabbix3.4部署

Zabbix Linux 部署 安裝 Zabbix硬件需求:一、Mariadb數據庫部署:1.安裝Mariadb數據庫: yum install mariadb-server -ysystemctl start mariadb.service systemctl enable mariadb.

Centos 7.4Zabbix3.4安裝配置

信息 目錄 shang align host 啟動 3.1 oca gin Zabbix3.4的安裝配置一、 Zabbix環境準備1. 基礎環境準備 OS版本:centos 7.4 64bit Zabbix版本:3.4

zabbix3.4.2安裝

安裝 zabbix-server: # rpm -i https://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm  # yum install zabbix-server-mysql z

全網詳細的Windows下安裝Anaconda2 / Anaconda3(圖文詳解)

  不多說,直接上乾貨!     說明:     Anaconda2-5.0.0-Windows-x86_64.exe安裝下來,預設的Python2.7     Anaconda3-4.2.0-Windows-x86_64.exe安裝下來,預設的Python3.5     Ana

全網詳細Apache Kylin1.5安裝(單節點)和測試案例 ---> 現在看來 kylin 需要 安裝到Hadoop Master 節點上

5. 主機規劃IP                Host                    安裝軟體                 程序172.16.101.55 sht-sgmhadoopnn-01   apache-kylin-1.5.1-HBase1.

詳細的SQL Server2008 安裝圖解

資料庫視訊將近看完了,但是SQL Server 一直都沒有親自動手安裝過,所以一直都不會安裝,今天自己動手安裝了兩次,總算是安裝成功了,以下是自己安裝的全過程: 執行程式後,點選安裝 安裝程式

基於centos7.3 redhat7.3安裝LAMP(php7.0 php7.1)生產環境實踐

php mysql lamp #將yum安裝的包緩沖到本地,然後制作本地local_yumvim /etc/yum.conf#本機信息hostnameLAMPip192.168.42.10#由於官網yum源下載慢,這裏添加ali源yum clean all rm -rf /etc/yum.repo

WebVirtMgr 基於Centos7.3的KVM虛擬化管理平臺安裝

cenots7 kvm webvirtmgr 虛擬化平臺KVM是centos下面的虛擬機,是一個比較好用的一種虛擬化技術,但是通常來說服務器跑Centos很少會安裝圖形界面,使用命令來管理虛擬機也是比較麻煩的,所以有一種web的虛擬化管理平臺就很方便了。安裝環境,Centos7.3,硬件Dell R710,