CentOS6.4下部署Zabbix2.2.0RC

    有时候我们需要在没有网络的环境下部署zabbix,这个时候就不得不用源码去装,用源码来装往往有很多很多的坑,所以在此做下记录

部署MySQL  

    安装MySQL之前要先安装CMake 

tar xvf cmake-2.6.4.tar.gz
cd  cmake-2.6.4
./configure --prefix=/usr/local/cmake
gmake
make install

    更新环境变量

vi ~/.bash_profile
#PATH=$PATH:$HOME/bin:/usr/local/cmake/bin
source ~/.bash_profile

    安装MySQL

tar -xvf mysql-5.6.12.tar.gz 
cd mysql-5.6.12

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_USER=kira \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DMYSQL_TCP_PORT=3306  

make
make install

chmod -Rf 777 /usr/local/mysql/*
chmod -Rf 777 /home/software/mysql-5.6.12
cp /home/software/mysql-5.6.12/support-files/my-default.cnf /etc/my.cnf 

cd /home/software/mysql-5.6.12/scripts
./mysql_install_db --user=root --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/

groupadd mysql  
useradd -r -g mysql mysql 

##启动MySQL
/usr/local/mysql/bin/mysqld_safe 

##修改MySQL密码
/usr/local/mysql/bin/mysqladmin -u root password '8565'

ln -s /usr/local/mysql/bin/mysql /usr/sbin/

mysql -uroot -p8565
#GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '8565' WITH GRANT OPTION;
#flush privileges;

安装必须组件

    安装libxml

tar zxvf libxml2-2.7.7.tar.gz 
cd libxml2-2.7.7
./configure --prefix=/usr/local/libxml2
make
make install

安装zlib

tar -zxf zlib-1.2.5.tar.gz 
cd zlib-1.2.5 
./configure
make 
make install

      安装jpeg

tar -xvf jpegsrc.v8c.tar.gz 
cd jpeg-8c/
./configure --prefix=/usr/local/jpeg
make 
make install

     安装libpng

tar -xvf libpng-1.5.7.tar.gz 
cd libpng-1.5.7
./configure --prefix=/usr/local/libpng
make
make install

    安装freetype

tar -xvf freetype-2.4.8.tar.gz
cd freetype-2.4.8
./configure --prefix=/usr/local/freetype
make 
make install

安装gettext

tar -xvf gettext-0.18.1.1.tar.gz
cd gettext-0.18.1.1
./configure
make
make install
cp /usr/lib64/gettext/* /usr/lib64/  (64位的系统才要)

安装gd

tar -xvf gd-2.0.35.tar.gz 
cd gd/2.0.35
./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg \
--with-png=/usr/local/libpng --with-freetype=/usr/local/freetype \
--enable-m4_pattern_allow
make
make install


部署Apache

安装pcre

unzip pcre-8.10.zip 
cd pcre-8.10
./configure --prefix=/usr/local/pcre
make 
make install

安装apr

tar -xvf apr-1.4.5.tar.gz 
cd apr-1.4.5
./configure --prefix=/usr/local/apr
make 
make install

安装apr-util

tar -xvf apr-util-1.3.12.tar.gz 
cd apr-util-1.3.12
./configure --prefix=/usr/local/apr-util --with-apr=/home/software/apr-1.4.5
make 
make install

安装Apache

tar -xvf httpd-2.4.6
cd httpd-2.4.6
./configure --prefix=/usr/local/apache --enable-module=so --with-apr=/home/software/apr-1.4.5 --with-apr-util=/home/software/apr-util-1.3.12 --with-pcre=/usr/local/pcre/
make
make install

/usr/local/apache/bin/httpd -k start

安装PHP

安装php

tar -xvf php-5.4.17.tar.gz 
cd php-5.4.17

./configure --prefix=/usr/local/php\
 --with-apxs2=/usr/local/apache/bin/apxs\
 --with-jpeg-dir=/usr/local/jpeg\
 --with-png-dir=/usr/local/libpng\
 --with-libxml-dir=/usr/local/libxml2\
 --with-gd=/usr/local/gd\
 --with-freetype-dir=/usr/local/freetype\
 --with-zlib=/usr/local/zlib --with-gettext\
 --enable-bcmath --enable-ftp --enable-mbstring --enable-sockets\
 --with-iconv-dir=/usr/lib --with-mysql=/usr/local/mysql -with-mysqli=/usr/local/mysql/bin/mysql_config
     
 make 
 make install

修改php的配置文件

cp php.ini-production /usr/local/php/lib//php.ini
vi  /usr/local/php/php.ini

#date.timezone = Asia/shanghai
#memory_limit = 256M
#max_input_time = 600
#max_execution_time = 600
#post_max_size = 32M
#upload_max_filesize = 16M

开启Apache的PHP支持

vi /usr/local/apache/conf/httpd.conf
#AddType application/x-httpd-php .php
#DirectoryIndex index.html index.php

/usr/local/apache/bin/httpd -k stop
/usr/local/apache/bin/httpd -k start

部署Zabbix

安装jabber

tar -xvf iksemel-1.4.tar.gz 
cd iksemel-1.4
./configure --prefix=/usr/local/jabber
make 
make install

安装Zabbix

tar -xvf zabbix-2.2.0rc2.tar.gz 
cd zabbix-2.2.0rc2
./configure --prefix=/usr/local/zabbix \
--enable-server --with-mysql=/usr/local/mysql/bin/mysql_config \
--enable-agent --enable-ipv6 --with-net-snmp --with-jabber=/usr/local/jabber --with-libcurl

启动zabbix server

cp /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib
cp /usr/local/jabber/lib/libiksemel.so.3 /usr/lib

groupadd zabbix
useradd -g zabbix kira
passwd kira
su - kira
/usr/local/zabbix/sbin/zabbix_server -c /usr/local/zabbix/etc/zabbix_server.conf start

启动zabbix页面

cp -Rf /home/software/zabbix-2.2.0rc2/frontends/ /usr/local/apache/htdocs/
mv /usr/local/apache/htdocs/frontends/ /usr/local/apache/htdocs/zabbix

最后按照PHP页面上的提示完成zabbix网站的配置即可

你可能感兴趣的:(zabbix)