How to install Tomcat 8.0.0 RC5 on Ubuntu 12.04/12.10/13.04/13.10

Photo of author

By rasho

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.0.0 RC5 on Ubuntu 12.04/12.10/13.04/13.10 server. 

Apache Tomcat 8.0.0-RC5 installation

Before you install Tomcat 8.0.0 RC5, you need to install Java.

# sudo apt-get install openjdk-7-jdk

Now, download Apache Tomcat 8.0.0 RC5:

# wget http://apache.osuosl.org/tomcat/tomcat-8/v8.0.0-RC5/bin/apache-tomcat-8.0.0-RC5.tar.gz

Extract and move to /usr/local/ Apache Tomcat package:

# tar -xvf apache-tomcat-8.0.0-RC5.tar.gz
#sudo mv mv apache-tomcat-8.0.0-RC5 /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
/etc/init.d/tomcat8
/etc/init.d/tomcat8

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:

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

Set username and password to manage tomcat
Set username and password to manage tomcat

[ads]
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.

Tomcat 8 default page
Tomcat 8 default page
Tomcat server status page
Tomcat server status page
Tomcat virtual host manager
Tomcat virtual host manager

6 thoughts on “How to install Tomcat 8.0.0 RC5 on Ubuntu 12.04/12.10/13.04/13.10”

  1. I am struggling to install solr 4.7.2 with tomcat 8.

    I followed your instructions to install Tomcat 8.0.5 but Solr, which was manually installed, doesn’t appear in /etc, and my instructions require it – http://webikon.com/cases/installing-apache-solr-4-7-multicore-on-ubuntu-12-04-and-tomcat7

    Now, let’s a get Solr into Tomcat Catalina config. Create a new solr.xml file:

    $ sudo nano /etc/tomcat7/Catalina/localhost/solr.xml

    Any advice on how to establish /etc/tomcat8/Catalina/localhost/solr.xml on my ubuntu server?

    Reply
  2. I think there is a typo toward the end. Perhaps:

    # sudo update-rc.d tomcat747 defaults

    should be

    # sudo update-rc.d tomcat8 defaults

    Otherwise very helpful, thanks!

    Reply
  3. i installed but for the 1st time it was running,after that if i try to shutdown tomcat,it is not shutdowning.SEVERE: Could not contact localhost:8005. Tomcat may not be running.
    Nov 21, 2014 4:39:21 AM org.apache.catalina.startup.Catalina stopServer
    SEVERE: Catalina.stop:
    java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:579)
    at java.net.Socket.connect(Socket.java:528)
    at java.net.Socket.(Socket.java:425)
    at java.net.Socket.(Socket.java:208)
    at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:498)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:370)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:457)
    can u help? thnks in advance

    Reply

Leave a Comment