OpenBD Wiki

From OpenBD
Jump to: navigation, search

Apache Tomcat on CentOS/RedHat

This page describes the installation of Tomcat and OpenBD on CentOS/RedHat 5.x. The OpenBD application server requires a Java application server to run on. The installation of Java, Tomcat and then OpenBD follow.

Be sure to check out the OpenBD Official Manual page for further help http://openbd.org/manual/

Contents

Java

There are many tutorials on the web how to install Java the best way. In any case, I have installed Java on RedHat systems many times and this has worked all the time 100%.

  1. Install the "jpackage-utils" first
yum install jpackage-utils
  1. Download Java from the Sun Website at http://java.sun.com/javase/downloads/index.jsp and download the one labeled with "Java SE Development Kit (JDK)".
    1. On the following page choose your Linux type
    2. After that, make sure you choose download the "jdk-6u13-linux-i586-rpm.bin" one (as of this writing the update 13 was available).
  2. Once downloaded do the following:
    1. Chmod +x jdk-6u13-linux-i586-rpm.bin
    2. ./jdk-6u13-linux-i586-rpm.bin

This will start the installation process for the JDK. Actually there is nothing else to do anymore. You should check if Java is installed with:

java -version

If you get something like the below all is well:

java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)

If this fails, you can also try the alternative method to install Java. The CentOS Wiki at http://wiki.centos.org/HowTos/JavaOnCentOS is a great resource for that.

Install Tomcat

With CentOS/RedHat you could install Tomcat from the YUM repositories, but they only hold the older 5.5.x version. Of course, if you want to have Version 5.5.x installed then you only have to issue a;

yum install tomcat*

But I do recommend that you install Tomcat 6.0.18 (the current version of this writing), since it features better memory handling and some other improvements. The official Tomcat page is your friend in this regard http://tomcat.apache.org/. Luckily, installing Tomcat is straight forward.

  1. Download Tomcat 6.0.18
    1. Browse to http://tomcat.apache.org/download-60.cgi and download the Binary Distribution or click on the direct link here http://apache.mirror.testserver.li/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.tar.gz. Wget is your friend.
  2. I recommend to install Tomcat in the "/opt" directory. Thus copy the downloaded file into "/opt".
  3. Extract it with
tar xzvf apache-tomcat-6.0.18.tar.gz
  1. For better handling I always create a symbolic link for "tomcat" with
ln -s /opt/apache-tomcat-6.0.18 tomcat
  1. Test Tomcat
    1. Start Tomcat with:
/opt/tomcat/bin/startup.sh
    1. Hit http://localhost:8080. If all is fine you should see the Tomcat homepage.

All should be fine, right? Ok, move on.

Deploy (Install) OpenBD

  1. go into the tomcat folder
    1. cd /opt/tomcat/
  2. download the openbd.war file (be sure to check the OpenBD download site for the latest war file link)
    1. wget http://openbd.viviotech.net/downloader.cfm/id/64/file/openbd.war
  3. once the file has downloaded move it to the tomcat webapps folder where it will automatically deploy
    1. mv /opt/tomcat/openbd.war /opt/tomcat/webapps
  4. once the war file is in webapps Tomcat will pick it up and create an openbd folder
  5. go to the administrator
    1. http://localhost:8080/openbd/bluedragon/administrator
      1. the default bluedragon administrator password is admin

Configure Tomcat to run on startup

Now, that Tomcat and OpenDB runs nicely you might want to have it automatically started when you reboot your system. For that we can use the following script and "chkconfig" command line.

  1. Create a "tomcat" file in "/etc/init.d"
vi /etc/init.d/tomcat
  1. Copy the below startup script
#!/bin/bash
#
# Init file for SixSigns Tomcat server
#
# chkconfig: 2345 55 25
# description: SixSigns Tomcat server
#

# Source function library.
. /etc/init.d/functions

RUN_AS_USER=tomcat # Adjust run user here
CATALINA_HOME=/opt/tomcat

start() {
        echo "Starting Razuna Tomcat: "
        if [ "x$USER" != "x$RUN_AS_USER" ]; then
          su - $RUN_AS_USER -c "$CATALINA_HOME/bin/startup.sh"
        else
          $CATALINA_HOME/bin/startup.sh
        fi
        echo "done."
}
stop() {
        echo "Shutting down Razuna Tomcat: "
        if [ "x$USER" != "x$RUN_AS_USER" ]; then
          su - $RUN_AS_USER -c "$CATALINA_HOME/bin/shutdown.sh"
        else
          $CATALINA_HOME/bin/shutdown.sh
        fi
        echo "done."
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        sleep 10
        #echo "Hard killing any remaining threads.."
        #kill -9 `cat $CATALINA_HOME/work/catalina.pid`
        start
        ;;
  *)
        echo "Usage: $0 {start|stop|restart}"
esac

exit 0
  1. Save the file (case you forgot "esc + x) :-)
  2. Add the tomcat startup script to the chkconfig with:
chkconfig --add tomcat
  1. Then activate it for your run level. Since I am not running any X Server on my server I only want to run it on level 345. Do it with:
chkconfig --level 345 tomcat on
  1. You can check if Tomcat will startup on reboot with listing the startup scripts with:
chkconfig --list

You should see a;

tomcat         	0:off	1:off	2:on	3:on	4:on	5:on	6:off
  1. If you have done all well, you should now be able to bounce Tomcat with this script as well. Try it with:
/etc/init.d/tomcat restart

Related Resources

  1. Apache Tomcat
  2. Peformance Tips for Tomcat and OpenBD

Personal tools