Installing Tomcat 8 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.

which give this kind of output :

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 Tomcat 8

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

Extract the zipped tarball:

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.

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 :

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

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.

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

Start server

Test that the tomcat server starts:

1$ 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.

tomcat8

To stop just run

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.

guru

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...

Leave a Reply

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