Jan
18
2016

Install TomCat 8 on Ubuntu/Debian

Apache tomcat is a Java based application server released by the Apache Software Foundation. It is a web server and a servlet container for Java web applications.

What’s new in Tomcat 8

Apache Tomcat 8 is aligned with Java EE 7. In addition to supporting updated versions of the Java EE specifications,Tomcat 8 includes a number of improvements compared to Tomcat 7. The notable changes include:

  • Support for Java Servlet 3.1, JavaServer Pages 2.3, Java Unified Expression Language 3.0 and Java WebSocket 1.0.
  • The default connector implementation is now the Java non-blocking implementation (NIO) for both HTTP and AJP.
  • A new resources implementation that replaces Aliases, VirtualLoader, VirtualDirContext, JAR resources and external repositories with a single, consistent approach for configuring additional web application resources. The new resources implementation can also be used to implement overlays (using a master WAR as the basis for multiple web applications that each have their own customizations).
  • Improved stability of the APR/native connector when using WebSocket
  • A new drawing board example has been added to the WebSocket examples.
  • Support has been added for directly serving gzipped versions of a resource via the default servlet.

In this tutorial i will show you how to installTomcat 8 on Ubuntu or Debian server. 

Apache Tomcat 8 installation

Before you install Tomcat 8, you need to install Java.

# sudo apt-get install openjdk-7-jdk

Now, download Apache Tomcat 8 (choose your desired version - example uses 8.0.30): 
# wget http://apache.osuosl.org/tomcat/tomcat-8/v8.0.30/bin/apache-tomcat-8.0.30.tar.gz

Extract and move to /usr/local/ Apache Tomcat package:
# tar -xvf apache-tomcat-8.0.30.tar.gz
# sudo mv mv apache-tomcat-8.0.30 /usr/local/

Create tomcat8 file in /etc/init.d/
# sudo vim /etc/init.d/tomcat8

and paste following code:
#!/bin/bash
export CATALINA_HOME=/usr/local/apache-tomcat-8.0.0-RC5
PATH=/sbin:/bin:/usr/sbin:/usr/bin
start() {
 sh $CATALINA_HOME/bin/startup.sh
}
stop() {
 sh $CATALINA_HOME/bin/shutdown.sh
}
case $1 in
  start|stop) $1;;
  restart) stop; start;;
  *) echo "Run as $0 <start|stop|restart>"; exit 1;;
esac

Tomcat8 - Mauro Cesar Fileto

 

This file will create a service named tomcat8. Please change CATALINA_HOME in the code according to your path.
Modify /etc/init.d/tomcat8 file permissions:

# sudo chmod 755 /etc/init.d/tomcat8

Set username and password to manage tomcat and add to:

# sudo vim /usr/local/apache-tomcat-8.0.0-RC5/conf/tomcat-users.xml

and add following line (user and password – define as you would like):

role rolename="manager-gui"
role rolename="admin-gui"
user username="user" password="password" roles="manager-gui,admin-gui"

Tomcat8 - Mauro Cesar Fileto

Start tomcat 8 service:

# sudo /etc/init.d/tomcat8 start

and type this command to start service automatically during reboot:

# sudo update-rc.d tomcat8 defaults

Now open http://serverip:8080 in your browser.

 

Tomcat8 - Mauro Cesar Fileto

 

Tomcat8 - Mauro Cesar Fileto

 

Tomcat8 - Mauro Cesar Fileto

  • Many thanks to rasho for the insight.

 

About the Author: Mauro C. Fileto

Leave a comment

You must be logged into post a comment.

Translate »

Enjoy this blog? Please spread the word :)

RSS
Facebook
Google+
http://www.cesarfileto.com/blog/2016/01/18/install-tomcat-8-on-ubuntudebian/">
Twitter