jdk-tomcat-jk 自动安装

#!/bin/bash
#####################jdk install##############################
echo "do you sure install jdk[y|n]:"
read jdk
if [ ${jdk} == "y" ] ;
then 
touch a
echo 'yes' > a
JDKPATH=./jdk-6u17-linux-i586-rpm.bin
if [ -x "$JDKPATH" ] ; then
   echo "JDK setup file can execute"
else
   chmod u+x $JDKPATH
fi
$JDKPATH < a
rm -rf a
#mkdir /usr/java
#mv jdk1.6.0_17/ /usr/java/
cp /etc/profile /etc/profile.bak
echo "export JAVA_HOME=/usr/java/jdk1.6.0_17" >> /etc/profile
echo "export JRE_HOME=\$JAVA_HOME/jre" >> /etc/profile
echo "export CLASSPATH=.:\$JAVA_HOME/lib:\$JRE_HOME/lib:\$CLASSPATH" >> /etc/profile
echo "export PATH=\$JAVA_HOME/bin:\$JRE_HOME/bin:\$PATH" >> /etc/profile
source /etc/profile
java -version
if  [ "$?" != 0 ] ;
        then
        echo "I cann't set java path."
        exit 0
        fi
fi
#####################jdk install finish#############################
#####################tomcat install #################################
echo  "do you sure install tomcat[y|n]:"
read tom
if [ ${tom} == "y" ] ;
then
tar -zxvf apache-tomcat-6.0.26.tar.gz
mv apache-tomcat-6.0.26   /opt/tomcat6
echo "export TOMCAT_HOME=/opt/tomcat6" >> /etc/profile
echo "PATH=\$TOMCAT_HOME/bin:\$PATH"  >> /etc/profile
source /etc/profile
/opt/tomcat6/bin/startup.sh
sleep 5
curl  127.0.0.1:8080  |grep   "Thanks for using Tomcat"
if  [ "$?" != 0 ] ;
        then
        echo "I think install tomcat is unfinished"
        exit 0
        fi
fi
####################tomcat install FINISH ###########################
echo "do you sure install httpd[y|n]:"
read htt
if [ ${htt} == "y" ] ;
then
tar zxvf  apr-1.3.9.tar.gz
cd apr-1.3.9
./configure && make  && make install
cd ..
tar zxvf apr-util-1.3.9.tar.gz
cd apr-util-1.3.9
./configure --with-apr=/usr/local/apr && make && make install
cd ..
tar zxvf  httpd-*.tar.gz
cd httpd-*
./configure --prefix=/usr/local/apache2 --enable-dav --enable-so --enable-maintainer-mode --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config --enable-modules --with-mpm=worker && make && make install
if  [ "$?" != 0 ] ;
        then
        echo "I cann't install apache ."
        exit 0
        fi
############Check default website.
cd ..
/usr/local/apache2/bin/apachectl start
curl    127.0.0.1|grep "It works"
if  [ "$?" != 0 ] ;
        then
        echo "I cann't read default website ."
        exit 0
        fi

fi
####################httpd install finish###########################

####################jk install and seting ###########################
echo "do you sure install jk[y|n]:"
read jk
if [ ${jk} == "y" ] ;
then
tar xzvf jakarta-tomcat-connectors-1.2.15-src.tar.tar
cd jakarta-tomcat-connectors-1.2.15-src/jk/native
 ./configure --with-apxs=/usr/local/apache2/bin/apxs && make
cp ./apache-2.0/mod_jk.so /usr/local/apache2/modules/
cp ../conf/workers.properties /usr/local/apache2/conf/
cat >> /usr/local/apache2/conf/httpd.conf << DDE
LoadModule jk_module modules/mod_jk.so
JkWorkersFile /usr/local/apache2/conf/workers.properties
JkLogFile     /usr/local/apache2/mod_jk.log
JkLogLevel    info
ServerAdmin localhost
#DocumentRoot /opt/tomcat6/webapps
<Directory "/opt/tomcat6/webapps">
    Options Includes FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
    XBitHack on
</Directory>
<Directory "/opt/tomcat6/webapps/WEB-INF">
    Order deny,allow
    Deny from all
</Directory>
DirectoryIndex index.html index.htm index.jsp
ErrorLog logs/shsc-error_log.txt
CustomLog logs/shsc-access_log.txt common
JkMount /servlet/* lbcontroller
JkMount /*.jsp lbcontroller
JkMount /*.do lbcontroller
JkMount /*  lbcontroller
HostnameLookups Off
MaxKeepAliveRequests 500
DDE
cat >>/usr/local/apache2/conf/workers.properties<< FMF
workers.tomcat_home=/opt/tomcat6
workers.java_home=/usr/java/jdk1.6.0_17
worker.list=lbcontroller
#Tomcat1实例配置 这里要和Tomcat配置文件Service.xml的jvmRoute保持一致
worker.tomcat1.host=192.168.2.30
worker.tomcat1.port=8009
worker.tomcat1.type=ajp13
#分发权重,值越大负载越大
worker.tomcat1.lbfactor = 1

#Tomcat2实例配置
worker.tomcat2.host=192.168.2.31
worker.tomcat2.port=9009
worker.tomcat2.type=ajp13
#分发权重 值越大负载越大
worker.tomcat2.lbfactor = 1
#负载均衡分发控制器
worker.lbcontroller.type=lb
worker.lbcontroller.balance_workers=tomcat1,tomcat2
worker.lbcontroller.sticky_session=0
worker.lbcontroller.sticky_session_force=0

<IfModule worker.c>
ServerLimit 25
ThreadLimit 200
StartServers 3
MaxClients 2000
MinSpareThreads 50
MaxSpareThreads 200
ThreadsPerChild 100
MaxRequestsPerChild 0
</IfModule>
FMF
sed -e  's/defaultHost="localhost" /defaultHost="localhost" jvmRoute="ajp13">/' /opt/tomcat6/conf/server.xml
/usr/local/apache2/bin/apachectl restart
cd ../../..
fi
################################ PHP ###################################
echo "do you sure install PHP[y|n]:"
read php
if [ ${php} == "y" ] ;
then 
tar zxvf php-5.2.13.tar.gz
cd php-5.2.13
./configure --prefix=/usr/local/php5 --with-curl=/usr/local/curl --with-apxs2=/usr/local/apache2/bin/apxs --with-zlib-dir --with-bz2 --with-tiff-dir --with-libxml-dir --with-gd --with-freetype-dir --with-jpeg-dir --with-png-dir --with-ttf --enable-mbstring --with-mysql=/usr/lib/mysql  --with-config-file-path=/etc --disable-ipv6 --enable-gd-native-ttf --enable-libxml --enable-xml && make && make install
echo "AddType application/x-httpd-php .php" >> /usr/local/apache/conf/httpd.conf
echo "AddType application/x-httpd-php-source .phps" >> /usr/local/apache/conf/httpd.conf
chcon -t textrel_shlib_t  /usr/local/apache2/modules/libphp5.so
########################  memcache 安装  #################################

tar zxvf  memcache-2.2.5.tgz
/usr/local/php5/bin/phpize
./configure --enable-memcache --with-php-config=/usr/local/php5/bin/php-config  --with-zlib-dir
Make
Make install
echo "extension_dir = '/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/'" >>/etc/php.ini
echo extension=memcache.so  >> /etc/php.ini
fi

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值