Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added startup on boot and jdk-devel package

...

Code Block
[root@c5 ~]# yum install java-1.6.0-openjdk java-1.6.0-openjdk-devel
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.27.1.10.8.el5_8 set to be updated
--> Processing Dependency: jpackage-utils >= 1.7.3-1jpp.2 for package: java-1.6.0-openjdk
--> Processing Dependency: libasound.so.2(ALSA_0.9)(64bit) for package: java-1.6.0-openjdk
--> Processing Dependency: libasound.so.2(ALSA_0.9.0rc4)(64bit) for package: java-1.6.0-openjdk
--> Processing Dependency: tzdata-java for package: java-1.6.0-openjdk
--> Processing Dependency: libXtst.so.6()(64bit) for package: java-1.6.0-openjdk
--> Processing Dependency: libasound.so.2()(64bit) for package: java-1.6.0-openjdk
--> Processing Dependency: libgif.so.4()(64bit) for package: java-1.6.0-openjdk
--> Running transaction check
---> Package alsa-lib.x86_64 0:1.0.17-1.el5 set to be updated
---> Package giflib.x86_64 0:4.1.3-7.3.3.el5 set to be updated
---> Package jpackage-utils.noarch 0:1.7.3-1jpp.2.el5 set to be updated
---> Package libXtst.x86_64 0:1.0.1-3.1 set to be updated
---> Package tzdata-java.x86_64 0:2012c-3.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                        Arch               Version                                    Repository           Size
========================================================================================================================
Installing:
 java-1.6.0-openjdk             x86_64             1:1.6.0.0-1.27.1.10.8.el5_8                updates              36 M
Installing for dependencies:
 alsa-lib                       x86_64             1.0.17-1.el5                               base                414 k
 giflib                         x86_64             4.1.3-7.3.3.el5                            base                 39 k
 jpackage-utils                 noarch             1.7.3-1jpp.2.el5                           base                 61 k
 libXtst                        x86_64             1.0.1-3.1                                  base                 16 k
 tzdata-java                    x86_64             2012c-3.el5                                updates             181 k

Transaction Summary
========================================================================================================================
Install       6 Package(s)
Upgrade       0 Package(s)

Total download size: 37 M
Downloading Packages:
(1/6): libXtst-1.0.1-3.1.x86_64.rpm                                                              |  16 kB     00:00     
(2/6): giflib-4.1.3-7.3.3.el5.x86_64.rpm                                                         |  39 kB     00:00     
(3/6): jpackage-utils-1.7.3-1jpp.2.el5.noarch.rpm                                                |  61 kB     00:00     
(4/6): tzdata-java-2012c-3.el5.x86_64.rpm                                                        | 181 kB     00:00     
(5/6): alsa-lib-1.0.17-1.el5.x86_64.rpm                                                          | 414 kB     00:00     
(6/6): java-1.6.0-openjdk-1.6.0.0-1.27.1.10.8.el5_8.x86_64.rpm                                   |  36 MB     00:02     
------------------------------------------------------------------------------------------------------------------------
Total                                                                                    16 MB/s |  37 MB     00:02     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : alsa-lib                                                                                         1/6 
  Installing     : giflib                                                                                           2/6 
  Installing     : libXtst                                                                                          3/6 
  Installing     : jpackage-utils                                                                                   4/6 
  Installing     : tzdata-java                                                                                      5/6 
  Installing     : java-1.6.0-openjdk                                                                               6/6 

Installed:
  java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.27.1.10.8.el5_8                                                                 

Dependency Installed:
  alsa-lib.x86_64 0:1.0.17-1.el5     giflib.x86_64 0:4.1.3-7.3.3.el5      jpackage-utils.noarch 0:1.7.3-1jpp.2.el5    
  libXtst.x86_64 0:1.0.1-3.1         tzdata-java.x86_64 0:2012c-3.el5    

Complete!
[root@c5 ~]# java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.8) (rhel-1.27.1.10.8.el5_8-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
[root@c5 ~]# 

...

Code Block
[root@c5 lams-installer]# mkdir -p /var/opt/lams
[root@c5 lams-installer]# chown -R lams:lams /var/opt/lams
[root@c5 lams-installer]# 

...

Login as sysadmin (u: sysadmin p: sysadmin) and you are ready to go.

Start on boot

If you need LAMS to start on boot (as service) then get start-stop-daemon to help you with this.

Code Block

# cd /tmp
# yum install gcc
# wget "http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz"
# tar xvzf apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz 
# cd apps/sys-utils/start-stop-daemon-IR1_9_18-2/
# gcc start-stop-daemon.c -o start-stop-daemon
# cp start-stop-daemon /usr/sbin/

