若是没有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