Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Unzip or untar (be careful to use GNU tar) the file containing the administration web app files (eg. apache-tomcat-5.5.17-admin.zip) to a temporary directory, eg. c:\temp.

  2. Copy c:\temp\apache-tomcat-5.5.17\conf\Catalina\localhost\admin.xml to the directory c:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\Catalina\localhost.
  3. Copy the entire directory tree c:\temp\apache-tomcat-5.5.17\server\webapps\admin to the directory c:\Program Files\Apache Software Foundation\Tomcat 5.5\server\webapps.
  4. Add a line to your c:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\tomcat-users.xml file so that you have a user who has admin role. For example, add this line just before the last line (containing </tomcat-users>) of the file:
    <user username="admin" password="makesomethingup" roles="admin,manager"/>
  5. Restart Tomcat.
  6. Now when you visit _http://localhost:8080/admin_ you should see a page that asks for a user name and password. If you still see the "no longer loaded" error message in your browser, you must either force a full reload of the web page (in Firefox, hold down Shift key while clicking on the Reload button) or just restart your browser completely.

How do I get Tomcat automatic startet as a Linux daemon?

Parts taken from the Tomcat manual...

  1. Compile and make "jsvc":
No Format
    
    cd $CATALINA_HOME/bin
    tar xvfz jsvc.tar.gz
    cd jsvc-src
    autoconf
    ./configure
    make
    cp jsvc ..
    cd ..

2. Now that "jsvc" is in your Tomcat bin-dir, you'll need a script:

No Format

#!/bin/bash

export JAVA_HOME="/PUT YOUR JAVA_HOME HERE/"
CATALINA_HOME=/PUT YOUR CATALINA_HOME HERE/
PIDFILE=/var/run/jsvc.pid

case "$1" in

  start)
    if [ -e $PIDFILE ] ; then
        echo "Tomcat already running!"
        exit 0
    else
        echo -n "Starting Tomcat                                                   "
        cd $CATALINA_HOME
        ./bin/jsvc -Djava.endorsed.dirs=./common/endorsed -cp ./bin/bootstrap.jar \
        -outfile ./logs/catalina.out -errfile ./logs/catalina.err \
        org.apache.catalina.startup.Bootstrap
        sleep 5
            if [ -e $PIDFILE ] ; then
                echo "[OK]"
                exit 0
            else
                echo "[FAIL]"
                exit 1
            fi
    fi
    ;;

  stop)
    if [ ! -e $PIDFILE ] ; then
        echo "Tomcat already stopped!"
        exit 0
    else
        echo -n "Stopping Tomcat                                                   "
        cd $CATALINA_HOME
        ./bin/jsvc -stop $PIDFILE
            if [ ! -e $PIDFILE ] ; then
                echo "[OK]"
                exit 0
            else
                echo "[FAIL]"
                exit 1
            fi
    fi
    ;;

  *)
    echo "Usage tomcat.sh start/stop"
    exit 1
    ;;
esac

3. Name this script "tomcat" and put it into your "/etc/init.d/" (don't forget to have it executable..)

4. Place symlinks to "/etc/init.d/tomcat" in the "rcX.d" - directories:

No Format

for rc0.d:   ln -s /etc/init.d/tomcat K92tomcat
for rc1.d:   ln -s /etc/init.d/tomcat K92tomcat
for rc2.d    ln -s /etc/init.d/tomcat S92tomcat
for rc3.d    ln -s /etc/init.d/tomcat S92tomcat
for rc4.d    ln -s /etc/init.d/tomcat S92tomcat
for rc5.d    ln -s /etc/init.d/tomcat S92tomcat
for rc6.d    ln -s /etc/init.d/tomcat K92tomcat

The K-letter in the linkname tells init to call the script with the argument "stop" The S-letter in the linkname tells init to call the script with the argument "start"

Check the number-part of the linkname for Apache! Mine was 91 (e.g. S91apache2). Chose one higher to get Tomcat started after Apache.

Since the script checks if Tomcat is already started, there will be no harm (smile)

That's it. Worked fine for me.