Here is a small tutorial for all who want to install Apache Tomcat on a QNAP.
First of all, download Java and Apache Tomcat and upload on your NAS.
Below are the paths to install Java and Apache Tomcat that I used :
- Java : /share/Qweb/java6
- Tomcat : /share/Qweb/tomcat6
Then, I have created the file tomcat.sh on the root of tomcat6.
#!/bin/sh
#Tomcat self-starting
#Auteur : Cyril GRANDJEAN
#Description : Self-starting de tomcat
#name of the process : tomcat
#pid of : /var/run/tomcat.pid
RETVAL=0
QPKG_NAME="tomcat6"
_exit()
{
/bin/echo -e "Error: $*"
/bin/echo
exit 1
}
JRE_HOME="/share/Qweb/java6"
CATALINA_HOME="/share/Qweb/tomcat6"
case $1 in
start)
sh /share/Qweb/tomcat6/bin/startup.sh
;;
stop)
sh /share/Qweb/tomcat6/bin/shutdown.sh
;;
restart)
sh /share/Qweb/tomcat6/bin/shutdown.sh
sh /share/Qweb/tomcat6/bin/startup.sh
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit $RETVAL
Then, to use it as a package on the interface of the QNAP, I have used the following commands :
echo "[tomcat6]" >> /etc/config/qpkg.conf
echo "Name = Tomcat6" >> /etc/config/qpkg.conf
echo "Version = 6.0" >> /etc/config/qpkg.conf
echo "Enable = TRUE" >> /etc/config/qpkg.conf
echo "Shell = /share/Qweb/tomcat6/tomcat.sh" >> /etc/config/qpkg.conf
You can now use Apache Tomcat on your QNAP.