好久没有接触监控类的软件了,今天抽空搭建了下最新的版本
首先系统环境
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-1yum.repos.d]# catzabbix.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
#安装依赖包
yuminstall pcre pcre-devel openssl openssl-develgcc-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 500502503504 /50x.html;
location =/50x.html {
root html;
}
location~\.(php|php5)?$ {
root/application/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME /application/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
}
}
#杀死进程,重启服务
ps -ef|grep nginx
/application/nginx/sbin/nginx
安装php依赖包
yuminstall zlib-devel libxml2-devel libjpeg-devellibiconv-devel freetype-devel libpng-devel gd-devel curl-devel libxslt-develmysql-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
makeinstall
#添加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
yuminstall 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
makeinstall
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 0127.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 zabbixzabbix
#安装依赖包,如果一次安装错误,就多试几次
yuminstall net-snmp net-snmp-devel libssh2-develOpenIPMI-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
makeinstall
[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 iptablesstop
#给目录设置权限
chown -R nginx.nginx /application/nginx/html/
基本上zabbix服务器算是安装差不多了
这里准备配置mysql服务器了,需要在mysql服务器上授权,及初始化zabbix数据库
#配置mysql服务器了。
createdatabase zabbix characterset utf8 collate utf8_bin;
grantallprivilegeson zabbix.*to zabbix@localhost identified by'zabbix';
grantallprivilegeson 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
共同学习,写下你的评论
评论加载中...
作者其他优质文章