zabbix-3.2.3+php-5.6.29+percona-server-5.6.29-76.2+nginx-1.10.2(CentOS6.5)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zabbix-3.2.3+php-5.6.29+percona-server-5.6.29-76.2+nginx-1.10.2(CentOS6.5)相关的知识,希望对你有一定的参考价值。

一、安装percona-server-5.6.29-76.2
1、先安装依赖包
yum -y install gcc gcc-c++ autoconf automake openssl openssl-devel zlib zlib-devel ncurses-devel libtool-ltdl-devel bison-devel bison
 
2、安装cmake,编译percona用
cd /usr/local/src && tar xf cmake-3.7.2.tar.gz && cd cmake-3.7.2
 
./configure && make && make install
 
3、安装percona-server
cd /usr/local/src && tar xf percona-server-5.6.29-76.2.tar.gz && cd percona-server-5.6.29-76.2
 
/usr/local/bin/cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ -DMYSQL_DATADIR=/usr/local/mysql/data/ -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_TCP_PORT=3306 -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=0 -DWITH_EDITLINE:STRING=bundled -DWITH_SSL=yes -DSYSCONFDIR=/usr/local/mysql/ -DENABLE_DOWNLOADS=1 && make && make install
 
useradd -r mysql && chown -R mysql. /usr/local/mysql
 
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --defaults-file=/usr/local/mysql/ --user=mysql && ln -s /usr/local/mysql/bin/mysqlbinlog  /usr/bin/mysqlbinlog && ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
 
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld && chmod a+x /etc/init.d/mysqld && chkconfig --add mysqld && chkconfig mysqld on
 
vim /usr/local/mysql/my.cnf
[client]
port = 3306
socket = /usr/local/mysql/mysql.sock
[mysqld]
innodb_buffer_pool_size = 3276M
log-bin=mysql-bin
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
join_buffer_size = 128M
sort_buffer_size = 2M
read_rnd_buffer_size = 2M
skip-name-resolve
max_connections = 1000
pid-file=/usr/local/mysql/mysqld.pid
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
 
/etc/init.d/mysqld start
 
/usr/local/mysql/bin/mysql_secure_installation
 
二、安装php
yum -y install libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel libxslt-devel openldap openldap-devel libmcrypt libmcrypt-devel
 
\cp -frp /usr/lib64/libldap* /usr/lib/ && cd /usr/local/src/ && tar xf php-5.6.29.tar.gz && cd php-5.6.29
 
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc/  --with-mysql --with-mysqli --with-pdo-mysql --enable-mysqlnd --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --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 --with-gettext --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc  --enable-soap --enable-ftp --enable-opcache=no && make && make install
 
cp php.ini-production /usr/local/php/etc/php.ini && cd /usr/local/php/etc/ && cp php-fpm.conf.default php-fpm.conf
 
vim /usr/local/php/etc/php.ini
max_execution_time = 300
max_input_time = 300
memory_limit = 128M
post_max_size = 32M
date.timezone = Asia/Shanghai
always_populate_raw_post_data = -1
 
cp /usr/local/src/php-5.6.29/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
 
chmod a+x /etc/init.d/php-fpm && chkconfig --add php-fpm && chkconfig php-fpm on && /etc/init.d/php-fpm start
 
三、安装nginx
yum -y install pcre pcre-devel && useradd -r -s /sbin/nologin www
 
cd /usr/local/src/ && tar xf nginx-1.10.2.tar.gz && cd nginx-1.10.2
 
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --with-cc-opt=-O3 --with-stream && make && make install
 
vim /usr/local/nginx/conf/nginx.conf
user  www;
location / {
            root   /var/www/html;
            index  index.php index.html index.htm;
        }
location ~ \.php$ {
            root           /var/www/html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /var/www/html$fastcgi_script_name;
            include        fastcgi_params;
        }
 
加入开机启动
vim /etc/init.d/nginx
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: 35 85 15
# description: Nginx is a high-performance web and proxy server.
#              It has a lot of features, but it‘s not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
 
#nginx程序路径
nginxd=/usr/local/nginx/sbin/nginx
 
