This tutorial will install Glassfish from Sun for Web Java Server.
For this tutorial, we will be using:
java-SDK version 1.6.0_07
glassfish-installer-v2ur2-b04-linux.jar
mysql-server 5
Lets get started…
First follow the tutorial Basic Net Installation.(time approx. 20 minutes)
Then you must add Backports repository by following Add BackPort Repository Howto.
After you have completed the above, you can start this tutorial…
Enter the following commands to install java6-JDK:
apt-get install sun-java6-jdk
java -version
You should get this:
java version “1.6.0_07″
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)
Next, we need to setup the environment variable JAVA_HOME for java to find it’s libraries.
JAVA_HOME=/usr/lib/jvm/java-6-sun
export JAVA_HOME
echo $JAVA_HOME
/usr/lib/jvm/java-6-sun
Get the latest Stable Glassfish package at https://glassfish.dev.java.net/
cd /usr/src/
wget http://java.net/download/javaee5/v2ur2/promoted/Linux/glassfish-installer-v2ur2-b04-linux.jar
java -Xmx256M -jar glassfish-installer-v2ur2-b04-linux.jar
mv glassfish /opt
chgrp -R root /opt/glassfish/
cd /opt/glassfish
Add the executable attribute to all the files under /opt/glassfish/lib/ant/bin/
chmod -R +x lib/ant/bin/
lib/ant/bin/ant -f setup.xml
bin/asadmin start-domain domain1
Let’s make the server executable on boot
add glassfish file in /etc/init.d/
#! /bin/sh
GLASSFISHPATH=/opt/glassfish/bin
case “$1″ in
start)
echo “starting glassfish from $GLASSFISHPATH”
$GLASSFISHPATH/asadmin start-domain domain1
;;
restart)
$0 stop
$0 start
;;
stop)
echo “stopping glassfish from $GLASSFISHPATH”
$GLASSFISHPATH/asadmin stop-domain domain1
;;
*)
echo $”usage: $0 {start|stop|restart}”
exit 3
;;
esac
:
Don’t forget to make this script executable:
chmod a+x /etc/init.d/glassfish
update-rc.d glassfish defaults 90 10
You can try the new script with the command ‘/etc/init.d/glassfish restart’
to finish this tutorial, let’s add MySQL server 5:
apt-get install mysql-server
mysqladmin -u root password yourrootsqlpassword
The previous line will secure your database server
to access the web server(please replace localhost with the server IP address):
http://localhost:8080/
https://localhost:8181/
If you want to administer the web server:
http://localhost:4848/
Username: admin
Password: adminadmin
Have fun developping Java web applications…
Here are a few references:
https://glassfish.dev.java.net/ (link for the Glassfish project)
http://confluence.atlassian.com/display/JIRA/Installing+Java+on+Ubuntu+o…
http://jars.de/english/how-to-set-up-glassfish-2-on-debian-or-ubuntu (excellent link)
http://computingwithjasper.blogspot.com/2008/01/installing-glassfish-2-o…
Jack