1.去官网下载Tomcat
https://tomcat.apache.org/download-80.cgi
下载apache-tomcat-8.5.63.tar.gz
通过xftp将tomcat上传到服务器上,这里还是上传到/home自己创建的目录下
2.解压文件
[root@VM-0-16-centos hxl]# tar -zxvf apache-tomcat-8.5.63.tar.gz
解压后就会出现一个蓝色的目录
3.启动Tomcat测试!
进入bin目录
[root@VM-0-16-centos hxl]# ls apache-tomcat-7.0.57.tar.gz apache-tomcat-8.5.63.tar.gz MySQL-5.6.25-1.el6.x86_64.rpm-bundle.tar apache-tomcat-8.5.63 jdk-8u281-linux-x64.rpm [root@VM-0-16-centos hxl]# cd apache-tomcat-8.5.63/ [root@VM-0-16-centos apache-tomcat-8.5.63]# ls bin conf lib logs README.md RUNNING.txt webapps BUILDING.txt CONTRIBUTING.md LICENSE NOTICE RELEASE-NOTES temp work [root@VM-0-16-centos apache-tomcat-8.5.63]# cd bin [root@VM-0-16-centos bin]# ll
启动tomcat
./startup.sh
[root@VM-0-16-centos bin]# ll total 872 -rw-r----- 1 root root 36311 Jan 29 19:24 bootstrap.jar -rw-r----- 1 root root 16840 Jan 29 19:24 catalina.bat -rwxr-x--- 1 root root 25294 Jan 29 19:24 catalina.sh -rw-r----- 1 root root 1664 Jan 29 19:25 catalina-tasks.xml -rw-r----- 1 root root 2123 Jan 29 19:24 ciphers.bat -rwxr-x--- 1 root root 1997 Jan 29 19:24 ciphers.sh -rw-r----- 1 root root 25357 Jan 29 19:24 commons-daemon.jar -rw-r----- 1 root root 207420 Jan 29 19:24 commons-daemon-native.tar.gz -rw-r----- 1 root root 2040 Jan 29 19:24 configtest.bat -rwxr-x--- 1 root root 1922 Jan 29 19:24 configtest.sh -rwxr-x--- 1 root root 9100 Jan 29 19:24 daemon.sh -rw-r----- 1 root root 2091 Jan 29 19:24 digest.bat -rwxr-x--- 1 root root 1965 Jan 29 19:24 digest.sh -rw-r----- 1 root root 3460 Jan 29 19:24 setclasspath.bat -rwxr-x--- 1 root root 3708 Jan 29 19:24 setclasspath.sh -rw-r----- 1 root root 2020 Jan 29 19:24 shutdown.bat -rwxr-x--- 1 root root 1902 Jan 29 19:24 shutdown.sh -rw-r----- 1 root root 2022 Jan 29 19:24 startup.bat -rwxr-x--- 1 root root 1904 Jan 29 19:24 startup.sh -rw-r----- 1 root root 51209 Jan 29 19:24 tomcat-juli.jar -rw-r----- 1 root root 423135 Jan 29 19:24 tomcat-native.tar.gz -rw-r----- 1 root root 4574 Jan 29 19:24 tool-wrapper.bat -rwxr-x--- 1 root root 5540 Jan 29 19:24 tool-wrapper.sh -rw-r----- 1 root root 2026 Jan 29 19:24 version.bat -rwxr-x--- 1 root root 1908 Jan 29 19:24 version.sh [root@VM-0-16-centos bin]# ./startup.sh Using CATALINA_BASE: /home/hxl/apache-tomcat-8.5.63 Using CATALINA_HOME: /home/hxl/apache-tomcat-8.5.63 Using CATALINA_TMPDIR: /home/hxl/apache-tomcat-8.5.63/temp Using JRE_HOME: /usr/java/jdk1.8.0_281-amd64 Using CLASSPATH: /home/hxl/apache-tomcat-8.5.63/bin/bootstrap.jar:/home/hxl/apache-tomcat-8.5.63/bin/tomcat-juli.jar Using CATALINA_OPTS: Tomcat started. [root@VM-0-16-centos bin]#
# 执行:startup.sh -->启动tomcat # 执行:shutdown.sh -->关闭tomcat ./startup.sh ./shutdown.sh
4、确保Linux的防火墙端口是开启的,如果是阿里云,需要保证阿里云的安全组策略是开放的!
# 查看firewall服务状态 systemctl status firewalld # 开启、重启、关闭、firewalld.service服务 # 开启 service firewalld start # 重启 service firewalld restart # 关闭 service firewalld stop # 查看防火墙规则 firewall-cmd --list-all # 查看全部信息 firewall-cmd --list-ports # 只看端口信息 # 开启端口 开端口命令:firewall-cmd --zone=public --add-port=80/tcp --permanent 重启防火墙:systemctl restart firewalld.service 命令含义: --zone #作用域 --add-port=80/tcp #添加端口,格式为:端口/通讯协议 --permanent #永久生效,没有此参数重启后失效