Tuesday, November 6, 2012

Installing Glassfish server on Linux

Installing Glassfish server on Linux

1. Install SDK http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1637583.html

In my case I downloaded rpm : jdk-7u5-linux-x64.rpm

Let’s set global JAVA_HOME

vi /etc/profile and add :

JAVA_HOME=/usr/local/java; export JAVA_HOME

/usr/local/java is the location where java sdk will be installed.

Let’s get to it:
rpm -ihv jdk-7u5-linux-x64.rpm

Preparing…                ########################################### [100%]

1:jdk                    ########################################### [100%]

Unpacking JAR files…

rt.jar…

jsse.jar…

charsets.jar…

tools.jar…

localedata.jar…

This installs it into: /usr/java/jdk1.7.0_05 ? You can check where files are with the commands:

rpm -ql jdk-1.7.0_05-fcs.x86_64|more


In rhel/fedora you can either remove dummy java symlink or point to your actual install. I am talking about:

/etc/alternatives/java

ls -la /etc/alternatives/java
lrwxrwxrwx 1 root root 46 2011-09-05 18:46 /etc/alternatives/java -> /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
rm /etc/alternatives/java
rm: remove symbolic link `/etc/alternatives/java’? y
ln -s /usr/java/jdk1.7.0_05/bin/java /etc/alternatives/java
ls -la /etc/alternatives/java
lrwxrwxrwx 1 root root 30 2012-06-13 10:45 /etc/alternatives/java -> /usr/java/jdk1.7.0_05/bin/java
java -version
java version “1.7.0_05?

Java(TM) SE Runtime Environment (build 1.7.0_05-b05)

Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)

Let’s take care of symlink for our JAVA_HOME
ln -s /usr/java/jdk1.7.0_05 /usr/local/java
ls -la /usr/local/java
lrwxrwxrwx 1 root root 21 2012-06-13 10:44 /usr/local/java -> /usr/java/jdk1.7.0_05

2. Download glassfish server for Linux:

chmod +x ogs-3.1.2-unix.sh

*Please note* if you are planning to bind to ports < 1024 you need to run it as root, otherwise any local/Kerberos user is fine. There’s also a workaround to “bind” to port 80. You can contact me for more info.

sh ./ogs-3.1.2-unix.sh

Unfortunterally, by default it requires X windows. There are command line options available too, however I do have vnc and this is the method I chose to install. You would have to vnc as oracle into your server. You can check my Enabling VNC server on Linux as 1,2,3 quick guide.

Once GUI opens up just follow on-screen instructions
Glassfish is installed in : /usr/local/glassfish3

I created stop and start scripts:

cat stop.sh

bin/asadmin stop-domain domain1
cat start.sh

nohup bin/asadmin start-domain –verbose &

At this point you can launch firefox locally and point your browser to:
http://localhost:4848




2 comments: