我使用以下命令安装了 tomcat9
sudo su
yum install tomcat9
但是在tomcat9目录下/usr/share/tomcat9/bin
,startup.sh
找不到该文件,只有下面3个文件:
$ls /usr/share/tomcat9/bin/
bootstrap.jar catalina-tasks.xml tomcat-juli.jar
我尝试运行tomcat9也出现错误:
/usr/sbin/tomcat9 start
Failed to start tomcat.service: Unit tomcat.service not found.
Tomcat 版本:
$java -cp /usr/share/tomcat9/lib/catalina.jar org.apache.catalina.util.ServerInfo
Server version: Apache Tomcat/9.0.71
Server built: Apr 13 2023 00:00:00 UTC
Server number: 9.0.71.0
OS Name: Linux
OS Version: 6.1.25-37.47.amzn2023.x86_64
Architecture: amd64
JVM Version: 17.0.7+8-LTS-224
JVM Vendor: Oracle Corporation
操作系统是 Amazon Linux 2023
$cat /etc/os-release
NAME="Amazon Linux"
VERSION="2023"
ID="amzn"
ID_LIKE="fedora"
VERSION_ID="2023"
PLATFORM_ID="platform:al2023"
PRETTY_NAME="Amazon Linux 2023"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2023"
HOME_URL="https://aws.amazon.com/linux/"
BUG_REPORT_URL="https://github.com/amazonlinux/amazon-linux-2023"
SUPPORT_END="2028-03-01"
我该如何修复它才能运行?
答案1
根据repoquery -l tomcat9
systemd 单元名称是tomcat9
。
systemctl start tomcat9
相关配置文件:
- /etc/tomcat9/tomcat9.conf
- /etc/sysconfig/tomcat9
如果你需要多个 tomcat 实例,还有第二个单元定义:
要创建此服务的克隆:
systemctl enable [email protected]
- 创建 catalina.base 目录结构
/var/lib/tomcats/name
其中name
可以是您选择的任意名称。