Gaz's picture

Update: I've built the basic outline of a GlassFish v3 appliance with tklpatch. While already operational, it could certainly do with some improvements. The GlassFish tklpatch is now finished! Note that GlassFish requires a minimum of 1GB of RAM (2GB recommended), so make sure to size your virtual machines accordingly.

Because GlassFish v3 and the latest Sun JDK 6 are not available via the standard repositories, my tklpatch uses a manual installation. The resulting ISO is 275MB, which is a considerable jump on the standard TurnKey Core at 112MB. The attached tklpatch (glassfish.tar) is not a complete tklpatch, please run the script provided in the TAR file and read the instructions below.

Firstly we are going to set ourselves up with a development environment. Secondly we will build  our appliance.

A) Installing the development environment

  1. Download the TurnKey Core edition from
  2. Install in VirtualBox with 512MB of RAM on a >=5GB disk with two network adapters, a HostOnly (to allow access from host) and a NAT (to allow internet access).
  3. Run the virtual machine using the TurnKey Core ISO
  4. Install to Hard Disk
  5. Select the install to hard disk option
  6. Use guided partitioning
  7. Write changes to disks
  8. Set root password
  9. Unmount ISO, restart

B) Download and install development software

  1. SSH into the turnkey client
  2. Update the repository
    root@core:~# apt-get update
  3. Install TKLPatch
    root@core:~# apt-get install tklpatch

C) Create a Glassfish v3 Appliance

Note: We need to install Sun JDK manually to get the latest version as required by GlassFish. We also need to install GlassFish manually as it isn't in the repositories (yet).


  1. Download the Sun Java SE JDK 6u18 from the internet. Choose the *.bin (non-RPM) download from
  2. Download Glassfish v3 Final full (not web profile) from
  3. Download the attached glassfish.tar file
  4. Use SCP over SSH (FileZilla) to copy the three downloaded files above into the virtual machine. Also copy over the TurnKeyLinux Core ISO.
  5. Extract the tar file
    root@core:~# tar -xvf glassfish.tar
  6. Run the script to build your ISO
    root@core:~# ./
  7. Test in a virtual machine!


That's it! Some notes:

  • The application server is automatically started by a script at /etc/init.d/glassfish which has configuration files in the /home/glassfish/autodomains directory.
  • The application server runs under the glassfish user not as root.
  • The default passwords provided by GlassFish are used.


Alon Swartz's picture

Excellent documentation, nicely done! It would be great if you could attach a patch without the downloaded files so it would be a little easier to test the patch (sort of a patch template).

BTW, I created an entry of glassfish in the TKLPatch section of the development wiki linking here, feel free to update it as you see fit.
Gaz's picture

I've posted the patch as an attachment with a shell script that runs all of the steps that were previously listed. Simply follow the directions in the posting above.

Gaz's picture

No, this is Linux + Glassfish only. Glassfish has its own web server. But you could configure it to go via Apache if you want. However this is more common with Tomcat deployments than with Glassfish.

Add new comment