Glassfish V3 Installation on Linux (for beginners…)
sometimes we just need to intall a new server on a new virtual machine or at the start of a new project.
Here I wil just try to redefine the steps to install and configure a Glassfish V3 server on a Linux machine. Just afer that we will probably need to install a complete continuous platform of integration (with a Nexus or Archiva, a Hudson or continuum, Maven, Sonar, .., …) but it’s another subject. So maybe for a future post
Well, let’s start by reminding what needs a Glassfish to run: a JDK.
In our case, we will first install a JDK6, so let’s begin with that.
1.Installation of the JDK6
URL of the JDK 6 : http://java.sun.com/javase/downloads/index.jsp
The file should be called : « jdk-6u20-linux-i586-rpm.bin » (in the case of the version 20 of the JDK 6)
Juste paste the file in the directory
/usr/java. If this directory does not exists, create it.
To install the JDK, move into the /usr/java directory and launch the following commands :
chmod 755 jdk-6u20-linux-i586-rpm.bin
To check the correct installation of the JDK6, move into the
/usr/java/jdk1.6.0_20 directory and launch :
You should see a message like this one:
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02-279-10M3065)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01-279, mixed mode)
We will now export 2 variables which will point to the Java and Glassfish installation directory (Glassfish will be installed on the next chapter).
Open or create the
Insert the following lines at the beginning of the file :
1.5.update your profile
To immediately update our profile without having to disconnect and reconnect yourself, just enter the command :
2.Installation of Glassfish Server V3
Ok, now we are ready to install and use Glassfish, so we will first began by downloading the latest version.
URL of Glassfish V3 :
The direct URL : « http://download.java.net/glassfish/v3/release/glassfish-v3-unix.sh »
On Linux (with a X environment) the installation is very easy and we just need to launch the setup (like in a Windows or MacOs world).
- Create the destination directory by the following command :
- move the installation file previously downloaded in the new directory
- Launch the next line to start the installation :
This last command will launch the installation wizard and will create a “
glassfish” directory into the
Let the default values during the installation (only the installation directory and the admin password should be changed).
3.Deployment of an application (a WAR file) in Glassfish V3
You can deploy a WAR in Glassfish by several ways :
- copy the WAR directly into the
domain-dir/autodeploy/directory (my be just in development environment, cause of the performance issues)
- Use the Glassfish’ admin console
- Use Ant script
- Use asadmin script
- Use an EDI (Eclipse, NetBeans, …)
3.1Deploy with the admin console
- To launch the admin console, be first sure that the Glassfish server is running (
Then launch the web page at the following URL : http://localhost:4848
- Open the node « Application ».
- Clik on the « Deploy » button.
- Select the option “Package file to be uploaded to the Application Server.”
- Select thefull adress of the WAR file and then click on the OK button.
- Click on Next.
- Enter the name of the application.
- Enter the Context-Root.
- Select the checkbox “Enabled”.
- Click on “End”.
3.2Deploy with asadmin
To deploy a WAR with asadmin, open a terminal and launch the command :
asadmin deploy full-path-to-war-file
3.3Deploy with Ant
To deploy a WAR with Ant, open a terminal on the directory containing the war file and launch the command :
Here is where to download the needed files :
Here is the official documentation :
I hope this post could help at least someone
Feel free to ask me questions about the deployment or other questions related to the deployment and continuous integration.