Instalar Tomcat Manualmente

Instalar Tomcat Manualmente

Remover open-jdk:

sudo apt-get purge openjdk-\*

Instalar Oracle JDK

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
update-alternatives --config java

Instalacão do Tomcat manualmente.

https://tomcat.apache.org/download-80.cgi

wget "TAR.GZ URL"

sudo mkdir /opt/tomcat
sudo tar xvf apache-tomcat-7*tar.gz -C /opt/tomcat  --strip-components=1

editar tomcat-users.xml — Admin User

nano /opt/tomcat/conf/tomcat-users.xml

<tomcat-users>
   <user username="admin" password="password" roles="manager-gui,admin-gui"/>
</tomcat-users>

 

TOMCAT AUTOSTART

nano /etc/init.d/tomcat
#!/bin/bash

### BEGIN INIT INFO
# Provides:        tomcat7
# Required-Start:  $network
# Required-Stop:   $network
# Default-Start:   2 3 4 5
# Default-Stop:    0 1 6
# Short-Description: Start/Stop Tomcat server
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin
export JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre/bin/java
export CATALINA_HOME=/opt/tomcat

start() {
 sh /opt/tomcat/bin/startup.sh
}

stop() {
 sh /opt/tomcat/bin/shutdown.sh
}

case $1 in
  start|stop) $1;;
  restart) stop; start;;
  *) echo "Run as $0 <start|stop|restart>"; exit 1;;
esac

SH Permissions

chmod 755 /etc/init.d/tomcat
update-rc.d tomcat defaults