>centos5.4 x86 最小化安装
源码目录 :/usr/src #tomcat我就放在这安装目录 :/usr/local
关闭selinux ,重启生效。
#sed -i 's/enforcing/disabled/g' /etc/selinux/config
#reboot
#yum -y install gcc gcc-c++ ncurses* zlib*
https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewFilteredProducts-SingleVariationTypeFilter 可以到这里下载jdk
我下的是这个 jdk-6u21-linux-i586-rpm.bin
#chmod u+x jdk-*
#./jdk*
等待,最后会提示你摁 enter ,done。
默认是装在 /usr/java/jdk1.6.0_21下
设置环境变量
#vim /etc/profile #添加到末尾
export JAVA_HOME=/usr/java/jdk1.6.0_21
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin
#source /etc/profile
马上生效
#java -version
查看版本。
mysql
#wget http://down1.chinaunix.net/distfiles/mysql-5.0.75.tar.gz
#tar zxvf mysql-5.0.75.tar.gz
#cd mysql*
#./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charsets=all
#make && make install
groupadd mysql
useradd -g mysql mysql
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
chown -R mysql.mysql /usr/local/mysql
/usr/local/mysql/bin/mysql_install_db --user=mysql
chown -R mysql.mysql /usr/local/mysql/var
/usr/local/mysql/bin/mysqld_safe --user=mysql &
apache
#wget http://labs.renren.com/apache-mirror//httpd/httpd-2.2.17.tar.bz2
#tar jxv -f httpd-2.2.17.tar.bz2
#cd httpd*/srclib/apr
#./configure --prefix=/usr/loca/apr && make && make install
#cd ../apr-util
#./configure --prefix=/usr/local/apr-util --with-apr=/usr/loca/apr
#make && make install
#cd ../..#./configure --prefix=/usr/local/apache --enable-mods-shared=all --with-mpm=worker --enable-deflate --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-proxy --enable-proxy-ajp --enable-proxy-balancer --enable-proxy-http --enable-rewrite --enable-charset-lite --disable-ipv6 --disable-dav --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-uti
#make && make install
tomcat
#wget http://labs.renren.com/apache-mi ... omcat-6.0.32.tar.gz
#tar zxvf apache-tomcat*
#mv apache-tomcat* tomcat
#vim tomcat/bin/setenv.sh 没有就新建
JAVA_HOME=/usr/java/jdk1.6.0_21
KRE_HOME=/usr/java/jdk1.6.0_21/jre
#sh /usr/src/tomcat/bin/startup.sh
浏览器访问 http://localhost:8080
整合篇 方法一
#wget http://archive.apache.org/dist/t ... s-1.2.30-src.tar.gz
#tar zxvf tomcat-*
#cd tomcat-*/native
#./configure --with-apxs=/usr/local/apache/bin/apxs
#make && make install
到apache的modules下面看看有没有mod_jk.so模块
配置apache支持jk模块
#vim /usr/local/apache/conf/httpd.conf
添加 index.jsp
DirectoryIndex index.jsp index.html
LoadModule jk_module modules/mod_jk.so…
Include conf/extra/mod_jk.conf
#vim /usr/local/apache/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
#vim /usr/local/apache/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指向同一个目录
#vim /usr/src/tomcat/conf/server.xml
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
#/usr/local/apache/bin/apachectl restart
# /usr/local/tomcat/bin/shutdown.sh
#/usr/local/tomcat/bin/startup.sh
测试页面
#vim /usr/local/apache/htdocs/index.jsp
out.print("jsp页面测试");
%
访问 localhost
完毕!
整合篇,方法二。
在 /usr/local/apache/conf/httpd.conf 末尾加入 :
BalancerMember ajp://localhost:8009
RewriteEngine On
ProxyPreserveHost On
RewriteRule ^/$ balancer://localCluster/ [P,L,NC]
RewriteRule ^/(.*)$ balancer://localCluster/$1 [P,L,NC]
修改tomcat跟apache知道让web指向同一个目录
#vim /usr/local/tomcat/conf/server.xml
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
新建测试页
vi /usr/local/apache/htdocs/index.jsp
JSP Test Page
%>
重启apache和tomcat,
然后直接访问 http://localhost