Step 1
On Raspbian Wheezy, the Java is preisntalled (/usr/lib/jvm/jdk-7-oracle-armhf/jre/bin),
but in case it is not there you can install it easily.
There is no need to be Unix guru, all you need is to perform:
sudo apt-get update && sudo apt-get install oracle-java7-jdk
Our Apache Tomcat server needs to know where the Java is located.export JAVA_HOME="/usr/lib/jvm/jdk-7-oracle-armhf"
export PATH=$PATH:$JAVA_HOME/bin
Check the path echo $JAVA_HOME.
Step 2
Installing the Tomcat is not tricky too.
Download it from:
http://tomcat.apache.org/download-70.cgi
After the download completes, untar the file.
tar -zxvf apache-tomcat-7.0.50.tar.gz
Where,
-z : Uncompress the resulting archive with gzip command.
-x : Extract to disk from the archive.
-v : Produce verbose output i.e. show progress and file names while extracting files.
-f data.tar.gz : Read the archive from the specified file called data.tar.gz.
In order to start Tomcat, we need to add it as an environment variable in the /.bashrc file: sudo nano ~/.bashrc
We have add next rows to the end of the file:
export export JAVA_HOME=/usr/lib/jvm/jdk-7-oracle-armhf
export CATALINA_HOME=~/home/pi/apache-tomcat-7.0.50
After saving the additions we can make the changes effective by restarting the bashrc file: ~/.bashrc
It is more convenient to have Tomcat started on each linux startup.
For that we have to create start script and place it in /etc/init.d
sudo nano tomcat7
#!/bin/sh
# Short-Description: Start Tomcat.
# Description: Start the Tomcat servlet engine.
# Tomcat 7 init-script
CATALINA_HOME=/home/pi/apache-tomcat-7.0.50
export CATALINA_HOME
JAVA_HOME=/usr/lib/jvm/jdk-7-oracle-armhf
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
case $1 in
start)
sh $CATALINA_HOME/bin/startup.sh
echo "tomcat7 started successfully"
;;
stop)
sh $CATALINA_HOME/bin/shutdown.sh
echo "tomcat7 stoped successfully"
;;
restart)
sh /home/pi/apache-tomcat-7.0.50/bin/shutdown.sh
sh /home/pi/apache-tomcat-7.0.50/bin/startup.sh
echo "tomcat7 restarted successfully"
;;
*)
sh $CATALINA_HOME/bin/startup.sh
echo "tomcat7 started successfully"
;;
esac
exit 0
After saving it with Ctrl ^x, we have to make it executable.
sudo chmod 751 tomcat7
sudo update-rc.d tomcat7 defaults
Check if it works, type sudo reboot, after the restart, type in RP Midori browser the address of the default Tomcat's page: http://localhost:8080
Step 3
Now download the MySQL archve from: To be continued...