参考资料:
http://www.iteye.com/topic/757125
http://www.cnblogs.com/leader_89/archive/2011/08/01/2109181.html
1. rpm -i jdk-7u2-linux-x64.rpm
2. vi /etc/bash.bashrc
3. JAVA_HOME=/usr/java/default
CLASSPATH=/usr/java/default/lib:/usr/local/default/jre/lib
4. tar zxvf apache-tomcat-7.0.25.tar.gz
5. mv apache-tomcat-7.0.25 /usr/local
6. cd /usr/local; ln -s apache-tomcat-7.0.25 tomcat
7. vi /etc/bash.bashrc
CATALINA_HOME=/usr/local/tomcat
8. tar zxvf commons-daemon-native.tar.gz
cd commons-daemon-1.0.8-native-src/unix
./configure –with-java=/usr/java/default/
make
cp jsvc ../../
cd ../../
9. tar jxvf httpd-2.2.21.tar.bz2
10. cd httpd-2.2.21/
11.
CC=”gcc” CFLAGS=”-O2″ \
./configure –prefix=/usr/local/httpd22 –enable-proxy –enable-proxy-ajp –enable-proxy-balancer –enable-expires\
–enable-headers –disable-asis –disable-auth –disable-autoindex –disable-userdir –enable-rewrite \
–disable-cgi –disable-cgid –disable-access –enable-charset-lite –enable-deflate
12. make;make install;cd /usr/local/;mv httpd22/ apache-httpd-2.2.21;ln -s apache-httpd-2.2.21/ httpd22
diff /usr/local/httpd22/conf/httpd.conf /usr/local/httpd22/conf/httpd.conf.org
166c166
< DirectoryIndex index.html index.shtml
---
> DirectoryIndex index.html
329,330c329,330
< AddType text/html .shtml
< AddOutputFilter INCLUDES .shtml
---
> #AddType text/html .shtml
> #AddOutputFilter INCLUDES .shtml
376c376
< Include conf/extra/httpd-mpm.conf
---
> #Include conf/extra/httpd-mpm.conf
394c394
< Include conf/extra/httpd-vhosts.conf
---
> #Include conf/extra/httpd-vhosts.conf
403c403
< Include conf/extra/httpd-default.conf
---
> #Include conf/extra/httpd-default.conf
13. cd $CATALINA_HOME/bin
14. tar zxvf tomcat-native.tar.gz
15. cd tomcat-native-1.1.22-src/jni/native
16. ./configure –with-apr=/usr/local/httpd22/bin/apr-1-config –with-java-home=/usr/java/default –prefix=$CATALINA_HOME
17. make;make install
18. vi /etc/ld.so.conf
19. add /usr/local/tomcat/lib in it
20. export LD_LIBRARY_PATH=/usr/local/tomcat/lib; cd $CATALINA_HOME/bin;./catalina.sh run
看到下面2行说明 native库已安装好
2010-8-22 1:44:50 org.apache.catalina.core.AprLifecycleListener init
信息: Loaded APR based Apache Tomcat Native library 1.1.20.
2010-8-22 1:44:50 org.apache.catalina.core.AprLifecycleListener init
信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
21. cp /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat
22. diff tomcat /usr/local/tomcat/bin/catalina.sh
2,11d1
< ### BEGIN INIT INFO
< # Provides: tomcat
< # Required-Start: $syslog $remote_fs
< # Required-Stop: $syslog $remote_fs
< # Default-Start: 3 5
< # Default-Stop: 0 1 2 6
< # Description: java servlet container
< # Short-Description: tomcat
< ### END INIT INFO
<
110,115d99
< #add by hunter
< CATALINA_HOME=/usr/local/tomcat
< JAVA_HOME=/usr/java/default
< LD_LIBRARY_PATH=/usr/local/tomcat/lib
<
<
23. cp /usr/local/httpd22/bin/apachectl /etc/init.d/httpd
diff httpd /usr/local/httpd22/bin/apachectl
2,10d1
< ### BEGIN INIT INFO
< # Provides: httpd
< # Required-Start: $syslog $remote_fs
< # Required-Stop: $syslog $remote_fs
< # Default-Start: 3 5
< # Default-Stop: 0 1 2 6
< # Description: apache httpd
< # Short-Description: httpd
< ### END INIT INFO
24. chkconfig -add httpd
25. chkconfig -add tomcat
30. build mysql
CC=gcc CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
-fno-exceptions -fno-rtti" ./configure \
--prefix=/usr/local/mysql --enable-assembler \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static \
--localstatedir=/data/mysql --without-debug \
--enable-thread-safe-client --without-docs \
--with-big-tables --enable-local-infile --enable-shared \
--with-charset=utf8 --with-extra-charsets=gbk,gb2312,latin1
make
make install
cd /usr/local/mysql
useradd mysql
chown -R mysql:root /usr/local/mysql/
bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
cp share/mysql/my-medium.cnf /etc/my.cnf
bin/mysqld_safe --user=mysql &
31. my.cnf
wait-timeout = 5
max_connections = 256
max_connect_errors = 10000000
thread_concurrency = 4 (cpu* 2)