Installing Tomcat 8 on OS X 10.11 El Capitan

By far the easiest way to install and configure an Apache Tomcat server on a mac is using thehomebrew package management suite. If you’re not already using homebrew, you should be. It can be installed via the instructions on their website, it makes open source package management on mac 100 times easier than doing it manually.

There is a good tutorial here on installing homebrew if you do already not have it.

First install with the brew install in terminal:

$ brew install tomcat

This will take care of the downloading, installation and configuration of not only Tomcat but any dependencies as well.

Homebrew keeps packages (known as “kegs”) in a “Cellar”, a directory typically located at:

/usr/local/Cellar/

To start the Tomcat server, execute the Catalina shell program with the “run” parameter as such:

$ ls /usr/local/Cellar/tomcat/
$ /usr/local/Cellar/tomcat/[version]/bin/catalina run

The version number and installation directory will have been listed by homebrew at the end of the installation output (typically the last line with a beer symbol in front). Catalina can also be set to start on system launch – although for security reasons we prefer to only run when needed (either using this command or more commonly via an IDE plugin).

Once the server is running you can navigate to the host page at:

http://localhost:8080/

To add and manage applications running on the server you will also need to edit a configuration file:

$ vim /usr/local/Cellar/tomcat/[version]/libexec/conf/tomcat-users.xml

With [version] again replaced with your installed version. Towards the bottom of this short config file you will see a selection of users – all commented out by default. You need to uncomment one of these and give it the extra role “manager-gui” (preferably also changing the username and password for security). The resultant user entry should look something like this:

<user username="admin" password="password" roles="tomcat,manager-gui" />

After this you can navigate to the page (or click the “Manager App” link on the main Tomcat Server page):

http://localhost:8080/manager/html

Here you can view or delete the included sample application and deploy your own. Usually it’s easiest to deploy applications in a dev / testing environment using an IDE or other deployment routine, however the web interface is fine also. For reference, deployed applications are usually then located under the directory:

/usr/local/Cellar/tomcat/[version]/libexec/webapps/

转载于:https://my.oschina.net/zx0211/blog/718991

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值