Installing Tomcat8 on Raspberry pi 3

In this tutorial we will be installing tomcat8 on Raspberry pi 3. I have already installed Raspbian on my pi3 which comes with java8 installed.

Check Java Version

Lets kick start our work with checking java current installed java version. You can check if java is installed by running following command.

$ java -version

which give this kind of output :

pi@raspberrypi:/etc/init.d $ java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)


Now we will create a folder in home directory, i created a folder named Tomcat. This folder will be used for installation of tomcat. Go inside that folder.

Download Tomcat8

Next download tomcat8 using wget utility. I am installing version 8.0.41. You can install version you want.

$ wget


Extract the zipped tarball:

$ tar xvf apache-tomcat-8.0.41.tar.gz

Add Tomcat user

To access tomcat manager user interface you have to configure user inside tomcat-users.xml file.

Open ~/Tomcat/apache-tomcat-8.0.41/conf/tomcat-users.xml in some text editor and add following line as child of <users> element.

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

This creates an admin account called “admin” who’s password is “password” and this user can access manager gui which can be used for deployment of war files.

Create Startup Script

Next we have to create a startup script using which we can start and stop tomcat. Add a startup script called tomcat to the /etc/init.d directory, with command :

$ sudo nano /etc/init.d/tomcat

This will create file tomcat in init.d folder. Content of this file goes like this.

# /etc/init.d/tomcat
# starts the Apache Tomcat service
# Provides:          tomcat
# Required-Start:
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# X-Interactive:     true
# Short-Description: Start/stop tomcat application server

export CATALINA_HOME="/home/pi/Tomcat/apache-tomcat-8.0.41"
case "$1" in
  if [ -f $CATALINA_HOME/bin/ ];
    echo $"Starting Tomcat"
    /bin/su pi $CATALINA_HOME/bin/
  if [ -f $CATALINA_HOME/bin/ ];
    echo $"Stopping Tomcat"
    /bin/su pi $CATALINA_HOME/bin/
  echo $"Usage: $0 {start|stop}"
  exit 1

Do not forgot to change CATALINA_HOME as per your structure. Now press control + O to save file and then control + X to close editor.


Next update permissions of this file to executable.

$ sudo chmod 755 /etc/init.d/tomcat


Use the update-rc.d command to add the appropriate links to the /etc/rc.d directories:

$ sudo update-rc.d tomcat defaults

Start server

Test that the tomcat server starts:

$ sudo /etc/init.d/tomcat start

Now if everything goes without any error then you open url http://pi_ip_address:8080 then you can able to see tomcat page. Now click on manager and provide credentials and you get into Tomcat Web Application Manage page.


To stop just run

$ sudo /etc/init.d/tomcat stop

Finally, reboot the system and the Tomcat application server should now start automatically on startup, and likewise when the system shuts down.

Please comment for more clarification.


Technology enthusiast. Loves to tinker with things. Always trying to create something wonderful using technology. Loves coding for Android, Raspberry pi, Arduino , Opencv and much more.

You may also like...

1 Response

  1. November 13, 2018

    […] Le lecteur aura compris que ce livre est avant tout dédié à la programmation Java. Donc la manière naturelle serait de programmer un serveur Web avec des servlets. Je donnerai juste une référence: Installing Tomcat8 on Raspberry pi 3 […]

Leave a Reply

Your email address will not be published. Required fields are marked *