How to install Tomcat 8 on Debian 8

install_tomcat_on_a_debian8_vpsApache Tomcat, often referred to as Tomcat, is an open-source application server developed by the Apache Software Foundation. It implements several Java EE specifications and executes Java servlets rendering Web pages that include Java Server Page coding in the process.

In this article we will guide you through the steps on installing the latest Tomcat 8 server on a Debian 8 VPS.

This guide should work on other Debian systems as well but was tested and written for a Debian 8 (Jessie) OS.

Login to your server via SSH

ssh root@server_ip

Reassure that you have the proper version of Debian installed on our server :

# lsb_release -a

Distributor ID: Debian
Description:    Debian GNU/Linux 8.2 (jessie)
Release:        8.2
Codename:       jessie


We will be using our SSD 1 Linux VPS hosting plan for this tutorial.


Make sure your server is fully up to date and install wget and unzip:

# apt-get update && apt-get upgrade

# apt-get install unzip wget


Add the webupd8team Java PPA repository in your Debian system. After that you will be able to install the latest JRE (Java SE Runtime Environment) which is needed for Tomcat to run. Issue the following commands:

# echo "deb trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list

# echo "deb-src trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list

# apt-key adv --keyserver --recv-keys EEA14886

Update the package index and install Java 8:

# apt-get update

# apt-get install oracle-java8-installer

Check if Java has been properly installed:

# java -version

The following output should be received:

java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)


We recommend you to create a separate system user which will run the Tomcat server. Therefore, issue the following command:

# useradd -r tomcat --shell /bin/false

Now download the latest Tomcat version from their official website. Use the below command to download Tomcat 8.0.41 into the ‘opt’ directory.

# wget -P /opt

Enter the ‘opt’ directory:

# cd /opt

Unpack the archive:

# tar -zxf /opt/apache-tomcat-8.0.41.tar.gz

Next, create a symbolic link of the Tomcat directory to /opt/tomcat-latest and set the appropriate ownership:

# ln -s /opt/apache-tomcat-8.0.41 /opt/tomcat-latest

# chown -hR tomcat: /opt/tomcat-latest /opt/apache-tomcat-*

Let’s create a systemd init file so you can start/restart/stop Tomcat.

# nano /etc/systemd/system/tomcat.service

Once opened, paste the following:



Environment="JAVA_OPTS=-Dfile.encoding=UTF-8 -Dnet.sf.ehcache.skipUpdateCheck=true -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+UseParNewGC -XX:MaxPermSize=128m -Xms512m -Xmx512m"

ExecStop=/bin/kill -15 $MAINPID


Enter the underneath commands to start Tomcat and enable it to start on boot:

# systemctl daemon-reload
# systemctl restart tomcat
# systemctl enable tomcat

Congratulations, you have successfully installed Tomcat 8 on your Debian 8 VPS. Now to access Tomcat, open your favorite web browser and navigate to http://your_server_IP:8080

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install Tomcat 8 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Install GitLab on a CentOS Linux VPS with Nginx and MySQL
Install OpenCart 2 on an Ubuntu 14.04 VPS with Nginx and PHP-FPM
Install GitBucket on Ubuntu 16.04
  • anand


    Author Reply

    • admin


      Author Reply

      We updated the Tomcat download link URL to match the latest Tomcat version.

  • Jon


    Author Reply

    How do I stop tomcat (to update wars etc) and then restart?

    • admin


      Author Reply

      What do you mean “stop Tomcat to update wars”? To restart Tomcat use systemctl restart tomcat

  • William


    Author Reply

    can you explain why you are using
    -ExecStop=/bin/kill -15 $MAINPID
    instead of

    • admin


      Author Reply

      You can use ExecStop=/opt/tomcat-latest/bin/ instead of ExecStop=/bin/kill -15 $MAINPID if you want.

  • darek


    Author Reply

    For all, having problems with this HOW TO guide.
    There is a bug in string
    Environment=”JAVA_OPTS=-Dfile.encoding=UTF-8 -Dnet.sf.ehcache.skipUpdateCheck=true -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+UseParNewGC -XX:MaxPermSize=128m -Xms512m -Xmx512m”
    Following by
    its shoud looks like: ‘-Dfile.encoding=UTF-8”-Dnet.sf.ehcache.skipUpdateCheck=true ‘
    single quotes between every entry and no spaces. (Well, in any case singlequotes and no spaces).
    Secundo, you need to add extra permissions to user tomcat, at least to /bin and /logs, or it wont work properly.
    At the end, add —– systemctl enable service_name —> systemctl enable tomcat for autostart tomcat service.
    PS. With oracle Java, check: echo $JAVA_HOME
    PS2. If you are not able to start tomcat.service, check /opt/tomcat_latest/bin/ (check your path!). If tomcat starts, check logs folder, catalina.out is good place to start.

Free Migration to RoseHosting. Award Winning Linux VPS Hosting with Fully Managed Support. Coupon RHBLOG50 for 50% offOrder Now