安装后,设置环境变量。
echo "export CATALINA_HOME=/usr/local/tomcat" > /etc/profile.d/tomcat.sh echo 'export PATH=$CATALINA_HOME/bin:$PATH' >> /etc/profile.d/tomcat.sh . /etc/profile.d/tomcat.sh执行bin目录下的version.sh检查PATH环境变量是否正确。
[root@xuexi bin]# version.sh Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/java/latest Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar Server version: Apache Tomcat/8.5.14 Server built: Apr 13 2017 12:55:45 UTC Server number: 8.5.14.0 OS Name: Linux OS Version: 2.6.32-504.el6.x86_64 Architecture: amd64 JVM Version: 1.8.0_131-b11 JVM Vendor: Oracle Corporation最后启动tomcat。
[root@xuexi tomcat]# catalina.sh start Using CATALINA_BASE: /usr/local/tomcat Using CATALINA_HOME: /usr/local/tomcat Using CATALINA_TMPDIR: /usr/local/tomcat/temp Using JRE_HOME: /usr/java/latest Using CLASSPATH: /usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/tomcat-juli.jar Tomcat started. [root@xuexi tomcat]# netstat -tnlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1879/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1415/master tcp 0 0 :::22 :::* LISTEN 1879/sshd tcp 0 0 ::1:25 :::* LISTEN 1415/master tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 15212/java tcp 0 0 :::8009 :::* LISTEN 15212/java tcp 0 0 :::8080 :::* LISTEN 15212/java [root@xuexi tomcat]# curl -I :8080 HTTP/1.1 200 Content-Type: text/html;charset=UTF-8 Transfer-Encoding: chunked Date: Tue, 17 Oct 2017 16:49:10 GMT更多Tomcat相关教程见以下内容:
CentOS 6.6下安装配置Tomcat环境
RedHat Linux 5.5安装JDK+Tomcat并部署Java项目
Linux下使用Xshell查看Tomcat实时日志中文乱码解决方案
CentOS 64-bit下安装JDK和Tomcat并设置Tomcat开机启动操作步骤
Ubuntu 16.04下安装Tomcat 8.5.9