#!/bin/bash
#author: jorden
#date 2016-05-03
#version: 1.0
echo #####tengine 一键安装###
####install dependent package#####
yum -y install openssl openssl-devel zlib gcc gcc-c++ pcre cmake pcre pcre-devel
echo ""
echo "####add user and group######"
v_www=`cat /etc/passwd|grep www|wc -l`
if [ v_www=0 ];then
groupadd www
useradd www -s /sbin/nologin -M -g www
else
echo -e "\033[31m user ‘www‘ already exists! noting to do \033[0m"
fi
echo ""
echo -e "\033[32m #######install tengine to /usr/local/tengine####### \033[0m"
echo "wget tengine to /usr/local/src"
cd /usr/local/src
wget http://tengine.taobao.org/download/tengine-2.0.3.tar.gz
tar xf tengine-2.0.3.tar.gz
cd tengine-2.0.3
./configure --prefix=/usr/local/tengine --user=www --group=www --with-select_module --with-poll_module --with-file-aio --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_spdy_module --with-http_secure_link_module --with-http_flv_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-http_sub_module --with-http_stub_status_module --with-http_ssl_module
make
make install
echo ""
echo "last you neet to do the next two steps "
echo -e "\033[31m ####1.configure the nginx.conf#### \033[0m"
echo -e "\033[31m ####2.start tengine use: /usr/local/tengine/sbin/nginx -c /usr/local/tengine/conf/nginx.conf #### \033[0m"