1、安装:
安装后的默认路径是~/Library/Tomcat
.
2、进入到Tomcat/bin目录下,
./startup.sh
3、进入到Tomcat/bin目录下,
./shutdown.sh
4、权限问题:
①
$ ~/Library/Tomcat/bin $ ./startup.sh
zsh: permission denied: ./startup.sh
解决:
sudo chmod 777 startup.sh
②
$ ~/Library/Tomcat/bin $ ./startup.sh
Cannot find ./catalina.sh
The file is absent or does not have execute permission
This file is needed to run this program
解决:
chmod +x catalina.sh
5、给zsh配置alias,方便启动和关闭:zsh
配置文件:
针对安装的Tomcat环境,快捷启动和关闭
tomcat startup
alias tomcatstartup='~/Library/Tomcat/bin/startup.sh'
tomcat shutdown
alias tomcatshutdown='~/Library/Tomcat/bin/shutdown.sh'
接着我们就可以很方便的调用我们的服务了。
启动服务:
tomcatstartup
停止服务:
tomcatshutdown
启动服务后,在浏览器访问[http://localhost:8080/](http://localhost:8080/),就会出现Tomcat的经典页面了。
6、修改默认端口:
默认端口是8080,我们可以修改为我们期望的端口,具体是`tomcat根目录/conf/server.xml`文件,具体参考[tomcat更改默认端口号](https://blog.csdn.net/m0_37836194/article/details/79151296)即可。