Installing Apache Tomcat on Raspberry Pi

In this post, I will be documenting the process of running Apache Tomcat on Raspberry Pi 2.

Before we start installing Tomcat, it would be good to do a update.

sudo apt-get update

After the update, verify that you have java 8 installed. At this stage if everything is going correctly, you should already have java 8 installed.

java -version

Now we will start downloading Apache Tomcat via wget

cd /opt
tar xzf apache-tomcat-9.0.0.M8.tar.gz
mv apache-tomcat-9.0.0.M8 tomcat9

Now that tomcat is downloaded and extracted from the zip to the respective location. Before we process to the next step, we need to get bash on evaluated permission by typing the below

sudo bash

With that, we could proceed to set the environment variable.

echo 'export CATALINA_HOME='/opt/tomcat9'' >> /etc/environment
echo 'export JAVA_HOME='/usr/lib/jvm/java-8-oracle'' >> /etc/environment
echo 'export JRE_HOME='/usr/lib/jvm/java-8-oracle/jre'' >> /etc/environment
source ~/.bashrc

Next we will need to perform a set up of the various user accounts for using the gui management.

You would have to go to conf/tomcat-users.xml  and added in the below. Replace _SECRET_PASSWORD_ with your secured password.

<pre><!-- user manager can access only manager section -->
<role rolename="manager-gui" />
<user username="manager" password="_SECRET_PASSWORD_" roles="manager-gui" />

<!-- user admin can access manager and admin section both -->
<role rolename="admin-gui" />
<user username="admin" password="_SECRET_PASSWORD_" roles="manager-gui,admin-gui" /></pre>

Once that is done, you could launch tomcat by doing the below

cd /opt/tomcat9

You should now see something like

Using CATALINE_BASE: /opt/tomcat9
Using CATALINE_HOME: /opt/tomcat9

Verify that tomcat is running by going to the browser and point to http://localhost:8080

It is also important to go into /conf/server.xml to change the port that tomcat listen to from 8080 to 80 if that is what you requires on your client side.

References used

How to Install Tomcat 9 (Alpha) on Ubuntu, Debian & LinuxMint

Bash evaluated permission

This entry was posted in apache tomcat, Raspberry Pi and tagged , , , , , . Bookmark the permalink.

1 Response to Installing Apache Tomcat on Raspberry Pi

  1. I would add that in context.xml for webapp “manager” you should uncomment Valve to allow access to tomcat remotely.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s