#nginx配置文件路径
nginx_config=/usr/local/nginx/conf/nginx.conf
 
#nginx pid文件的路径,可以在nginx的配置文件中找到
nginx_pid=/var/run/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
   echo "nginx already running...."
   exit 1
fi
   echo -n $"Starting $prog: "
   daemon $nginxd -c ${nginx_config}
   RETVAL=$?
   echo
   [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
   return $RETVAL
}
# Stop nginx daemons functions.
stop() {
        echo -n $"Stopping $prog: "
        killproc $nginxd
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
}
# reload nginx service functions.
reload() {
    echo -n $"Reloading $prog: "
    #kill -HUP `cat ${nginx_pid}`
    killproc $nginxd -HUP
    RETVAL=$?
    echo
}
# See how we were called.
case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
reload)
        reload
        ;;
restart)
        stop
        start
        ;;
status)
        status $prog
        RETVAL=$?
        ;;
*)
        echo $"Usage: $prog {start|stop|restart|reload|status|help}"
        exit 1
esac
exit $RETVAL
 
chmod a+x /etc/init.d/nginx && chkconfig --add nginx && chkconfig nginx on
 
四、安装zabbix
useradd -r -s /sbin/nologin zabbix && mkdir -p /var/www/html/zabbix && cd /usr/local/src/ && tar xf zabbix-3.2.3.tar.gz && cd zabbix-3.2.3
 
yum -y install net-snmp-devel
 
mysql -uroot -pmysql
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to ‘zabbix‘@‘127.0.0.1‘ identified by ‘zabbix‘;
quit;
 
cd /usr/local/src/zabbix-3.2.3/database/mysql/
mysql -uzabbix -pzabbix zabbix < schema.sql
mysql -uzabbix -pzabbix zabbix < images.sql
mysql -uzabbix -pzabbix zabbix < data.sql
 
cd /usr/local/src/zabbix-3.2.3 && ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql==/usr/local/mysql/bin/mysql_config --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 && make && make install
 
vim /usr/local/zabbix/etc/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
 
vim /usr/local/zabbix/etc/zabbix_agentd.conf
Server={zabbix server ip}
Hostname={agent hostname}
 
echo "/usr/local/mysql/lib/" >> /etc/ld.so.conf && ldconfig
 
/usr/local/zabbix/sbin/zabbix_server && /usr/local/zabbix/sbin/zabbix_agentd
 
cp -a /usr/local/src/zabbix-3.2.3/frontends/php /var/www/html/zabbix/
 
cd /var/www/html/zabbix/conf && cp zabbix.conf.php.example zabbix.conf.php
 
vim zabbix.conf.php
<?php
// Zabbix GUI configuration file.
global $DB;
 
$DB[‘TYPE‘]                     = ‘MYSQL‘;
$DB[‘SERVER‘]                   = ‘127.0.0.1‘;
$DB[‘PORT‘]                     = ‘0‘;
$DB[‘DATABASE‘]                 = ‘zabbix‘;
$DB[‘USER‘]                     = ‘zabbix‘;
$DB[‘PASSWORD‘]                 = ‘zabbix‘;
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB[‘SCHEMA‘]                   = ‘‘;
 
$ZBX_SERVER                     = ‘localhost‘;
$ZBX_SERVER_PORT                = ‘10051‘;
$ZBX_SERVER_NAME                = ‘‘;
 
$IMAGE_FORMAT_DEFAULT   = IMAGE_FORMAT_PNG;
 
http://<server_ip_or_name>/zabbix
技术分享
Make sure that all software prerequisites are met.
技术分享
 
技术分享
 
技术分享
 
 
 
 
 
 

以上是关于zabbix-3.2.3+php-5.6.29+percona-server-5.6.29-76.2+nginx-1.10.2(CentOS6.5)的主要内容,如果未能解决你的问题,请参考以下文章

zabbix2.4.7升级3.2.3

Zabbix-3.2.3实现微信(WeChat)告警

学习搭建zabbix

源码安装zabbix_agent 3.2.3

zabbix 3.2.3 appliance默认用户名及密码

Linux rpm安装zabbix agent