zabbix安装

zabbix 安装,必须要php环境,先装个lnmp

[root@slave1 ~]# tar xvf pcre-8.12.tar.gz

[root@slave1 ~]# cd pcre-8.12

[root@slave1 pcre-8.12]# ./configure && make && make install

[root@slave1 ~]# yum install openssl* -y

[root@slave1 ~]# tar xvf nginx-1.0.15.tar.gz

[root@slave1 ~]# tar xvf ngx_cache_purge-1.3.tar.gz

[root@slave1 ~]# cd nginx-1.0.15

[root@slave1 nginx-1.0.15]# vi auto/cc/gcc
# debug
#CFLAGS="$CFLAGS -g"

[root@slave1 nginx-1.0.15]# useradd www

[root@slave1 nginx-1.0.15]# ./configure --user=www --group=www --add-module=/root/ngx_cache_purge-1.3/ --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module

[root@slave1 nginx-1.0.15]# make && make install

[root@slave1 ~]# tar xvf autoconf-2.13.tar.gz

[root@slave1 ~]# cd autoconf-2.13

[root@slave1 autoconf-2.13]# ./configure && make && make install

[root@slave1 ~]# tar zxvf libiconv-1.14.tar.gz

[root@slave1 ~]# cd libiconv-1.14

[root@slave1 libiconv-1.14]# ./configure && make && make install

[root@slave1 ~]# tar zxvf libmcrypt-2.5.8.tar.gz

[root@slave1 ~]# cd libmcrypt-2.5.8

[root@slave1 libmcrypt-2.5.8]# ./configure && make && make install

[root@slave1 libmcrypt-2.5.8]# /sbin/ldconfig

[root@slave1 libmcrypt-2.5.8]# cd libltdl/

[root@slave1 libltdl]# ./configure --enable-ltdl-install && make && make install

[root@slave1 ~]# tar xvf mhash-0.9.9.9.tar.gz

[root@slave1 ~]# cd mhash-0.9.9.9

[root@slave1 mhash-0.9.9.9]# ./configure && make && make install

