Installing Tomcat 8 on OS X 10.10 Yosemite
2015-08-08 21:49
435 查看
https://wolfpaulus.com/jounal/mac/tomcat8/
The Servlet 4.0 specification is out and Tomcat 9.0.x will support it. However, at this point Tomcat 8.0.x is the best Tomcat version and it is supporting the 3.1 Servlet Spec.
Since OS X 10.7 Java is not (pre-)installed anymore, let’s fix that first.
The JDK installer package come in an dmg and installs easily on the Mac; and after opening the Terminal app again,
now shows something like this:
Whatever you do, when opening Terminal and running java -version, you should see something like this, with a version of at least 1.7.x I.e. Tomcat 8.x requires Java 7 or later.
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.
JAVA_HOME is an important environment variable, not just for Tomcat, and it’s important to get it right. Here is a trick that allows me to keep the environment variable current, even after a Java Update was installed. In ~/.bash_profile, I set the variable
like so:
Download a binary distribution of the core module: apache-tomcat-8.0.22.tar.gz from
here. I picked the tar.gz in Binary Distributions / Core section.
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-8.0.22
Open to Terminal app to move the unarchived distribution to /usr/local
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):
Change ownership of the /Library/Tomcat folder hierarchy:
Make all scripts executable:
Tomcat 8.x
Instead of using the start and stop scripts, like so:
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.10 just fine.
Finally, after your started Tomcat, open your Mac’s Web browser and take a look at the default page:
http://localhost:8080
The Servlet 4.0 specification is out and Tomcat 9.0.x will support it. However, at this point Tomcat 8.0.x is the best Tomcat version and it is supporting the 3.1 Servlet Spec.
Since OS X 10.7 Java is not (pre-)installed anymore, let’s fix that first.
Prerequisite: Java
As I’m writing this, Java 8u45 is the latest version, available for download here: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.htmlThe 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.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, 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.7.x I.e. Tomcat 8.x requires Java 7 or later.
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.
JAVA_HOME is an important environment variable, not just for Tomcat, and it’s important to get it right. Here is a trick that allows me to keep the environment variable current, even after a Java Update was installed. In ~/.bash_profile, I set the variable
like so:
export JAVA_HOME=$(/usr/libexec/java_home)
Installing Tomcat
Here are the easy to follow steps to get it up and running on your MacDownload a binary distribution of the core module: apache-tomcat-8.0.22.tar.gz from
here. I picked the tar.gz in Binary Distributions / Core section.
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-8.0.22
Open to Terminal app to move the unarchived distribution to /usr/local
sudo mkdir -p /usr/local
sudo mv ~/Downloads/apache-tomcat-8.0.22 /usr/local
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-8.0.22 /Library/Tomcat
Change ownership of the /Library/Tomcat folder hierarchy:
sudo chown -R <your_username> /Library/Tomcat
Make all scripts executable:
sudo chmod +x /Library/Tomcat/bin/*.sh
Tomcat 8.x
Instead of using the start and stop scripts, like so:
47 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/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home Using CLASSPATH: /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar Tomcat started. 48 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/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home Using CLASSPATH: /Library/Tomcat/bin/bootstrap.jar:/Library/Tomcat/bin/tomcat-juli.jar 49 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.10 just fine.
Finally, after your started Tomcat, open your Mac’s Web browser and take a look at the default page:
http://localhost:8080
39 Comments
相关文章推荐
- tomcat配置
- Apache + Tomcat 负载均衡 session复制
- solr5.2.1环境搭建
- tomcat环境变量的配置
- WebLogic、WebSphere、JBOSS、Tomcat之间的区别
- TOMCAT 异常启动的情况
- NetBeans启动Tomcat报“'127.0.0.1' 不是内部或外部命令”启动失败
- Tomcat启动分析(我们为什么要配置CATALINA_HOME环境变量)
- eclipse tomcat 建立 web服务器
- 百度开放云java+tomcat部署web项目-小皇帝詹姆斯
- day07-tomcat
- tomcat7.0.19虚拟目录配置
- Tomcat无法shutdown进程问题解决办法
- 一次tomcat应用无法访问的处理过程
- linux系统非ROOT用户80端口不能启动tomcat问题的变通办法——通过Iptables端口转发
- tomcat 和 Myeclipse中的项目的编译问题
- CentOS-6.5安装配置JDK-7|Tomcat-8
- Linux下Debug模式启动Tomcat进行远程调试
- 花生壳+tomact 将个人电脑搭建服务器
- Nginx+tomcat7的负载均衡和动静分离配置