Installing GlassFish on Debian over SSH from Mountain Lion

23. 9. 2012 Johan Hornof

1. Install XQuartz for Mountain Lion

Apple do not ship X11 by default anymore so you have to install it by your own. The easiest way is to download and install XQuartz from here:

http://xquartz.macosforge.org

It requires logging out and back in after the installation proceeds.

2. Launch XQuartz

You'll find the application in Application > Utilities. Now we're ready with the local setup. Let's do the remote in the next steps.

3. SSH to the remote machine

$ ssh user@server

4. Install Sun Java

Maybe you can use another Java distribution but it's safe to use the one from Oracle.

$ apt-get install sun-java6-jdk

Verify that you have set the JAVA_HOME environment variable with

$ echo $JAVA_HOME

if its not set, run:

$ JAVA_HOME=/usr/lib/jvm/java-6-sun
$ export JAVA_HOME

Now you can check the java version with:

$ java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

5. Install X server on the remote machine

$ apt-get install xserver-xorg-core xorg

By default, you're not allowed to execute the xserver. Fix is easy:

$ sudo dpkg-reconfigure x11-common

Then, select the option “Anyone”.

6. SSH with X forwarding

Log out from the current ssh session. Launch XQuartz and ssh with X forwarding enabled:

$ ssh -Y user@server

7. Download Glassfish Installer

Download the installer with wget from

http://glassfish.java.net

8. Configure the display

$ export DISPLAY=localhost:10.0

 

9. Run the installer

$ chmod +x glassfish_installer.sh
$ ./glassfish-X.X.X.X-unix.sh
Extracting the installer archive...
Extracting the installer runtime...
Extracting the installer resources...
Extracting the installer metadata...
Welcome to GlassFish installer
Using the user defined JAVA_HOME : /usr/lib/jvm/java-6-sun
Entering setup...
SwixML 1.5 (#144)

10. Finish the Installation

...and the installer window opens on your Mac. Follow the instruction of the installer and you're done!

Note that the X forwarding consumes quite a lot bandwidth so I recommend doing this on a good internet connection or preferably via local network.