-
1. 安装jdk
找到想要安装的jdk版本
安装jdkyum -y list java*
yum install java-1.8.0-openjdk.x86_64
-
2. 安装tomcat
选择安装目录
下载最新的tomcatcd /data
解压wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.0.M21/bin/apache-tomcat-9.0.0.M21.tar.gz
删除安装包tar -zxvf pache-tomcat-9.0.0.M21.tar.gz
rm -rf apache-tomcat-9.0.0.M21.tar.gz
-
3. 优化tomcat配置
更改server.xml
server.xml配置参考如下vim apache-tomcat-9.0.0.M21/conf/server.xml
更改catalina.sh<Connector port="8080" protocol="HTTP/1.1" URIEncoding="UTF-8" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" connectionTimeout="20000" acceptCount="300" maxThreads="300" maxProcessors="1000" minProcessors="5" useURIValidationHack="false" compression="on" compressionMinSize="2048" compressableMimeType="text/html,text/xml,text/JavaScript,text/css,text/plain" redirectPort="8443" />
内存设置验证vim apache-tomcat-9.0.0.M21/bin/catalina.sh
添加配置参考如下java -Xmx6000M -version
export JAVA_OPTS="-server -Xms6000M -Xmx6000M -Xmn2048M -Xss512k -XX:+AggressiveOpts -XX:+UseBiasedLocking -XX:+DisableExplicitGC -XX:MaxTenuringThreshold=15 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -Djava.awt.headless=true"
-
4. 启动tomcat
apache-tomcat-9.0.0.M21/bin/startup.sh
网友评论