Ubuntu 通过APT安装Tomcat

Ubuntu 通过APT安装Tomcat

安装

sudo apt-get install tomcat8 tomcat8-docs tomcat8-examples tomcat8-admin
# service tomcat8 start
# service tomcat8 status
● tomcat8.service - LSB: Start Tomcat.
   Loaded: loaded (/etc/init.d/tomcat8; generated)
   Active: active (running) since Sat 2018-10-27 19:00:20 CST; 7min ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 35 (limit: 4915)
   CGroup: /system.slice/tomcat8.service
           └─5643 /usr/lib/jvm/default-java/bin/java -Djava.util.logging.config.


配置管理员

sudo vim /var/lib/tomcat8/conf/tomcat-users.xml
<role rolename="manager-gui"/>
<role rolename="admin-gui"/>
<user username="root" password="123456" roles="manager-gui,admin-gui"/>

重启

sudo service tomcat8 restart
http://127.0.0.1:8080/

配置服务自启动

sudo sysv-rc-conf

如果指令不存在,就安装

sudo vim /etc/apt/sources.list

加入deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse#为安装sysv-rc-conf准备

然后更新 sudo apt update 就能运行 sudo apt install sysv-rc-conf 安装了

卸载

sudo apt-get autoremove tomcat8
posted @ 2018-10-27 22:00  TBHacker  阅读(6925)  评论(0编辑  收藏  举报