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
相关文章
相关标签/搜索