CentOS7安裝tomcat

1 查看tomcat狀態

若是沒有tomcat會報錯。web

systemctl status tomcat.service
//或者 
systemctl status tomcat

2 安裝tomcat

騰訊雲的鏡像沒有tomcat,須要手動下載,我選的第二種方案。shell

yum install tomcat
//或者 -y表明全部的詢問都選y
yum -y install tomcat

tomcat的安裝目錄在 /usr/share/tomcat,能夠cd進去查看是否有文件。tomcat

3 啓動tomcat

systemctl start tomcat.service
//或者 
systemctl start tomcat

此時,cdtomcatwebapps 目錄,用ls查看目錄以後會發現是空的,這證實須要安裝tomcat的管理界面。app

4 安裝tomcat的管理界面

yum install tomcat-webapps tomcat-admin-webapps

5 添加用戶

回到 tomcat 安裝目錄(/usr/share/tomcat),進入 conf 目錄,打開 tomcat-users.xml 文件,在 <tomcat-users> 標籤下,添加以下配置:
(username和password最好複雜!!!)webapp

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

6 重啓服務。

systemctl restart tomcat.service
//或者 
systemctl restart tomcat

7 tomcat其餘重要命令

中止 tomcat 服務ui

systemctl stop tomcat.service
//或者 
systemctl stop tomcat

開機自啓動 tomcatrest

systemctl enable tomcat
相關文章
相關標籤/搜索