下記を参考
http://qiita.com/digdagdag/items/4d26b477bfa3c51771f8
download Java SE Development Kit 8u121 / Linux x64 rpm
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
download Java Platform, Enterprise Edition 7 SDK Update 2
これに GlassFish が含まれている。
http://www.oracle.com/technetwork/java/javaee/downloads/java-ee-sdk-7-downloads-1956236.html
JDK のインストール方法に従ってインストール。
https://docs.oracle.com/javase/jp/8/docs/technotes/guides/install/linux_jdk.html#BJFJHFDD
sudo rpm -ivh jdk-8u121-linux-x64.rpm
JavaEE をインストール。
http://www.oracle.com/technetwork/java/javaee/documentation/javaee7sdk-install-1957708.html#install
cd /usr/sbin sudo unzip ~/java_ee_sdk-7u2.zip
glassfish4/README.txt に従い GlassFish を起動。
# port が被るので tomcat を止めておく。
$ sudo service tomcat8 stop
$ cd /usr/sbin/glassfish4/glassfish/bin
$ sudo ./asadmin start-domain
Waiting for domain1 to start .......
Successfully started the domain : domain1
domain Location: /usr/sbin/glassfish4/glassfish/domains/domain1
Log File: /usr/sbin/glassfish4/glassfish/domains/domain1/logs/server.log
Admin Port: 4848
Command start-domain executed successfully.
admin の password を設定
$ sudo ./asadmin change-admin-password
$ sudo ./asadmin restart-domain
local PC から remote linux の GlassFish の administration console へ sshトンネルを繋ぐ
$ ssh -N -L 60001:localhost:4848 ec2-user@ec2-xx-xx-xx-xx.us-west-2.compute.amazonaws.com -i private_key.pem &
local PC のブラウザから GlassFish のコンソールヘログイン
http://localhost:60001