温馨提示×

debian tomcat怎么重启

小樊
43
2026-09-03 10:13:53
栏目: 智能运维

在 Debian 系统上,Tomcat 的重启方式取决于它的安装方式。下面分情况说明:


一、通过 systemd 安装的 Tomcat(推荐,常见)

如果你是用 apt 安装的 Tomcat(如 tomcat9tomcat10):

查看服务名

systemctl list-units | grep tomcat

通常是:

  • tomcat9
  • tomcat10

重启 Tomcat

sudo systemctl restart tomcat9

sudo systemctl restart tomcat10

其他常用命令

sudo systemctl stop tomcat9     # 停止
sudo systemctl start tomcat9    # 启动
sudo systemctl status tomcat9   # 查看状态

二、手动安装的 Tomcat(二进制包)

如果你是从 Apache 官网下载的 tar.gz 解压安装的:

进入 Tomcat 目录

cd /opt/tomcat/bin

(路径可能不同)

重启步骤

sudo ./shutdown.sh
sudo ./startup.sh

⚠️ 注意:
shutdown.sh 有可能关闭较慢,建议等几秒再执行 startup.sh


三、查看是否启动成功

ps -ef | grep tomcat

或访问:

http://服务器IP:8080

四、设置开机自启(systemd 方式)

sudo systemctl enable tomcat9

如果你愿意,可以告诉我:

  • Debian 版本
  • Tomcat 版本
  • 安装方式(apt 还是手动)

我可以给你更精确的重启命令。

0