安装tomcat服务器必须要有jdk的支持,安装jdk的步骤:https://blog.csdn.net/wlh525/article/details/98638418
一、官网下载
1、官网地址:http://tomcat.apache.org/
下载:apache-tomcat-8.5.41.tar.gz
找到相应的版本之后点击,在出现的页面中选择bin,即可下载相应的版本
2、下载之后使用rz命令上传到虚拟机中的linux主机中
# cd /opt/program # 前提是你已经建立了program这个目录
# mkdir tomcat
# cd tomcat
# rz
# ls # 查看
3、解压
# tar -zxvf apache-tomcat-8.5.41.tar.gz
4、tomcat 默认端口是8080,要想浏览器可以访问必须得打开防火墙的8080端口
# firewall-cmd --add-port=8080/tcp #开启端口
# firewall-cmd --list-ports #查看打开的端口
5、启动tomcat
# cd /opt/program/tomcat/apache-tomcat-8.5.41/bin/
# ./startup.sh
6、页面输入:http://192.168.148.131:8080即可访问(IP地址为linux主机的IP地址)
默认打开的页面为/opt/program/tomcat/apache-tomcat-8.5.41/webapps/ROOT下的文件,我们看到的欢迎页面实际上是在安装路径/opt/program/tomcat/apache-tomcat-8.5.41/conf/web.xml里指定的,在这三行里从上往下扫描,因为/opt/program/tomcat/apache-tomcat-8.5.41/webapps/ROOT不存在index.html文件,所以我们看到的欢迎界面其实是index.jsp
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>