mac下tomcat的安装与配置

来源:互联网 发布:网络信息安全认证证书 编辑:程序博客网 时间:2024/05/29 15:37

一、下载tomcat
到 apach官方主页下载 Mac 版本的完整 tar.gz文件包。解压拷贝到 /usr/local目录下,其他目录也可。
二、tomcat配置用户角色

<tomcat-users><!--NOTE: By default, no user is included in the "manager-gui" role requiredto 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 commentand 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="admin"/><role rolename="manager-script"/><role rolename="manager-gui"/><role rolename="manager-jmx"/><role rolename="manager-status"/><role rolename="admin-gui"/><role rolename="admin-script"/><user username="tomcat" password="tomcat" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui,admin-script"/>
三、修改目录权限

到终端输入sudo chmod 755/usr/local/apache-tomcat-7.0.67/bin/*.sh 

四、启动tomcat

按回车键之后会提示输入密码,请输入管理员密码。之后输入并回车: sudo sh startup.sh,打开浏览器,输入 http://localhost:8080/ 

回车之后如果看到Apache Tomcat,表示已经成功运行Tomcat 

五、配置Tomcat启动脚本:
使用文本编辑器添加以下代码:
#!/bin/bashcase $1 instart)sh /usr/local/apache-tomcat-7.0.67/bin/startup.sh;;stop)sh /usr/local/apache-tomcat-7.0.67/bin/shutdown.sh;;restart)sh /usr/local/apache-tomcat-7.0.67/bin/shutdown.shsh /usr/local/apache-tomcat-7.0.67/bin/startup.sh;;*)echo “Usage: start|stop|restart”;;esacexit 0


将文件保存为tomcat,小写并不带后缀。赋予文件执行权限:chmod 777 tomcat。将这个文件放置到/usr/local/bin,而后便可以在终端中简单地输入tomcat start和tomcat stop启用

tomcat了。快捷命令如下:

  • tomcat start
  • tomcat stop
  • tomcat restart

0 0
原创粉丝点击