Mac 下安装tomcat

一. 下载tomcat

  首先要到tomcat官网去下载安装包,官网下载地址如下:http://tomcat.apache.org/download-70.cgi , 注意请下载飞windows版本。和windows操作系统不一样,这个里面没有令人厌烦的注册表。

  将压缩包解压到任意一个目录,我这里是存放到/ProgramFile/tomcat 目录下面

 

二. 修改授权

  tomcat中的几个运行服务程序都是以*.sh结尾的,在运行之前需要授权。打开终端输入如下命令:

 

  输入如下命令:sudo chmod 755 /ProgramFile/tomcat/bin/*.sh

  回车出现要输入密码:请输入本机账户密码

 

三. 启动tomcat服务

  先使用 cd 命令进入tomcat的bin目录,命令如下:

  cd /ProgramFile/tomcat/bin/

  启动服务命令:

  sudo sh startup.sh

  启动成功,会出现如下结果:

Using CATALINA_BASE:   /ProgramFile/tomcat
Using CATALINA_HOME:   /ProgramFile/tomcat
Using CATALINA_TMPDIR: /ProgramFile/tomcat/temp
Using JRE_HOME:        /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Using CLASSPATH:       /ProgramFile/tomcat/bin/bootstrap.jar:/ProgramFile/tomcat/bin/tomcat-juli.jar
Tomcat started.

  如果出现如上结果,说明tomcat启动成功

 

四. tomcat 相关配置的修改

  打开tomcat中的 /tomcat/conf/tomcat-users.xml 文件。

<tomcat-users>
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to use this app,
  you must define such a user - the username and password are arbitrary.
-->
<!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
  <!.. ..> that surrounds them.
-->
<!--
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="tomcat" roles="tomcat"/>
  <user username="both" password="tomcat" roles="tomcat,role1"/>
  <user username="role1" password="tomcat" roles="role1"/>
-->
<role rolename="manager"/>
<user username="tomcat" password="root" roles="manager"/>
</tomcat-users>

  默认<role> 都是被注释的,这里添加如下:

<role rolename="manager"/>
<user username="tomcat" password="root" roles="manager"/>

  更多配置修改,可以查看tomcat的相关资料

  这个时候输入 http://localhost:8080/ 应该就可以访问了,做java web开发的应该很熟悉,这里不再讨论

 

转载于:https://www.cnblogs.com/qingyuan/p/4145175.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值