Now create a file called lams2 in /etc/init.d folder (as root) and modify the script below according to your setup (specifically the IP):

Code Block

#!/bin/sh
# lams2        This shell script takes care of starting and stopping
#
# chkconfig: 2345 90 20 
# description:  LAMS 2
# processname: java
#
#               Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#               Modified for Debian
#               by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#               Modified for LAMS
#               by Ernie Ghiglione <ernieg@lamsfoundation.org>.
#
# Version:      @(#)skeleton  1.9  26-Feb-2001  miquels@cistron.nl
#

# Attempt to locate JAVA_HOME, code borrowed from jabref package

if [ -z $JAVA_HOME ]
then
        t=/usr/lib/jvm/java-1.6.0 && test -d $t && export JAVA_HOME=$t  
fi
JBOSS_USER=lams
JAVA_HOME=/usr/lib/jvm/java-1.6.0
PATH=/sbin:/bin:/usr/sbin:/usr/bin:${JAVA_HOME}/bin
JAVA=${JAVA_HOME}/bin/java
JBOSS_HOME=/usr/local/jboss-5.1
NAME=default
DESC="LAMS 2 Server $NAME"
IP=50.97.254.234

test -x $JAVA || exit 0

# Read an optional running configuration file
if [ "x$RUN_CONF" = "x" ]; then
    RUN_CONF="${JBOSS_HOME}/bin/run.conf"
fi
if [ -r "$RUN_CONF" ]; then
    . "$RUN_CONF"
fi

# Setup the java endorsed dirs
JBOSS_ENDORSED_DIRS="$JBOSS_HOME/lib/endorsed"

# Setup the classpath
runjar="$JBOSS_HOME/bin/run.jar"
if [ ! -f "$runjar" ]; then
    die "Missing required file: $runjar"
fi
JBOSS_BOOT_CLASSPATH="$runjar"

# Include the JDK javac compiler for JSP pages. The default is for a Sun JDK
# compatible distribution which JAVA_HOME points to
if [ "x$JAVAC_JAR" = "x" ]; then
    JAVAC_JAR="$JAVA_HOME/lib/tools.jar"
fi

if [ "x$JBOSS_CLASSPATH" = "x" ]; then
    JBOSS_CLASSPATH="$JBOSS_BOOT_CLASSPATH:$JAVAC_JAR"
else
    JBOSS_CLASSPATH="$JBOSS_CLASSPATH:$JBOSS_BOOT_CLASSPATH:$JAVAC_JAR"
fi

DAEMON_OPTS="$JAVA_OPTS -Djava.endorsed.dirs=$JBOSS_ENDORSED_DIRS -classpath $JBOSS_CLASSPATH -Dprogram.name org.jboss.Main -b $IP -c $NAME" 

#set -e
start() {
        start-stop-daemon --start --chuid $JBOSS_USER --quiet --background --make-pidfile --pidfile $JBOSS_HOME/$NAME.pid --exec $JAVA -- $DAEMON_OPTS

}

stop() {
        start-stop-daemon --stop --quiet --pidfile $JBOSS_HOME/$NAME.pid
}
case "$1" in
  start)
        echo "$DESC is starting up."
        start
        ;;
  stop)
        echo -n "Stopping $DESC... "
        stop
        rm -f /var/run/$NAME.pid
        echo "stopped."
        ;;
  status)
        if [ -e /var/run/$NAME.pid ]; then
            if [ -r /var/run/$NAME.pid ]; then
                pid=`cat /var/run/"$NAME".pid`
                if [ "X$pid" = "X" ]; then
                    echo "$DESC is not running."
                    exit 1
                else
                    echo "$DESC is running ($pid)."
                    exit 0
                fi
            fi
        fi
        echo "$DESC is not running."
        ;;
  restart|force-reload)
        #
        #       If the "reload" option is implemented, move the "force-reload"
        #       option to the "reload" entry above. If not, "force-reload" is
        #       just the same as "restart".
        #
        echo -n "Restarting $DESC: "
        #set +e
        stop
        #set -e
        sleep 10
        start
        ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
        exit 1
        ;;
esac

exit 0

Now, make this file executable:

Code Block

# chmod +x /etc/init.d/lams2

Set this and mysql up for startup on boot:

Code Block

# cd /etc/init.d
# chkconfig --levels 235 lams2 on
# chkconfig --levels 235 mysqld on

And you are done!

For further details, please check out the Sysadmin Guide

...