cd /usr/local/src
wget http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 
##需要进去,点介绍协议,下载jdk8


tar zxvf jdk-8u144-linux-x64.tar.gz
mv jdk1.8.0_144/   /usr/local/jdk8.0


vim /etc/profile



JAVA_HOME=/usr/local/jdk8.0
JAVA_BIN=/usr/local/jdk8.0/bin
PATH=$PATH:$JAVA_BIN
CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH        
export CATALINA_BASE=/usr/local/tomcat
export CATALINA_HOME=/usr/local/tomcat



source /etc/profile






cd /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.gz
mv apache-tomcat-8.5.23  /usr/local/tomcat8.5


ln -s /usr/local/tomcat8.5/ /usr/local/tomcat
cd /usr/local/tomcat/bin/
echo "CATALINA_HOME=/usr/local/tomcat8.5/"  >> catalina.sh
chmod +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     

70                connectionTimeout="20000"

71                redirectPort="8443" />


修改默认网页路径

vim conf/server.xml

148       

149             unpackWARs="true" autoDeploy="true">

164   ###加入此行, docBase就是你要访问的路径

165       

修改默认首页文件

vim conf/web.xml        

4693     

4694         index.html

4695         index.htm

4696         index.jsp

4697