Install notes:
Install Java JDK 8 and unzip
sudo -s
aptitude update
aptitude install --with-recommends software-properties-common
add-apt-repository ppa:webupd8team/java
aptitude update
aptitude --with-recommends install oracle-java8-installer unzip
Verify your java install
java -version
Should get out put of something like
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
Download and unzip Glassfish 4.1
wget http://dlc.sun.com.edgesuite.net/glassfish/4.1/release/glassfish-4.1.zip
unzip glassfish-4.1.zip -d /opt
Startup Glassfish just to make sure all is well
cd /opt/glassfish4/bin
./asadmin start-domain
Install the start/stop scripts for Glassfish
./asadmin create-service
Change the blank/empty admin password to something else
./asadmin change-admin-password
Enable secure administration so you can administer via web interface from another PC
./asadmin enable-secure-admin
Enable a listener port so that you can front Glassfish with Apache
./asadmin create-network-listener --protocol http-listener-1 --listenerport 8009 --jkenabled true jk-connector
Copy some JDBC drivers not included in default installation (Optional of course)
cp postgresql-9.3-1102.jdbc41.jar /opt/glassfish4/glassfish/domains/domain1/lib/ext (PostgreSQL Driver)
cp mysql-connector-java-5.1.31-bin.jar /opt/glassfish4/glassfish/domains/domain1/lib/ext (MySQL Driver)
cp sqljdbc4.jar /opt/glassfish4/glassfish/domains/domain1/lib/ext (MS-SQL Driver)