示例(下载 9.0.86 版本):
wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.86/bin/apache-tomcat-9.0.86.tar.gz
tar zxvf tar.gz包名称
示例:
tar zxvf apache-tomcat-9.0.86.tar.gz
进入 bin 目录,运行 startup.sh 文件
示例:
cd apache-tomcat-9.0.86/bin
./startup.sh
示例(下载 9.0.86 版本):
https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.86/bin/apache-tomcat-9.0.86-windows-x64.zip
apache-tomcat-9.0.86-windows-x64.zip
进入 bin 目录,运行 startup.bat 文件
示例:
apache-tomcat-9.0.86/bin/startup.bat
安装 Docker 及 Docker Compose
略,参考:Docker Engine(1):Docker Engine 的安装
编辑 compose.yaml 文件
vim compose.yaml
version: "3.9"
services:
tomcat:
image: tomcat:9.0.86-jdk8
container_name: tomcat
hostname: tomcat
restart: always
ports:
- "8080:8080"
volumes:
- /etc/localtime:/etc/localtime:ro
- ./conf/context.xml:/usr/local/tomcat/conf/context.xml
- ./conf/server.xml:/usr/local/tomcat/conf/server.xml
- ./webapps:/usr/local/tomcat/webapps
docker-compose up -d