在 Debian 上“测 Tomcat”通常指安装后验证 Tomcat 是否能正常启动并提供服务。下面按常见场景给你一套完整做法。
which tomcat
# 或
systemctl status tomcat
Debian 上常见包名:
tomcat9tomcat10查看是否安装:
dpkg -l | grep tomcat
sudo systemctl start tomcat
sudo systemctl enable tomcat
查看状态:
sudo systemctl status tomcat
正常应看到 active (running)。
ss -lntp | grep 8080
或:
netstat -lntp | grep 8080
curl http://localhost:8080
若返回 HTML(含 “Apache Tomcat”),说明成功。
http://服务器IP:8080
创建测试应用:
sudo mkdir -p /var/lib/tomcat9/webapps/test
sudo nano /var/lib/tomcat9/webapps/test/index.jsp
内容:
<%@ page language="java" %>
<html>
<body>
<h1>Tomcat Test OK</h1>
<%= new java.util.Date() %>
</body>
</html>
访问:
http://localhost:8080/test/index.jsp
能看到时间说明 JSP 引擎正常。
sudo tail -f /var/log/tomcat9/catalina.out
或:
journalctl -u tomcat -f
sudo lsof -i:8080
java -version
Tomcat 需要 JRE/JDK:
sudo apt install default-jdk
sudo ufw allow 8080
cd /opt/tomcat/bin
./startup.sh
测试同上(curl / 浏览器)。
如果你说的“测 Tomcat”是:
可以告诉我具体场景,我可以给你更针对性的方案。