若是沒有tomcat
會報錯。web
systemctl status tomcat.service //或者 systemctl status tomcat
騰訊雲的鏡像沒有tomcat
,須要手動下載,我選的第二種方案。shell
yum install tomcat //或者 -y表明全部的詢問都選y yum -y install tomcat
tomcat
的安裝目錄在 /usr/share/tomcat
,能夠cd
進去查看是否有文件。tomcat
systemctl start tomcat.service //或者 systemctl start tomcat
此時,cd
到tomcat
的 webapps
目錄,用ls
查看目錄以後會發現是空的,這證實須要安裝tomcat
的管理界面。app
yum install tomcat-webapps tomcat-admin-webapps
回到 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"/>
systemctl restart tomcat.service //或者 systemctl restart tomcat
中止 tomcat
服務ui
systemctl stop tomcat.service //或者 systemctl stop tomcat
開機自啓動 tomcat
rest
systemctl enable tomcat