This is small tutorial on how to install Glassfish v3 on Ubuntu Server 10.04 LTS
Before everything else, it is always good idea to check weather system is up to date and upgrade anything that needs updating:
Now, after you're sure system is up-to-date, you can move on. There are some prerequisites GlassFish server requires so install them:
During JDK installation you will be presented with license agreement - accept it.
Now you can get to business and install GlassFish server. 3.0.1. There are couple of ways of doing it - you can use .sh installation script or download .zip. If you decide to go on with .sh installation script, bear in mind that it requires GUI enabled server system. There are ways to perform installation without GUI (through CLI) but it did not work flawlessly for me. Anyhow, after downloading .sh installation file to your installation directory (i personally use wget to download scripts and store all installation scripts in /home/install directory) start it with
or
Silent installation (no need for GUI) is possible with
but like I already said, it did not workout every time for me.
If your system does not have GUI installed (like most server systems, including mine) than download zipped version:
After downloading .zip archive, unzip it and move unziped glassfishv3 directory to appropriate location (for installations of this type I use /opt directory). After this, server is more-less ready to be started - you just need to create appropriate system user and set appropriate permissions.
First add a glassfish system user:
Then, set admin group:
After that set glassfish as the owner:
Now, you need to determine executable files. First go into the install directory (/otp/glassfishv3) and there set the executable files:
This is more-less everything. To test your installation you can start the default glassfish domain (domain1)
and check if it works on http://server:8080/ or log in on administration console on http://server:4848/ If you can see pages / log-in into administrative console, than everything is fine.
To have GlassFish start automatically when you start Ubuntu you need to add a GlassFish file to the
In this file enter the following:
Change the users rights:
Then install it on all runlevels:
Now you can start | restart | stop your GlassFish v3 installation using standard commands:
Apart from running default domain doman1, I suppose you will wish to create domains of your own. This can be done rather easy using command
Durnig domain creation you'll be asked to define administrator and master username and passwords - fill in according to your wishes. Script will automatically create fill directory structure for new domain. If you create new domain(s) than you'll also need to change glassfish init.d script accordingly.
That is it! I hope this tutorial was helpfull and that you found what you were looking for.
Before everything else, it is always good idea to check weather system is up to date and upgrade anything that needs updating:
sudo apt-get update
sudo apt-get upgradeNow, after you're sure system is up-to-date, you can move on. There are some prerequisites GlassFish server requires so install them:
sudo apt-get install sun-java6-jdkDuring JDK installation you will be presented with license agreement - accept it.
Now you can get to business and install GlassFish server. 3.0.1. There are couple of ways of doing it - you can use .sh installation script or download .zip. If you decide to go on with .sh installation script, bear in mind that it requires GUI enabled server system. There are ways to perform installation without GUI (through CLI) but it did not work flawlessly for me. Anyhow, after downloading .sh installation file to your installation directory (i personally use wget to download scripts and store all installation scripts in /home/install directory) start it with
sudo ./glassfish-3.0.1-unix.shor
sudo sh /path/to/script.shSilent installation (no need for GUI) is possible with
sudo sh -u /path/to/script.shbut like I already said, it did not workout every time for me.
If your system does not have GUI installed (like most server systems, including mine) than download zipped version:
sudo wget http://download.java.net/glassfish/3.0.1/release/glassfish-3.0.1.zipAfter downloading .zip archive, unzip it and move unziped glassfishv3 directory to appropriate location (for installations of this type I use /opt directory). After this, server is more-less ready to be started - you just need to create appropriate system user and set appropriate permissions.
First add a glassfish system user:
sudo useradd --system glassfish -d /opt/glassfishv3 Then, set admin group:
sudo chgrp -R admin /opt/glassfishv3 After that set glassfish as the owner:
sudo chown -R glassfish glassfishv3 Now, you need to determine executable files. First go into the install directory (/otp/glassfishv3) and there set the executable files:
sudo chmod -R +x bin/
sudo chmod -R +x glassfish/bin/ This is more-less everything. To test your installation you can start the default glassfish domain (domain1)
cd /opt/glassfishv3/bin
sudo ./asadmin start-domain domain1 and check if it works on http://server:8080/ or log in on administration console on http://server:4848/ If you can see pages / log-in into administrative console, than everything is fine.
To have GlassFish start automatically when you start Ubuntu you need to add a GlassFish file to the
/etc/init.d/ folder. Pick you favorite editor (I use nano) and create glassfish file:sudo nano /etc/init.d/glassfish In this file enter the following:
#! /bin/sh
GLASSFISHPATH=/opt/glassfishv3/bin
case "$1" in
start)
echo "starting glassfish from $GLASSFISHPATH"
sudo -u glassfish $GLASSFISHPATH/asadmin start-domain domain1
;;
restart)
$0 stop
$0 start
;;
stop)
echo "stopping glassfish from $GLASSFISHPATH"
sudo -u glassfish $GLASSFISHPATH/asadmin stop-domain domain1
;;
*)
echo $"usage: $0 {start|stop|restart}"
exit 3
;;
esac
:Change the users rights:
sudo chmod a+x /etc/init.d/glassfish Then install it on all runlevels:
sudo update-rc.d glassfish defaults Now you can start | restart | stop your GlassFish v3 installation using standard commands:
/etc/init.d/glassfish [start|restart|stop]Apart from running default domain doman1, I suppose you will wish to create domains of your own. This can be done rather easy using command
[glassfish]/bin/asadmin create-domain --adminport 4848 mydomainDurnig domain creation you'll be asked to define administrator and master username and passwords - fill in according to your wishes. Script will automatically create fill directory structure for new domain. If you create new domain(s) than you'll also need to change glassfish init.d script accordingly.
That is it! I hope this tutorial was helpfull and that you found what you were looking for.
No comments:
Post a Comment