How to Setup Glassfish on Ubuntu or CentOs Print

  • 210

How to install Glassfish on a virtual or dedicated server.

Note: # prompt is root and $ prompt is the user prompt

1- Upload JDK bin - preferably Oracle Sun JDK.

(be sure to get 32 or 64 based on what you using for your OS)

# cd /usr/# mkdir java# cd java# wget # unzip

Note: If unzip does not work then do apt-get install unzip and try again.

2- Create symlink to simplify so that you can create path to it as /usr/java/jdk6

# ln -s jdk1.6.0_33 jdk6

3- Create user and home directory to host your tomcat and set shell to bash

# useradd -d /home/myapp -m myapp# chsh myapp -s /bin/bash

4- Change to user and set JAVA_HOME

# su - myapp $ nano .bashrc

Add the following at the end of the file:

## JAVA_HOME variables
export JAVA_HOME

5- Save file then run following command to initialize.

$ . .bashrc

6- Test

$ java -version

You should get this output if it works:

java version "1.6.0_33"Java(TM) SE Runtime Environment (build 1.6.0_33-b04)Java HotSpot(TM) Client VM (build 20.8-b03, mixed mode)

7- Get Glassfish 3

$ wget

8- Unzip

$ unzip

9- Start up your Glassfish to see if it works

Glassfish comes with domain1 already setup and ready to go. Use this for testing.

$ cd glassfishv3/glassfish/bin/$ ./startserv domain1

Use CTRL-C to cancel

10- Test your installation

Test by opening your browser and going to http://YOURIP:8080 and you should be greeted with the Glassfish welcome page.

You can start your application in the background using nohup:

nohup ./startserv domain1 2>&1 &

Was this answer helpful?

« Back