在安装好JDK后,就可以安装Tomcat
1、下载安装tomcat(http://tomcat.apache.org/)我这边是下载的对应版本的Tomcat。
下载完毕后,通过 rz 进行上传
2、解压放在自己定义的目录下
[[email protected] mydata]# tar -zxvf apache-tomcat-9.0.11.tar.gz
3、进入安装目录中的 目录\tomcat\conf\ 中 对 tomcat进行配置
[[email protected] conf]# vi /mydata/tomcat9.0.11/conf/server.xml
图中红框处为Tomcat的端口配置
4、配置完成后,进入Tomcat安装的bin目录中,启动Tomcat
[[email protected] tomcat9.0.11]# cd /mydata/tomcat9.0.11/bin/
[[email protected] bin]# ls
bootstrap.jar commons-daemon-native.tar.gz makebase.sh tomcat-juli.jar
catalina.bat configtest.bat setclasspath.bat tomcat-native.tar.gz
catalina.sh configtest.sh setclasspath.sh tool-wrapper.bat
catalina-tasks.xml daemon.sh shutdown.bat tool-wrapper.sh
ciphers.bat digest.bat shutdown.sh version.bat
ciphers.sh digest.sh startup.bat version.sh
commons-daemon.jar makebase.bat startup.sh
执行:startup.sh文件启动Tomcat shutdown.sh 文件关闭Tomcat
[[email protected] bin]# ./sartup.sh
-bash: ./sartup.sh: No such file or directory
[[email protected] bin]# ./startup.sh
Using CATALINA_BASE: /mydata/tomcat9.0.11
Using CATALINA_HOME: /mydata/tomcat9.0.11
Using CATALINA_TMPDIR: /mydata/tomcat9.0.11/temp
Using JRE_HOME: /mydata/jdk1.8
Using CLASSPATH: /mydata/tomcat9.0.11/bin/bootstrap.jar:/mydata/tomcat9.0.11/bin/tomcat-juli.jar
Tomcat started.
表示开启了Tomcat,可以去Tomcat的日志文件中查看启动情况
[[email protected] tomcat9.0.11]# cd /mydata/tomcat9.0.11/logs/
[[email protected] logs]# ls
catalina.2018-09-01.log host-manager.2018-09-01.log localhost_access_log.2018-09-01.txt
catalina.out localhost.2018-09-01.log manager.2018-09-01.log
通过cat catalina.out 可以查看启动日志
[[email protected] logs]# cat catalina.out
5、通过网页输入127.0.0.1:8081 是否可以打开网页(此处我设置的端口为8081),显示Tomcat主页表示配置成功
原文地址:https://www.cnblogs.com/key-l731/p/9570026.html