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 wget http://www.us.apache.org/dist/tomcat/tomcat-9/v9.0.0.M8/bin/apache-tomcat-9.0.0.M8.tar.gz 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 ./bin/startup.sh
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
I would add that in context.xml for webapp “manager” you should uncomment Valve to allow access to tomcat remotely.
LikeLike
Thanks for this terrible tutorial.
LikeLike
I have been searching the web to find an easy way to install Tomcat9 on my Pi3 machine This is one of the best and easy to install method I found but there is a couple of problem I have faced which I would like to point out :
1. following Wget link is not working you have to download tar.gz file from the server and manually execute by your self to /opt directory then move to Tomcat9 folder
broken link or didn’t work for me some reason:
wget http://www.us.apache.org/dist/tomcat/tomcat-9/v9.0.0.M8/bin/apache-tomcat-9.0.0.M8.tar.gz
2. I had to remove
tags from script to gain access and add another line for
After these amendment Tomcat9 stop asking me for a password when I click to gain access for Server Status, Manager App only thing I am struggling at the moment is Host manager button Tomcat9 does not even ask me for a user name or password it’s simply denying my access
If you know the reason please guide to right direction also now I have Tomcat9 and apache install I would like to know what to do next lol any suggestion or guidance Welcome
LikeLike