Installing Tomcat 7 with OpenJDK on Tiny Core Linux

Pre-requisites for Installing Tomcat 7

Follow my earlier tutorials for installing Tiny Core Linux and Java,

This tutorial uses Tiny Core Linux 4.1 and OpenJDK6. However the steps are similar if you use Java 7 or Oracle binaries for Java.

Installing Tomcat 7 with OpenJDK on Tiny Core Linux

Go to Tomcat 7 download page and note down a mirror URL for the tomcat-7.0.22.tar.gz file. From the Tiny Core Linux terminal download the file using wget (depending on the mirror the URL may be different),

wget http://apache.petsads.us/tomcat/tomcat-7/v7.0.22/bin/apache-tomcat-7.0.22.tar.gz

downloading tomcat 7 tiny core linux

Since I have already configured /opt as a persistent folder in the hard drive, I decided to install tomcat in /opt. Copy the downloaded tomcat zip file to /opt.

mv apache-tomcat-7.0.22.tar.gz /opt

Extract the tomcat binaries using the tar command,

cd /opt

tar -xzf apache-tomcat-7.0.22.tar.gz

Now we have tomcat 7 installed in /opt/apache-tomcat-7.0.22. To start tomcat, change to the bin folder and invoke the startup script,

cd /opt/apache-tomcat-7.0.22/bin

./startup.sh

You can verify whether tomcat is running by accessing the default URL using wget,

wget http://localhost:8080

How to Start Tomcat on Tiny Core Linux Startup (Boot) ?

You can configure Tomcat to start automatically whenever Tiny Core Linux is booted. Any command added to /opt/bootlocal.sh in Tiny Core Linux is invoked during system startup. Add the following lines to bootlocal.sh to start Tomcat on system startup,

export CATALINA_HOME=/opt/apache-tomcat-7.0.22
export JAVA_HOME=/usr/local/openjdk-6
/opt/apache-tomcat-7.0.22/bin/startup.sh

Note that the environment variables are required since they may not be set properly when bootlocal.sh commands are invoked.

When Tiny Core Linux was installed with Tomcat 7 and OpenJDK on VirtualBox, the size of the virtual disk created was under 150MB. So this combination is an ideal portable OS for testing your Java web applications on Linux!

Click here to receive Distro Tips updates in your email. Confirm your subscription by clicking on the link sent to you by feedburner!

Speak Your Mind