成龍有個電影叫簡單任務,下面要講的也是簡單任務--具體來講是把一個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!