Mac OS上安装Tomcat服务器的简单步骤

作者:情缘 时间:2022-11-26 21:06:42 

一. 下载tomcat

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

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

 

二. 修改授权

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

Mac OS上安装Tomcat服务器的简单步骤

输入如下命令:


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开发的应该很熟悉,这里不再讨论

标签:Mac,Tomcat
0
投稿

猜你喜欢

  • 图解JVM垃圾内存回收算法

    2023-10-13 17:24:35
  • c#多线程编程基础

    2021-11-24 23:37:12
  • C#实现json的序列化和反序列化实例代码

    2022-07-18 01:50:34
  • MyBatis插入Insert、InsertSelective的区别及使用心得

    2023-08-25 04:34:28
  • c#实现最简洁的快速排序(你绝对可以看懂)

    2022-04-01 22:35:48
  • Spring cloud alibaba之Ribbon负载均衡实现方案

    2021-11-08 20:05:23
  • Android布局自定义Shap圆形ImageView可以单独设置背景与图片

    2023-02-23 15:15:35
  • Winform实现将网页生成图片的方法

    2022-09-06 13:39:31
  • Java String 字符串常量池解析

    2023-01-08 19:44:05
  • RocketMQ源码解析broker 启动流程

    2022-12-25 10:50:54
  • Android Retrofit文件下载进度显示问题的解决方法

    2021-09-23 20:24:10
  • 一文带你了解C#中的协变与逆变

    2022-08-06 22:31:21
  • Struts2 Result 参数详解

    2022-04-28 07:54:35
  • Java 判断字符串中是否包含中文的实例详解

    2023-11-06 13:17:18
  • Java基于ShardingSphere实现分库分表的实例详解

    2022-04-20 18:43:37
  • java实现ArrayList根据存储对象排序功能示例

    2022-01-24 01:06:05
  • Android 开发音频组件(Vitamio FAQ)详细介绍

    2021-06-24 01:09:15
  • Java中的CAS和ABA问题说明

    2021-08-19 11:08:18
  • Springboot-注解-操作日志的实现方式

    2023-10-10 13:54:35
  • Java IO流 文件传输基础

    2023-08-24 13:27:11
  • asp之家 软件编程 m.aspxhome.com