Glassfish V3 on Ubuntu 9.10 (Karmic)

A quick recipe for installing Glassfish V3 into /opt on Ubuntu:

# sudo -s
# aptitude update
# aptitude install sun-java6-jdk wget unzip
# cd /opt
# wget http://download.java.net/glassfish/v3/release/glassfish-v3.zip
# unzip glassfish-v3.zip
# useradd –system glassfish -d /opt/glassfishv3
# sudo chgrp -R admin /opt/glassfishv3-prelude 
# sudo chown -R glassfish /opt/glassfishv3-prelude
# sudo chmod -R +x /opt/glassfishv3/bin/
# sudo chmod -R +x /opt/glassfishv3/glassfish/bin/
# /opt/glassfishv3/bin/asadmin start-domain domain1 

There doesn’t seem to be an init script included within the distribution zip…. so:
  • # vi /etc/init.d/glassfish
  • past the following into the file:

#! /bin/sh

    GLASSFISHHOME=/opt/glassfishv3
    case “$1” in
    start)
        ${GLASSFISHHOME}/bin/asadmin start-domain domain1
        ;;
    stop)
        ${GLASSFISHHOME}/bin/asadmin stop-domain domain1
        ;;
    restart)
        ${GLASSFISHHOME}/bin/asadmin stop-domain domain1
        ${GLASSFISHHOME}/bin/asadmin start-domain domain1
        ;;
    *)
        echo $”usage: $0 {start|stop|restart}”
        exit 1
    esac

  • edit the file to suit and save
  • set permissions and use update-rc.d to ensure its run at system start/stop:

# chmod a+x /etc/init.d/glassfish
# update-rc.d /etc/init.d/glassfish defaults

4 thoughts on “Glassfish V3 on Ubuntu 9.10 (Karmic)

  1. According to the glassfish website the minimum required version of the Java SDK is 1.6.0_15 on MacOSX & 1.6.0_17 on everything else, whereas the version on Karmic seems to be 1.6.0_15-b03. Have you not noticed any problems because of this?

    Anyway, thanks for sharing the instructions!

    Like

  2. okay, I just followed your instructions (thanks again!), and found a few small mistakes…

    there are a couple of presumably old references to 'glassfishv3-prelude' — removing the '-prelude' fixed that.

    and this line:

    update-rc.d /etc/init.d/glassfish defaults

    should be (I believe):

    update-rc.d glassfish defaults

    also, the result of the wget was not simply 'glassfish-v3', but also contained a '?' followed by some URL attributes. I guess a wget -o 'glassfish-v3' would fix that.

    Anyway, thank you.

    Like

  3. okay, I just followed your instructions (thanks again!), and found a few small mistakes…

    there are a couple of presumably old references to 'glassfishv3-prelude' — removing the '-prelude' fixed that.

    and this line:

    update-rc.d /etc/init.d/glassfish defaults

    should be (I believe):

    update-rc.d glassfish defaults

    also, the result of the wget download was not simply named 'glassfish-v3', but also contained a '?' followed by some URL attributes. I guess a wget -o 'glassfish-v3' would fix that.

    Anyway, thank you for saving me loads of time.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s