步骤 | Linux系统 | Windows系统 |
1. 下载Tomcat | sudo wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat9/v9.0.55/bin/apachetomcat9.0.55.tar.gz | 访问Tomcat官网下载Windows版本的zip包 |
2. 解压Tomcat | sudo tar xzvf apachetomcat9.0.55.tar.gz
sudo mv apachetomcat9.0.55 /opt/tomcat | 解压下载的zip包到合适的目录,例如C:Program FilesApache Tomcat |
3. 设置环境变量(可选) | echo “export CATALINA_HOME=/opt/tomcat” >> ~/.bashrc
source ~/.bashrc | 在系统环境变量中添加CATALINA_HOME,值为Tomcat解压路径 |
4. 启动Tomcat | /opt/tomcat/bin/startup.sh | 运行Tomcat解压目录下的bin/startup.bat |
5. 检查Tomcat状态 | ps ef | grep tomcat | 查看任务管理器中是否有Tomcat进程 |
6. 访问Tomcat | 打开浏览器,访问http://localhost:8080 | 打开浏览器,访问http://localhost:8080 |
7. 关闭Tomcat | /opt/tomcat/bin/shutdown.sh | 运行Tomcat解压目录下的bin/shutdown.bat |