分类: 系统运维
2013-04-18 10:34:47
一、系统关闭不需要的服务:
#vi init.sh
#disable ipv6
echo "alias net-pf-10 off" >> /etc/modprobe.conf
echo "alias ipv6 off" >> /etc/modprobe.conf
/sbin/chkconfig --level 35 ip6tables off
echo "ipv6 is disabled!"
#disable selinux
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
echo "selinux is disabled,you must reboot!"
#vim
sed -i "8 s/^/alias vi='vim'/" /root/.bashrc
echo 'syntax on' > /root/.vimrc
#zh_cn
sed -i -e 's/^LANG=.*/LANG="zh_CN.GB18030"/' /etc/sysconfig/i18n
#tunoff services
for i in `ls /etc/rc3.d/S*`
do
CURSRV=`echo $i|cut -c 15-`
echo $CURSRV
case $CURSRV in
crond | irqbalance | microcode_ctl | network | random | sendmail | sshd | syslog | local | mysqld )
echo "Base services, Skip!"
;;
*)
echo "change $CURSRV to off"
chkconfig --level 235 $CURSRV off
service $CURSRV stop
;;
esac
done
二、安装系统必须的包
#yum -y install ntp vim-enhanced gcc gcc-c++ gcc-g77 flex bison autoconf automake glibc glibc-devel lib2
glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libtool* zlib-devel libxml2-devel libjpeg-devel ibpng-devel
libtiff-devel fontconfig-devel freetype-devel libXpm-devel gettext-devel curl curl-devel pam-devel 2fsprogs-devel
krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
三、需要的软件:
三、安装apache
#vi init.sh
./configure \
"--prefix=/usr/local/apache2" \
"--with-included-apr" \
"--enable-so" \
"--enable-deflate=shared" \
"--enable-expires=shared" \
"--enable-rewrite=shared" \
"--enable-static-support" \
"--disable-userdir"
make
make install
echo '/usr/local/apache2/bin/httpd -k start ' >> /etc/rc.local
四、安装jdk
#chmod u+x jdk-6u10-rc-bin-b28-linux-i586-21_jul_2008-rpm.bin
#./jdk-6u10-rc-bin-b28-linux-i586-21_jul_2008-rpm.bin
一路回车安装就会自动安装好
五、安装tomcat
#tar zvxf apache-tomcat-6.0.18.tar.gz
#mv apache-tomcat-6.0.18 tomcat
六、安装jk
#tar zvxf tomcat-connectors-1.2.28-src.tar.gz
#cd tomcat-connectors-1.2.28-src/native/
#./configure --with-apxs=/usr/local/apache2/bin/apxs && make && make install
到apache的modules下面看看有没有mod_jk.so模块
七、配置apache支持jk模块
#vi /usr/local/apache2/conf/httpd.conf
LoadModule jk_module modules/mod_jk.so
……
Include conf/extra/mod_jk.conf
#vi /usr/local/apache2/conf/extra/mod_jk.conf
JkWorkersFile conf/extra/workers.properties
JkLogFile logs/mod_jk.log
JkShmFile logs/jk-runtime-status
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
#Sample JkMounts. Replace these with the paths you would
#like to mount from your JSP server.
#syntax: JkMount ${URL_DIR}/*.jsp worker_name
JkMount /images/avatar/* worker1
JkMount /*.jsp worker1
JkMount /*.page worker1
JkMount /*.cic worker1
JkMount /func/* worker1
JkMount /assets/* worker1
JkMount /remote/* worker1
JkMount /services/* worker1
JkMount /homebase/* worker1
JkMount /skin/* worker1
JkMount /error/* worker1
JkMount /lib/* worker1
JkMount /protected/* worker1
JkMount /rounded/* worker1
JkMount /FormOverLogin* worker1
JkMount /fckeditor/editor/filemanager/connectors/* worker1
JkMount /upload/image/* worker1
# vi /usr/local/apache2/conf/extra/workers.properties
worker.list=worker1
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
worker.woker1.lbfactor=1
八、修改tomcat跟apache知道让web指向同一个目录
#vi /usr/local/tomcat/conf/server.xml
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
#vi /usr/local/apache2/conf/httpd.conf
DocumentRoot "/usr/local/apache2/htdocs"
九、启动测试
#/usr/local/apache2/bin/apachectl start
#sh /usr/local/tomcat/bin/startup.sh
#vi /data/www/wwwroot/index.html
html页面测试
#vi /data/www/wwwroot/index.jsp
<%
Html:
Jsp:
遇到问题:
apache不能设置虚拟主机,不设置虚拟主机tomcat可以正常解析jsp文件,设置虚拟主机就不能解析,具体原因还没找到
out.print("jsp页面测试");
%>