apache - resin安装脚本
resin安装脚本
2004-04-23 15:18 pm来自:Linux文档
现载:Www.8s8s.coM
地址:无名
# time: 2003-01-18
# place: /usr/src of redhat 8.0
# people: qiong.wei
# 4 basic packages:
# apache_1.3.27.tar.gz
# mysql-4.0.7-gamma.tar.gz
# j2sdk-1_4_0_03-fcs-linux-i586.rpm.bin
# resin-2.1.6.tar.gz
# 确保所有文件属性为可执行的
#
#-----------------------------------------------------------------
# Part01 install apache
#-----------------------------------------------------------------
cd /usr/src
tar xvfz apache_1.3.27.tar.gz
cd apache_1.3.27
./configure --enable-module=most --enable-shared=max
make
make install
#-----------------------------------------------------------------
# Part02 configure apache
#-----------------------------------------------------------------
cd /etc/rc.d
cp /usr/local/apache/bin/apachectl init.d/apache
ln -s ../init.d/apache rc0.d/K02apache
ln -s ../init.d/apache rc1.d/K02apache
ln -s ../init.d/apache rc2.d/K02apache
ln -s ../init.d/apache rc3.d/S98apache
ln -s ../init.d/apache rc4.d/S98apache
ln -s ../init.d/apache rc5.d/S98apache
ln -s ../init.d/apache rc6.d/K02apache
#-----------------------------------------------------------------
# Part03 install mysql
#-----------------------------------------------------------------
cd /usr/src
tar xvfz mysql-4.0.7-gamma.tar.gz
cd mysql-4.0.7-gamma
./configure --prefix=/usr/local/mysql --enable-thread-safe-client
make
make install
scripts/mysql_install_db
#-----------------------------------------------------------------
# Part04 configure mysql
#-----------------------------------------------------------------
groupadd mysql
useradd -g mysql mysql
chown -R root /usr/local/mysql
chown -R mysql /usr/local/mysql/var
chgrp -R mysql /usr/local/mysql
cp support-files/my-medium.cnf /etc/my.cnf
cd /etc/rc.d
cp /usr/local/mysql/share/mysql/mysql.server init.d/mysql
ln -s ../init.d/mysql rc0.d/K10mysql
ln -s ../init.d/mysql rc1.d/K10mysql
ln -s ../init.d/mysql rc2.d/K10mysql
ln -s ../init.d/mysql rc3.d/S90mysql
ln -s ../init.d/mysql rc4.d/S90mysql
ln -s ../init.d/mysql rc5.d/S90mysql
ln -s ../init.d/mysql rc6.d/K10mysql
#-----------------------------------------------------------------
# Part05 install j2sdk
#-----------------------------------------------------------------
cd /usr/src
./j2sdk-1_4_0_06-fcs-linux-i586.rpm.bin
rpm -ivh j2sdk-1_4_0_06-fcs-linux-i586.rpm
#-----------------------------------------------------------------
# Part06 set global variable
#-----------------------------------------------------------------
echo 'export JAVA_HOME=/usr/java/j2sdk1.4.0_03' >> /etc/profile
echo 'export RESIN_HOME=/usr/local/resin' >> /etc/profile
echo 'export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib' >> /etc/profile
echo 'export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:/usr/local/mysql/bin:/usr/local/apache/bin:/usr/local/resin/bin'>> /etc/profile
reboot
#-----------------------------------------------------------------
# Part07 install resin
#-----------------------------------------------------------------
cd /usr/src
tar xvfz resin-2.1.6.tar.gz -C /usr/local
cd /usr/local
mv resin-2.1.6 resin
cd resin
./configure -with-apache=/usr/local/apache
make
make install
#-----------------------------------------------------------------
# Part08 configure resin
#-----------------------------------------------------------------
cd /usr/local/resin/conf
sed 's#<doc-dir>doc#<doc-dir>/usr/local/apache/htdocs#' resin.conf > resin.bak
mv -f resin.bak resin.conf
cd /usr/local/apache/conf
sed 's/AddModule mod_caucho.c/#&/' httpd.conf > httpd.bak
mv -f httpd.bak httpd.conf
echo "<IfModule mod_caucho.c>" >> httpd.conf
echo "CauchoConfigFile /usr/local/resin/conf/resin.conf" >> httpd.conf
echo "</IfModule>" >> httpd.conf
cd /etc/rc.d/init.d
cp /usr/local/resin/contrib/init.resin resin
chkconfig resin reset
sed 's/ fi/&
sleep 15/' resin > resin.bak
sed 's#JAVA_HOME=/usr/java#JAVA_HOME=/usr/java/j2sdk1.4.0#' resin.bak > resin
chmod +x resin
#-----------------------------------------------------------------
# Part9 prepare jsp script
#-----------------------------------------------------------------
echo '<%@page language="java"%>' > /usr/local/apache/htdocs/test.jsp
echo '2+2=<%=2+2%>' >> /usr/local/apache/htdocs/test.jsp
#-----------------------------------------------------------------
# Part10 test & over
#-----------------------------------------------------------------
# open http://ip/test.jsp in browser, see 2+2=4