Install GlassFish Application Server


Download

$ wget http://download.oracle.com/glassfish/4.1/release/glassfish-4.1.zip

Unzip

$ unzip glassfish-4.1.zip

Create domain

$ glassfish4/bin/asadmin create-domain test1

Enter admin user name [Enter to accept default "admin" / no password]>alex
Enter the admin password [Enter to accept default of no password]> 
Enter the admin password again> 
Using default port 4848 for Admin.
Using default port 8080 for HTTP Instance.
Using default port 7676 for JMS.
Using default port 3700 for IIOP.
Using default port 8181 for HTTP_SSL.
Using default port 3820 for IIOP_SSL.
Using default port 3920 for IIOP_MUTUALAUTH.
Using default port 8686 for JMX_ADMIN.
Using default port 6666 for OSGI_SHELL.
Using default port 9009 for JAVA_DEBUGGER.
Distinguished Name of the self-signed X.509 Server Certificate is:
[..]
Distinguished Name of the self-signed X.509 Server Certificate is:
[..]
Domain test1 created.
Domain test1 admin port is 4848.
Domain test1 admin user is "alex".
Command create-domain executed successfully.

Start Domain

$ glassfish4/bin/asadmin start-domain test1

    Waiting for test1 to start .....
    Successfully started the domain : test1
    domain  Location: /home/jeeserver/glassfish4/glassfish/domains/test1
    Log File: /home/jeeserver/glassfish4/glassfish/domains/test1/logs/server.log
    Admin Port: 4848
    Command start-domain executed successfully.

See whats going on

$ tail -f /home/jeeserver/glassfish4/glassfish/domains/test1/logs/server.log

Deploy some module

$ scp my-ejb.jar [server-user]@[server-address]:/home/jeeserver/glassfish4/glassfish/domains/test1/autodeploy

If the server is not localhost:

Remote administration is disabled per default. To enabe this, set an admin password and enable secure-admin:

$ glassfish4/bin/asadmin change-admin-password --domain_name test1 $ glassfish4/bin/asadmin enable-secure-admin --port 4848