1.从官网中下载apache-tomcat-**.tar.gz文件
2.在本地文件新建一个文件夹(tomcat),在文件夹中解压压缩包, 不需要使用root:
tar -zxvf /home/xcx/下载/apache-tomcat-8.5.11.tar.gz
3.进入解压文件中使用命令,将tomcat中的文件全部设置添加读写权限:
chmod +xr -R *
4. 进入tomcat的conf文件夹下,找到tomcat-users.xml 配置文件,在里面添加用户信息
<role rolename="manager-gui"/> <user username="admin" password="3.1415926" roles="manager-gui"/>
5.启用tomcat:
xcx@ubuntu-xcx:~/local/tomcat/apache-tomcat-8.5.11$ ./bin/startup.sh Using CATALINA_BASE: /home/xcx/local/tomcat/apache-tomcat-8.5.11 Using CATALINA_HOME: /home/xcx/local/tomcat/apache-tomcat-8.5.11 Using CATALINA_TMPDIR: /home/xcx/local/tomcat/apache-tomcat-8.5.11/temp Using JRE_HOME: /usr/lib/jvm/java-8-oracle Using CLASSPATH: /home/xcx/local/tomcat/apache-tomcat-8.5.11/bin/bootstrap.jar:/home/xcx/local/tomcat/apache-tomcat-8.5.11/bin/tomcat-juli.jar Tomcat started.
6. 关闭tomcat:
xcx@ubuntu-xcx:~/local/tomcat/apache-tomcat-8.5.11$ ./bin/shutdown.sh Using CATALINA_BASE: /home/xcx/local/tomcat/apache-tomcat-8.5.11 Using CATALINA_HOME: /home/xcx/local/tomcat/apache-tomcat-8.5.11 Using CATALINA_TMPDIR: /home/xcx/local/tomcat/apache-tomcat-8.5.11/temp Using JRE_HOME: /usr/lib/jvm/java-8-oracle Using CLASSPATH: /home/xcx/local/tomcat/apache-tomcat-8.5.11/bin/bootstrap.jar:/home/xcx/local/tomcat/apache-tomcat-8.5.11/bin/tomcat-juli.jar