Install Glassfish4 and Java7 on Centos

An easy guide to get glassfish4 and java7 running on you centos 6 server.
First install the java7 and get java working on your server.
Then we download and setup glassfish4.

Installing Java 7

Go to the java download page and get an version of java 7 jdk version. You must first download to you desktop and then copy the jdk over to you server. Oracel don’ t support direct download of java to you server :-(.

I got the file jdk-7u21-linux-x64.tar.gz

Then unpack the file and put in into the folder /usr/java

default -> /usr/java/latest
jdk1.6.0_37
jdk1.7.0_21
latest -> jdk1.7.0_21/

I have an old java 1.6 there as well and then i can change java by changing the latest link.
But no its pointing to the latest java 1.7.
Run the command java -version and you should see the same output as I

Enabling java in new version

alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 20000

alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 20000

alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 20000

alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 20000

 

java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

Now java is installed and working

Installing glassfish 4

download the glassfish form

wget http://download.java.net/glassfish/4.0/release/glassfish-4.0.zip

Unzip

unzip glassfish-4.0.zip

Move to right place

mv glassfish4 /usr/local

start domain

cd /usr/local/glassfish4/bin
 ./asadmin start-domain

Set up admin user and enable login from desktop

./asadmin change-admin-password
 ./asadmin --host 127.0.0.1 --port 4848 enable-secure-admin
 ./asadmin stop-domain
 ./asadmin start-domain

And now you can loggin with the glassfish webb

https://IP-TO-GLASSFISH:4848

  1 comment for “Install Glassfish4 and Java7 on Centos

  1. Sam
    July 25, 2015 at 2:44 am

    Download directly:
    wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie” “http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: