cd /usr/local/srcwget http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html ##需要进去,点介绍协议,下载jdk8tar zxvf jdk-8u144-linux-x64.tar.gzmv jdk1.8.0_144/ /usr/local/jdk8.0vim /etc/profileJAVA_HOME=/usr/local/jdk8.0JAVA_BIN=/usr/local/jdk8.0/binPATH=$PATH:$JAVA_BINCLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport JAVA_HOME JAVA_BIN PATH CLASSPATH export CATALINA_BASE=/usr/local/tomcatexport CATALINA_HOME=/usr/local/tomcatsource /etc/profilecd /usr/local/src/wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.23/bin/apache-tomcat-8.5.23.tar.gz tar zxvf apache-tomcat-8.5.23.tar.gzmv apache-tomcat-8.5.23 /usr/local/tomcat8.5ln -s /usr/local/tomcat8.5/ /usr/local/tomcatcd /usr/local/tomcat/bin/echo "CATALINA_HOME=/usr/local/tomcat8.5/" >> catalina.shchmod +x *.sh./startup.sh
启动慢修改如下:
在catalina.sh中加入这么一行:
JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom"
打开$JAVA_PATH/jre/lib/security/java.security这个文件,找到下面的内容:
securerandom.source=file:/dev/urandom
替换成
securerandom.source=file:/dev/./urandom
想登陆管理页面,操作如下:
conf/Catalina/localhost/下创建 manager.xml , 填入如下内容
添加用户 conf/tomcat-users.xml 中的 标签内添加如下代码:
host-manager 还是 403 错误 解决办法 允许所有IP访问
vim /usr/local/tomcat/webapps/host-manager/META-INF/context.xml#修改这里
修改成80
vim conf/server.xml
69 <Connector port="80" protocol="HTTP/1.1"
70 connectionTimeout="20000"
71 redirectPort="8443" />
修改默认网页路径
vim conf/server.xml
148 <Host name="localhost" appBase="webapps"
149 unpackWARs="true" autoDeploy="true">
164 <Context path="" docBase="/usr/local/tomcat/webapps/shyt/" debug="0"/> ###加入此行, docBase就是你要访问的路径
165 </Host>
修改默认首页文件
vim conf/web.xml
4693 <welcome-file-list>
4694 <welcome-file>index.html</welcome-file>
4695 <welcome-file>index.htm</welcome-file>
4696 <welcome-file>index.jsp</welcome-file>
4697 </welcome-file-list>