下载Tomcat压缩包,解压到指定目录,配置环境变量,启动Tomcat服务即可。
在Linux上部署Tomcat服务器的步骤如下:
1、下载Tomcat安装包
访问Tomcat官方网站(https://tomcat.apache.org/)下载最新版本的Tomcat安装包,选择适合你的操作系统的版本,tar.gz格式。
2、上传Tomcat安装包到Linux服务器
使用SCP或者其他文件传输工具将下载好的Tomcat安装包上传到Linux服务器上。
3、解压Tomcat安装包
在Linux服务器上,选择一个合适的目录,/opt,然后将Tomcat安装包解压到该目录下。
sudo tar zxvf apachetomcat9.0.53.tar.gz C /opt/
4、配置环境变量
为了让系统能够识别Tomcat命令,需要配置环境变量,编辑/etc/profile文件,添加以下内容:
export CATALINA_HOME=/opt/apachetomcat9.0.53 export PATH=$PATH:$CATALINA_HOME/bin
保存文件后,执行以下命令使配置生效:
source /etc/profile
5、启动Tomcat服务器
执行以下命令启动Tomcat服务器:
sudo $CATALINA_HOME/bin/startup.sh
6、验证Tomcat服务器是否启动成功
执行以下命令查看Tomcat服务器的运行状态:
sudo $CATALINA_HOME/bin/status.sh
如果看到类似以下的输出,说明Tomcat服务器已经启动成功:
Using CATALINA_BASE: /opt/apachetomcat9.0.53 Using CATALINA_HOME: /opt/apachetomcat9.0.53 Using CATALINA_TMPDIR: /opt/apachetomcat9.0.53/temp Using JRE_HOME: /usr/lib/jvm/java11openjdkamd64/bin/java Using CLASSPATH: /opt/apachetomcat9.0.53/bin/bootstrap.jar:/opt/apachetomcat9.0.53/bin/tomcatjuli.jar Server version: Apache Tomcat/9.0.53 (Ubuntu) Server built: 20200714T23:37:16+0800 Server number: 9.0.53.0 OS Name: Linux OS Version: 5.4.072generic Architecture: amd64 JVM Version: 11.0.8+10postRelease5428166 OpenJDK 64Bit Server VM by Oracle Corporation JVM Vendor: Oracle Corporation Start Time: Tue Jul 27 14:56:27 CST 2022 Start Date: 20220727T14:56:27+08:00 End Time: Sat Aug 06 14:56:27 CST 2022 End Date: 20220806T14:56:27+08:00 Uptime: 1 day, 17 hours, 1 minute Connections: 1 active, 0 idle, 1 max connections, 1 total users, 0 average users, 0 peak users, 1 minimum users, 0 seconds between connections, 0 last connection made, now in use, 0 total threads, 1 alive, 0 idle, 0 started, 0 max threads, 1 min thread age, 0 thread count, 1 deadlocked thread, 0 threads blocked, 0 waiting for monitor entry, 0 threads in shared mode, 1 threads in event mode, 0 threads in daemon mode, 1 busy threads, 0 idle threads, 0 connected sockets, 0 accept sockets, 0 half open sockets, 0 bytes received, 0 bytes sent, 1 requests, 1 total errors, 0 partial/aborted requests, 0 out of order responses, 0 internal errors, 0 not closed connections, 0 bytes read, 0 bytes written, 0 keepalive connections on hold, 0 sessions opened, 0 sessions closed, 1 active sessions
原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/509790.html