安裝zabbix-3.0.3+nginx-1.10.1+php-5.6.22


好久沒有接觸監控類的軟件了,今天抽空搭建了下最新的版本

首先系統環境

  zabbix-server-1 192.168.11.11   centos6.7

  mysql-server    192.168.11.5    mysql服務器獨立安裝

 

兩台服務器,mysql獨立安裝好的,這個安裝不在此介紹了

zabbix-server-1 是全新安裝,安裝時選擇基本安裝,同時在開發組件里把

服務器平台開發

桌面平台開發

附加開發

勾選上

另外為了讓web頁面能夠支持中文顯示,在語言里,添加中午字體

中文支持 [zh]



以上安裝包對應的英文選項就不在此介紹了



系統安裝完后

本次所需的第三方軟件包

以下軟件包通過官網下載

zabbix-3.0.3.tar.gz   http://www.zabbix.com/download.php  官網下載頁面
http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.3/zabbix-3.0.3.tar.gz/download 下載鏈接
nginx-1.10.1.tar.gz http://nginx.org/en/download.html 官網下載頁面
http://nginx.org/download/nginx-1.10.1.tar.gz 下載鏈接
php-5.6.22.tar.gz http://php.net/downloads.php 官網下載頁面
http://php.net/get/php-5.6.22.tar.gz/from/a/mirror 下載鏈接列表
http://cn2.php.net/get/php-5.6.22.tar.gz/from/this/mirror 選擇中國站點下載

 

配置yum倉庫

[root@zabbix-server-1 yum.repos.d]# cat zabbix.repo
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
enabled=1
yum clean all  # 清除yum緩存
yum makecache  # 生成yum緩存

開始安裝nginx

#安裝依賴包
yum install pcre pcre-devel openssl openssl-devel gcc-c++
useradd -s /sbin/nologin -M nginx
tar xf nginx-1.10.1.tar.gz

./configure --user=nginx --group=nginx --prefix=/application/nginx-1.10.1 --with-http_stub_status_module --with-http_ssl_module

make
make install
ln -s /application/nginx-1.10.1/ /application/nginx /application/nginx/sbin/nginx #start nginx service ps -ef|grep nginx ss -lntup|grep nginx [root@zabbix-server-1 conf]# pwd /application/nginx/conf egrep -v "#|^$" nginx.conf.default > nginx.conf #修改部分配置 [root@zabbix-server-1 conf]# cat 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; location / { root html; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~\.(php|php5)?$ { root /application/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /application/nginx/html$fastcgi_script_name; include fastcgi_params; } } } #殺死進程,重啟服務 ps -ef|grep nginx /application/nginx/sbin/nginx

 

安裝php依賴包

yum install zlib-devel libxml2-devel libjpeg-devel libiconv-devel freetype-devel libpng-devel gd-devel curl-devel libxslt-devel mysql-devel

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make
make install


#添加epel源
#https://fedoraproject.org/wiki/EPEL
#上面這個位置找到對應的系統版本進入
#centos 6 x86_64 https://dl.fedoraproject.org/pub/epel/6/x86_64/
#https://dl.fedoraproject.org/pub/epel/   通過這個頁面下載對應的epel yum源安裝包

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

yum install libmcrypt-devel mhash mcrypt

安裝php

tar xf php-5.6.22.tar.gz
cd php-5.6.22



./configure \
--prefix=/application/php-5.6.22 \
--with-mysql \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--with-gettext \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp \
--enable-opcache=no


make
make install

ln -s /application/php-5.6.22/ /application/php
[root@zabbix-server-1 php-5.6.22]# pwd
/root/php-5.6.22

[root@zabbix-server-1 php-5.6.22]# cp php.ini-production /application/php/lib/php.ini
[root@zabbix-server-1 php-5.6.22]# cd /application/php/etc/
[root@zabbix-server-1 etc]# ls
pear.conf  php-fpm.conf.default
[root@zabbix-server-1 etc]# pwd
/application/php/etc
[root@zabbix-server-1 etc]# cp php-fpm.conf.default php-fpm.conf
[root@zabbix-server-1 etc]# /application/php/sbin/php-fpm
[root@zabbix-server-1 etc]# netstat -lntup|grep php-fpm
tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN      3689/php-fpm

安裝zabbix

tar zxvf zabbix-3.0.3.tar.gz

cd zabbix-3.0.3
groupadd zabbix
useradd -g zabbix zabbix

#安裝依賴包,如果一次安裝錯誤,就多試幾次
yum install net-snmp net-snmp-devel libssh2-devel OpenIPMI-devel

[root@zabbix-server-1 zabbix-3.0.3]# ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi --with-ssh2

make
make install

[root@zabbix-server-1 zabbix-3.0.3]# egrep -v "#|^$" /usr/local/etc/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBHost=192.168.11.5
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
ListenIP=0.0.0.0
Timeout=4
AlertScriptsPath=${datadir}/zabbix/alertscripts
LogSlowQueries=3000

#拷貝啟動腳本
cp misc/init.d/fedora/core/zabbix_* /etc/rc.d/init.d/

zabbix_server

#修改配置文件
vim /application/php/lib/php.ini
max_execution_time = 300
max_input_time = 300
post_max_size = 16M
always_populate_raw_post_data = -1
date.timezone = Asia/Shanghai


#重啟php
[root@zabbix-server-1 zabbix-3.0.3]# pkill -9 php-fpm
[root@zabbix-server-1 zabbix-3.0.3]# /application/php/sbin/php-fpm

#從zabbix源碼包拷貝網站到nginx
[root@zabbix-server-1 zabbix-3.0.3]# pwd
/root/zabbix-3.0.3
[root@zabbix-server-1 zabbix-3.0.3]# cp -rf frontends/php /application/nginx/html/zabbix/

#如果有防火牆,要么開放80端口,要么臨時停止
service iptables stop

#給目錄設置權限
chown -R nginx.nginx /application/nginx/html/

 

 

基本上zabbix服務器算是安裝差不多了

這里准備配置mysql服務器了,需要在mysql服務器上授權,及初始化zabbix數據庫

#配置mysql服務器了。
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
grant all privileges on zabbix.* to zabbix@'192.168.11.11' identified by 'zabbix';
flush privileges;
quit;
#按照SQL語句順序導入SQL:
mysql -uzabbix -pzabbix zabbix < zabbix-3.0.3/database/mysql/schema.sql
mysql -uzabbix -pzabbix zabbix < zabbix-3.0.3/database/mysql/images.sql
mysql -uzabbix -pzabbix zabbix < zabbix-3.0.3/database/mysql/data.sql

 

打開瀏覽器,輸入以下鏈接

http://192.168.11.11/zabbix/setup.php

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM