Installing Glassfish on Ubuntu Server 11.04 (No GUI)

Because the self-extracting shell script used to install Glassfish requires the use of a GUI by default, installing Glassfish on a system like Ubuntu Server is not quite a straightforward is one may think.

To install Glassfish without a GUI, one must use a not-so-known silent install mode. To do this, an answer file (a text file that contains installation settings) must be supplied using argument -a, and argument -s must be supplied. For example:

./glassfish-3.1-unix.sh -a answerFileName -s

To generate an answer file, however, one must run the installer in trial mode:

./glassfish-3.1-unix.sh -n answerFileName

The only problem with this is that generating the answer file in trial mode also requires the use of a GUI. In my case, I wanted to install Glassfish on my Natty Ubuntu Server on Amazon EC2, which does not have a GUI. Using another Ubuntu machine I generated an answer file to install using silent mode (see above).

If you’d like to use the answer file I used: Click here. This answer file has the most basic settings set, with an admin password of “password.”

Hopefully this saves someone a little time!