alexislucena
2/20/2017 - 10:46 AM

Tomcat 8 basic installation on Ubuntu 16.04 with Java installed

Tomcat 8 basic installation on Ubuntu 16.04 with Java installed

Login as root

$ sudo su

Install updates

$ apt-get update && apt-get upgrade

Install Tomcat from the Ubuntu repository

$ apt-get install tomcat8

Install the tomcat8-docs and tomcat8-admin

$ apt-get install tomcat8-docs tomcat8-examples tomcat8-admin

Start, stop or restart Tomcat

$ sudo systemctl start tomcat8
$ sudo systemctl stop tomcat8
$ sudo systemctl restart tomcat8

Set tomcat manager user

$ sudo nano /var/lib/tomcat8/conf/tomcat-users.xml

Insert following lines

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

Restart tomcat

$ sudo systemctl restart tomcat8

Source https://www.linode.com/docs/websites/frameworks/apache-tomcat-on-ubuntu-16-04

How to fix following error:

Job for tomcat8.service failed because the control process exited with error code. See "systemctl status tomcat8.service" and "journalctl -xe" for details. invoke-rc.d: initscript tomcat8, action "start" failed.

$ sudo nano /etc/default/tomcat8

Set JAVA_HOME

JAVA_HOME=/usr/lib/jvm/java-8-oracle

How to disable auto start:

$ sudo update-rc.d tomcat8 disable

Reboot an check if tomcat is running:

$ sudo systemctl status tomcat8

http://askubuntu.com/questions/27134/disable-autostart-for-a-service-without-uninstalling

How to how to completely remove tomcat from Ubuntu:

$ sudo apt-get purge tomcat8 tomcat8-docs tomcat8-examples tomcat8-admin