Mac OS X 系统安装 Tomcat 7.0.x 简明教程

简介: Installing Tomcat 7.0.x on OS X by Wolf Paulus | Dec 14, 2013 | Mac OS X | 219 comments While Tomcat 8 is close to be released (Tomcat 8.

Installing Tomcat 7.0.x on OS X

by Wolf Paulus | Dec 14, 2013 | Mac OS X | 219 comments

Installing Tomcat 7.0.x on OS X

While Tomcat 8 is close to be released (Tomcat 8.0.0-RC5 (alpha) is released already), Tomcat 7 was the first Apache Tomcat release to support the Servlet 3.0, JSP 2.2, and EL 2.2 specifications. Please note that Tomcat 7 requires Java 1.6 or better, which shouldn’t be a problem, if you are running OS X 10.5 or 10.6.

On OS X 10.7, 10.8 (Mnt Lion), and 10.9 (Mavericks) however, Java is not installed anymore, at least not initially. The easiest way to get Java onto your Mac is probably to open the Terminal app and enter java. You will be asked if you want to install it and OS X takes care of the rest – you would end up with Java 6.

Prerequisite: Java

On 10.9 (Mavericks), Apple changed this once again, now sending you to Oracle’s Java SE web page, where you can download the JDK, (currently 7 jdk-7u45-macosx-x64.dmg). While at Oracle, I usually also download the Java SE Development Kit 7 Documentation, allowing me to stay away from their site for many months.
mavericks
The JDK installer package come in an dmg and installs easily on the Mac; and after opening the Terminal app again,

java -version

now shows something like this:

java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

Whatever you do, when opening Terminal and running java -version, you should see something like this, with a version of at least 1.6.x

sudo is a program for Unix-like operating systems, allowing you to run programs with the security privileges of another user (normally the superuser, or root). Since we are creating directories, outside of your home folder, administrator right are required. I.e., when executing  sudo you will be asked to enter your password; and your Mac User account needs to be an ‘Admin’ account.

Installing Tomcat

Here are the easy to follow steps to get it up and running on your Mac

  1. Download a binary distribution of the core module: apache-tomcat-7.0.47.tar.gz from here. I picked the tar.gz in Binary Distributions / Core section.
  2. Opening/unarchiving the archive will create a folder structure in your Downloads folder: (btw, this free Unarchiver app is perfect for all kinds of compressed files and superior to the built-in Archive Utility.app)
    ~/Downloads/apache-tomcat-7.0.47
  3. Open to Terminal app to move the unarchived distribution to /usr/local
    sudo mkdir -p /usr/local
    sudo mv ~/Downloads/apache-tomcat-7.0.47 /usr/local
  4. To make it easy to replace this release with future releases, we are going to create a symbolic link that we are going to use when referring to Tomcat (after removing the old link, you might have from installing a previous version):
    sudo rm -f /Library/Tomcat
    sudo ln -s /usr/local/apache-tomcat-7.0.47 /Library/Tomcat
  5. Change ownership of the /Library/Tomcat folder hierarchy:
    sudo chown -R <your_username> /Library/Tomcat
  6. Make all scripts executable:
    sudo chmod +x /Library/Tomcat/bin/*.sh




Instead of using the start and stop scripts, like so:
Last login: Sun Aug 14 15:20:38 on ttys000
wpbookpro:~ wolf$ /Library/Tomcat/bin/startup.sh
Using CATALINA_BASE: /Library/Tomcat
Using CATALINA_HOME: /Library/Tomcat
Using CATALINA_TMPDIR: /Library/Tomcat/temp
Using JRE_HOME: /Library/Java/Home
Using CLASSPATH: /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar
wpbookpro:~ wolf$ /Library/Tomcat/bin/shutdown.sh
Using CATALINA_BASE: /Library/Tomcat
Using CATALINA_HOME: /Library/Tomcat
Using CATALINA_TMPDIR: /Library/Tomcat/temp
Using JRE_HOME: /Library/Java/Home
Using CLASSPATH: /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar
wpbookpro:~ wolf$

you may also want to check out Activata’s Tomcat Controller, a tiny freeware app, providing a UI to quickly start/stop Tomcat. It may not say so, but Tomcat Controller works on OS X 10.8 and 10.9 just fine.


Finally, after your started Tomcat, open your Mac’s Web browser and take a look at the default page:http://localhost:8080


目录
相关文章
|
2月前
|
消息中间件 Kafka
mac 搭建kafka系列教程
mac 搭建kafka系列教程
33 0
mac 搭建kafka系列教程
|
3月前
|
Linux C++
百度搜索:蓝易云【Linux下C++ STL获取Mac地址教程】
请注意,获取MAC地址需要root权限,因此在运行代码时可能需要使用sudo权限。另外,不同的Linux发行版和内核版本可能会稍有差异,您可能需要根据您的具体环境进行适当的调整。
47 0
|
3月前
|
负载均衡 应用服务中间件 nginx
百度搜索:蓝易云【Nginx和tomcat实现负载均衡教程】
至此,你已经成功地使用Nginx和Tomcat实现了负载均衡。Nginx将根据配置的负载均衡策略将客户端请求分发到多个Tomcat服务器上,以提高系统的性能和可用性。请注意,在实际生产环境中,还需要进行其他配置和优化,如健康检查、会话保持等,以满足具体的需求。
34 0
|
3月前
|
负载均衡 安全 前端开发
百度搜索:蓝易云【Nginx与Tomcat负载均衡-动静分离教程】
这些是将Nginx与Tomcat结合使用实现负载均衡和动静分离的基本步骤。根据您的需求和具体环境,可能还需要进行其他配置和调整。请确保在进行任何与网络连接和安全相关的操作之前,详细了解您的网络环境和安全需求,并采取适当的安全措施。
49 1
|
2月前
|
Shell 网络安全 iOS开发
最好用的SSH工具Royal TSX for mac使用教程
众所周知,在 Windows上我们经常用到的shell工具可能非 xshell莫属了。但是xshell却并没有开发mac 版本,我们只能用其他的工具替代了。 在我用过几个ssh工具之后,我觉得在macOS上最好用的ssh工具客户端必须是 Royal TSX,它和使用xhell的感觉简直一模一样。 Royal TSX是一款功能非常强大适用于 Mac 的远程连接管理工具。兼容多种连接类型,比如:RDP、VNC、基于SSH连接的终端,SFTP/FTP/SCP或基于Web的连接管理,Royal TSX 都可以满足您的要求!
193 0
最好用的SSH工具Royal TSX for mac使用教程
|
6月前
|
开发工具 数据安全/隐私保护 git
百度搜索:蓝易云【Mac 安装homebrew Mac安装Git教程。】
现在,您已成功在Mac上安装了Homebrew和Git。您可以使用Homebrew安装其他软件包,并使用Git进行版本控制和代码管理。 希望这些信息对您有所帮助!如果您有任何其他问题,请随时提问。
123 0
|
6月前
|
前端开发 应用服务中间件 C++
使用Servlet实现表白墙网站(前后端互联)小项目,Mac的M1(没有setting)在哪里找到Setting页面,下载smart tomcat及smart tomcat的配置。(二)
使用Servlet实现表白墙网站(前后端互联)小项目,Mac的M1(没有setting)在哪里找到Setting页面,下载smart tomcat及smart tomcat的配置。
使用Servlet实现表白墙网站(前后端互联)小项目,Mac的M1(没有setting)在哪里找到Setting页面,下载smart tomcat及smart tomcat的配置。(二)
|
6月前
|
Java 关系型数据库 MySQL
mac,linux环境的基础工具安装【jdk,tomcat】
mac,linux环境的基础工具安装【jdk,tomcat】
92 1
|
4月前
|
iOS开发 MacOS
MAC OS更新系统后IDEA中的SVN报错无法使用
MAC OS更新系统后IDEA中的SVN报错无法使用
|
6月前
|
JSON 前端开发 JavaScript
使用Servlet实现表白墙网站(前后端互联)小项目,Mac的M1(没有setting)在哪里找到Setting页面,下载smart tomcat及smart tomcat的配置。(一)
使用Servlet实现表白墙网站(前后端互联)小项目,Mac的M1(没有setting)在哪里找到Setting页面,下载smart tomcat及smart tomcat的配置。