1. Install JRE http://www.oracle.com/technetwork/java/javase/Download the tar package for the JRE
TAR-ZXVF Jre-1.x.tar
2. Setting Environment variables
Vim/etc/profile
Jre_home=/data/jre
Path= $PATH: $JRE _home/bin
classpath=./$JRE _home/lib/dt.jar: $JRE _home/lib/tools.jar
Catalina_home=/data/tomcat
Export Jre_home PATH CLASSPATH
3. Make Environment variables effective
Source/etc/profile
4. Install Tomcat download http://archive.apache.org/dist/tomcat/tomcat-8/
TAR-ZXVF Tomcat-x.x.tar
5. Install Apr download http://apr.apache.org/
wget http://mirrors.hust.edu.cn/apache/apr/apr-1.5.2.tar.gz
TAR-ZXVF apr-1.5.2.tar.gz
CD apr-1.5.2
./configure--PREFIX=/USR/LOCAL/APR
Make && make install
wget http://apache.fayea.com//apr/apr-iconv-1.2.1.tar.gz
TAR-ZXVF apr-iconv-1.2.1.tar.gz
CD apr-iconv-1.2.1
./configure--prefix=/usr/local/apr-iconv--WITH-APR=/USR/LOCAL/APR
Make && make install
wget http://apache.fayea.com//apr/apr-util-1.5.4.tar.gz
TAR-ZXVF apr-util-1.5.4.tar.gz
CD apr-util-1.5.4
./configure--prefix=/usr/local/apr-util--WITH-APR=/USR/LOCAL/APR--with-apr-iconv=/usr/local/apr-iconv/bin/ Apriconv
Make && make install
wget http://apache.dataguru.cn/tomcat/tomcat-connectors/native/1.1.33/source/tomcat-native-1.1.33-src.tar.gz
TAR-ZXVF tomcat-native-1.1.33-src.tar.gz
CD tomcat-native-1.1.33-src/jni/native
wget http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz
TAR-ZXVF jdk-8u45-linux-x64.tar.gz
MV Jdk-8u45-linux-x64.tar.gz JDK
./configure--WITH-APR=/USR/LOCAL/APR--WITH-JAVA-HOME=/DATA/JDK
Make && make install
6. Set the APR environment variable
Vim/etc/profile
Export Ld_library_path=/usr/local/apr/lib
Source/etc/profile
7. Verify APR successfully configured
sh/data/tomcat/bin/start.sh
More/data/tomcat/logs/catalina.out
See a message like this
Jul 00:27:32 PM org.apache.catalina.core.AprLifecycleListener initinfo:loaded APR based Apache Tomcat Native Lib Rary 1.1.30. That is the success
8. Configure the number of Tomcat connections
<connector port= "8080" protocol= "Org.apache.coyote.http11.Http11NioProtocol"
connectiontimeout= "20000"
Redirectport= "8443" enablelookups= "false" uriencoding= "UTF-8" acceptcount= "$" executor= "Tomcatthreadpool" nameprefix= "catalina-exec-" maxthreads= "minsparethreads="/>
Protocol= "Org.apache.coyote.http11.Http11NioProtocol" modified to support NIO type
maxthreads= "600"//maximum number of threads
minsparethreads= "100"//number of threads created at initialization
maxsparethreads= "500"//Once the thread exceeds this value, Tomcat shuts down the unwanted socket thread
Acceptcount= "700"//Specifies the number of requests that can be placed in the processing queue when all the threads that can be used to process the request are used, and requests that exceed this number will not be processed
Enablelookups= "false" disables DNS queries
uriencoding= "UTF-8" setting encoding
CentOS deployment Tomcat is optimized with Apr mode