注意:前提已经安装好Oracle8.0的JDK
1、从官方网站找到Tomcat8,下载安装包;
http://tomcat.apache.org/download-80.cgi
找到安装包后,下载相应版本的Tomcat,本文下载的是8.0版本
2、然后进入Centos,进行如下操作:
# cd /usr/local
# wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.8/bin/apache-tomcat-8.5.8.tar.gz
# tar -zvxf apache-tomcat-8.5.8.tar.gz
# mv apache-tomcat-8.5.8 tomcat
3、修改/usr/local/tomcat/conf/tomcat-users.xml,在后面加上
内容如下:
<role rolename="manager"/>
<role rolename="manager-gui"/>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="admin,manager,manager-gui"/>
4、同时还需要进入/usr/local/tomcat/conf/Catalina/localhost/中查看有无manager.xml这个文件,没有的话新建一个,添加如下内容:
内容如下:
<Context privileged="true" antiResourceLocking="false"
docBase="${catalina.home}/webapps/manager">
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" />
</Context>
5、运行Tomcat
# cd /usr/local/tomcat/bin
# ./startup.sh
显示如下内容,表示tomcat已经启动;
Using CATALINA_BASE: /usr/local/tomcat
Using CATALINA_HOME: /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JRE_HOME: /usr/java/jre1.8.0_111
Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar
Tomcat started.
或者输入
# ./catalina.sh run
6、通过本机输入IP
http://192.168.239.130:8080