成龙有个电影叫简单任务,下面要讲的也是简单任务--具体来讲是把一个war发布到在Fedora8上的tomcat6上。html
在发布以前,须要先配置一个manager角色的任务,不然点Tomcat mannager连接的时候系统不会让你进去。咱们在windows里没有这一步,这是由于安装时Tomcat就让你输入默认的manager(Admin+“”)了。web
好,先进入Catalina_Home(即前文说道的/usr/local/tomcat6.0.37)的conf目录,用VI打开里面的tomcat-users.xml,在里面改写以下一段:windows
<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"/>
<role rolename="manager"/>
<user username="haha" password="123456" roles="manager"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
<user username="role1" password="tomcat" roles="role1"/>
</tomcat-users>tomcat
注意两点,上述黑体字部分是新增的,其它是原有的,注意有时XML注释可能会把role,user等部分屏蔽掉,这时须要去除挡害的XML注释;另外有些版本写法不同,好比下面这种app
<role name="manager">
<user name="admin" password="123456" roles="manager"/> ui
这种,这时就须要参照原有的文本进行改写,不能生搬硬套。this
改写完了,点ESC输入:wq退出。再进入bin目录下,执行脚本关闭./shudown.sh并再次启动Tomcat./startup.sh。xml
以后就简单了,点Tomcat mannager连接,输入用户名haha和密码123456,进入管理界面,而后点Browse按钮找到你要发布的war,再点Deploy按钮。htm
发布成功后,点Application表格左边的连接,就看到了发布的Web应用。blog
上文有错但愿帮忙指出。Thks!