TurnKey Linux Virtual Appliance Library

GlassFish v3 tklpatch

gazzamop'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 glassfish.sh 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 http://www.turnkeylinux.org/
  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 http://java.sun.com/javase/downloads/index.jsp
  2. Download Glassfish v3 Final full (not web profile) from https://glassfish.dev.java.net/downloads/v3-final.html
  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 glassfish.sh script to build your ISO
    root@core:~# ./glassfish.sh
  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.

 

Attached: 
Alon Swartz's picture

Nicely done!

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

Patch posted with script

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.

Guest's picture

Much appreciated

This saved me a lot of work. Thanks for sharing.

Guest's picture

apache??

Is this Linux + Apache + Glassfish?

Gaz's picture

re: apache??

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.

Guest's picture

Update patch

Could some one update this please, or provide manual instructions to install jdk-7u25-linux-x64.tar.gz and ogs-3.1.2.2.zip (glassfish) to turnkey-core-12.1-squeeze-amd64-vmdk.

Oracle no longer provides the .bin of the jdk so I can not just change the file names in the shell script and I have limited experince with shell scripts in any case.

I only need to apply this to one VM so I would prefer to just add the files to the vmdk rather then build a patched iso.

Guest's picture

Glassfish VM

I managed to get a glassfish server running on a TKL core. The following are the steps I  used. No guarantees that this will work for others.

Download the latest tkl-core vm http://www.turnkeylinux.org/core. I used the amd64-vmdk and imported into my esxi 5 server using the vmware convertor. You should at this stage increase the memory to 1Gb otherwise glassfish will be very slow as I found out and had to do it later. Set up your network and timezone as required.

Download the latest version of Java JDK http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1..., I used the x64 tar.gz and glassfish http://www.oracle.com/technetwork/middleware/glassfish/downloads/ogs-3-1..., I used the  Linux/Unix/Mac Zip.

Uploaded these to the vm, I used web min file manager, and extract to your dir of choice, I used /etc. I am not a LInux expert so I am not sure of the proper locations. The files will extract to the current dir, ie /etc. I had to change the owner of the java JDK folders and files to root:root as they were showing user 500:137

Next, set the JAVA_HOME in /etc/profiles. You can set the PATH if you want to. I had a heap problems working this out because the PATH in /etc/profiles was being overwritten by the PATH in /root/.bashrc and the script files in /root/.bashrc.d when I was logged in as root via both ssh and the vm console. Read man bash for more details. In any case it is best to set AS_JAVA = /etc/jdk<version> where <version> is the version of your jdk download in /etc/glassfish3/glassfish/config/asenv.conf

The default domain is started by running asadmin start-domain in /etc/glassfish3/glassfish/bin. the gui web admin tool can be accessed on port 4848 of your server but you will need to run asadmin --host <servername> --port 4848 enable-secure-server and restarting the domain before doing so. The applications in the domain are on port 8080. The default domain can be set to start on boot by using asadmin create-service.

Hope this helps

Graham

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)