[root@slave1 mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
[root@slave1 mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
[root@slave1 mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
[root@slave1 mhash-0.9.9.9]# ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
[root@slave1 mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
[root@slave1 mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
[root@slave1 mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
[root@slave1 mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
[root@slave1 mhash-0.9.9.9]# ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1

[root@slave1 ~]# tar xvf mcrypt-2.6.8.tar.gz

[root@slave1 ~]# cd mcrypt-2.6.8

[root@slave1 mcrypt-2.6.8]# ./configure && make && make install

*** Could not run libmcrypt test program, checking why...
*** The test program compiled, but did not run. This usually means
*** that the run-time linker is not finding LIBMCRYPT or finding the wrong
*** version of LIBMCRYPT. If it is not finding LIBMCRYPT, you'll need to set your
*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point
*** to the installed location Also, make sure you have run ldconfig if that
*** is required on your system
***
*** If you have an old version installed, it is best to remove it, although
*** you may also be able to get things to work by modifying LD_LIBRARY_PATH
***
configure: error: *** libmcrypt was not found
[root@slave1 mcrypt-2.6.8]# export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

[root@slave1 mysql]# yum -y install ncurses-devel

[root@slave1 mysql]# useradd mysql

[root@slave1 mysql]# tar xvf mysql-5.1.58.tar.gz

[root@slave1 mysql]# cd mysql-5.1.58

[root@slave1 mysql]# ./configure --prefix=/usr/local/mysql --localstatedir=/data/mysqldata --with-extra-charsets=complex --with-big-tables --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --without-debug --with-plugins=all --with-readline --with-ssl --with-embedded-server --enable-local-infile

[root@slave1 mysql]# make && make install

[root@slave1 mysql-5.1.58]# cp support-files/my-medium.cnf /etc/my.cnf

[root@slave1 mysql]# cd /usr/local/mysql
[root@slave1 mysql]# chown -R mysql .
[root@slave1 mysql]# chgrp -R mysql .
[root@slave1 mysql]# /usr/local/mysql/bin/mysql_install_db --user=mysql
[root@slave1 mysql]# chown -R root .
[root@slave1 mysql]# chown mysql.mysql /usr/local/mysql
[root@slave1 mysql]# mkdir -p /data/mysqldata
[root@slave1 mysql]# chown -R mysql /data/mysqldata
[root@slave1 mysql]# cp /root/mysql-5.1.58/support-files/mysql.server /etc/init.d/mysqld
[root@slave1 mysql]# chmod 755 /etc/init.d/mysqld
[root@slave1 mysql]# service mysqld restart
[root@slave1 mysql]# chkconfig --level 345 mysqld on
[root@slave1 mysql]# echo "PATH=/usr/local/mysql/bin:$PATH" >> /etc/profile
[root@slave1 mysql]# echo "export PATH" >> /etc/profile
[root@slave1 mysql]# source /etc/profile

[root@slave1 ~]# tar xvf php-5.2.17.tar.gz

[root@slave1 ~]# gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1

[root@slave1 ~]# cd php-5.2.17

[root@slave1 php-5.2.17]# patch -p1 < /root/php-5.2.17-max-input-vars.patch

[root@slave1 php-5.2.17]# ./buildconf --force

[root@slave1 php-5.2.17]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic

configure: error: libjpeg.(a|so) not found.
[root@slave1 php-5.2.17]# yum install libjpeg

[root@slave1 php-5.2.17]# cp -frp /usr/lib64/libjpeg.* /usr/lib/

configure: error: libpng.(a|so) not found.

[root@slave1 php-5.2.17]# cp -frp /usr/lib64/libpng* /usr/lib/

[root@slave1 php-5.2.17]# make ZEND_EXTRA_LIBS='-liconv'

FATAL ERROR: Autoconf version 2.58 or higher is required for this script
make[1]: *** [/root/php-5.2.17/libevent/configure] 错误 1
make[1]: Leaving directory `/root/php-5.2.17/libevent'
make: *** [/root/php-5.2.17/libevent/libevent.a] 错误 2

[root@slave1 ~]# tar xvf autoconf-2.61.tar.gz

[root@slave1 ~]# cd autoconf-2.61

[root@slave1 autoconf-2.61]# ./configure && make && make install

[root@slave1 php-5.2.17]# make ZEND_EXTRA_LIBS='-liconv'

[root@slave1 php-5.2.17]# make install

[root@slave1 php-5.2.17]# mkdir -p /usr/local/php/etc

[root@slave1 php-5.2.17]# cp php.ini-dist /usr/local/php/etc/php.ini

[root@slave1 ~]# tar xvf memcache-3.0.6.tgz

[root@slave1 ~]# cd memcache-3.0.6

[root@slave1 memcache-3.0.6]# /usr/local/php/bin/phpize

[root@slave1 memcache-3.0.6]# ./configure --with-php-config=/usr/local/php/bin/php-config

[root@slave1 memcache-3.0.6]# make && make install

Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/

[root@slave1 ~]# cd /root/php-5.2.17/ext/pdo_mysql

[root@slave1 pdo_mysql]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
[root@slave1 pdo_mysql]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql

[root@slave1 pdo_mysql]# make && make install

Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/

[root@slave1 pdo_mysql]# sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"\nextension = "memcache.so "\nextension = "pdo_mysql.so"\n#' /usr/local/php/etc/php.ini
[root@slave1 pdo_mysql]# sed -i 's#output_buffering = Off#output_buffering = On#' /usr/local/php/etc/php.ini
[root@slave1 pdo_mysql]# sed -i 's/post_max_size = 8M/post_max_size = 50M/g' /usr/local/php/etc/php.ini
[root@slave1 pdo_mysql]# sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /usr/local/php/etc/php.ini
[root@slave1 pdo_mysql]# sed -i 's/;date.timezone =/date.timezone = PRC/g' /usr/local/php/etc/php.ini
[root@slave1 pdo_mysql]# sed -i 's/short_open_tag = Off/short_open_tag = On/g' /usr/local/php/etc/php.ini
[root@slave1 pdo_mysql]# sed -i 's/; cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini
[root@slave1 pdo_mysql]# sed -i 's/; cgi.fix_pathinfo=0/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini
[root@slave1 pdo_mysql]# sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /usr/local/php/etc/php.ini
[root@slave1 pdo_mysql]# sed -i 's/disable_functions =.*/disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,fsockopen/g' /usr/local/php/etc/php.ini

[root@slave1 ~]# service php-fpm start
Nov 26 06:13:20.174050 [ERROR] fpm_unix_conf_wp(), line 124: please specify user and group other than root, pool 'default'
.......^C

 

修改这
Unix user of processes
<value name="user">nobody</value>

Unix group of processes
<value name="group">nobody</value>

成这样子
<value name="user">www</value>

Unix group of processes
<value name="group">www</value>

<value name="max_children">10</value> //优化连接数

[root@slave1 autoconf-2.61]# yum -y install curl curl-devel net-snmp net-snmp-devel perl-DBI

[root@slave1 ~]# mysqladmin -uroot password '123456'

[root@slave1 ~]# groupadd zabbix
[root@slave1 ~]# useradd -g zabbix zabbix
[root@slave1 ~]# usermod -s /sbin/nologin zabbix

[root@slave1 ~]# mysql -uroot -p123456 -e "create database zabbix"

[root@slave1 ~]# mysql -uroot -p123456 -e "grant all on zabbix.* to zabbix@localhost identified by '123456'"

[root@slave1 ~]# tar xvf zabbix-2.0.6.tar.gz

[root@slave1 ~]# cd zabbix-2.0.6

[root@slave1 zabbix-2.0.6]# mysql -uzabbix -p123456 zabbix < database/mysql/schema.sql
[root@slave1 zabbix-2.0.6]# mysql -uzabbix -p123456 zabbix < database/mysql/images.sql
[root@slave1 zabbix-2.0.6]# mysql -uzabbix -p123456 zabbix < database/mysql/data.sql

[root@slave1 zabbix-2.0.6]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl

[root@slave1 zabbix-2.0.6]# make install

编辑配置文件
[root@slave1 zabbix-2.0.6]# cd /usr/local/zabbix/

[root@slave1 etc]# cp zabbix_agentd.conf zabbix_agentd.conf.bak
[root@slave1 etc]# cp zabbix_server.conf zabbix_server.conf.bak

修改成如下
[root@slave1 etc]# grep -Ev '^$|^#' zabbix_server.conf
LogFile=/usr/local/zabbix/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456

 

[root@slave1 sbin]# ./zabbix_server: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory

[root@slave1 sbin]# ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/libiconv.so.2

[root@slave1 ~]# cd zabbix-2.0.6

[root@slave1 zabbix-2.0.6]# cp misc/init.d/tru64/zabbix_server /etc/init.d/
[root@slave1 zabbix-2.0.6]# cp misc/init.d/tru64/zabbix_agentd /etc/init.d/

 

 

启动后web登陆报如下错误,

查找原因

1、selinux 是否关闭

2、防火墙是否放行

3、查看php函数是否被禁用

 

 

posted @ 2014-01-16 10:28  kingtigerhu  阅读(779)  评论(3)    收藏  举报