You can use this guide to manually
install the glassfish on Ubuntu 12.04 Server
1) Visit https://glassfish.java.net/download.html
to download the latest tomcat installer
2) Unzip it with tar -zxvf glassfishxxx.zip
2) Unzip it with tar -zxvf glassfishxxx.zip
unzip glassfish-3.1.2.zip
Note:
If required, you
should install zip using apt-get install zip
3) Move the folder contents to
required directory. In my case it is /app/glassfish directory
4) Now create a user glassfish to run the glassfish service under this username. Also change the directory permissions to tomcat
4) Now create a user glassfish to run the glassfish service under this username. Also change the directory permissions to tomcat
#useradd glassfish
Or
#adduser glassfish
#chown -R glassfish: glassfish /app/glassfish
Or
#adduser glassfish
#chown -R glassfish: glassfish /app/glassfish
# chmod 775 –R /app/glassfish
5) Check whether java is already
installed by sung this command
#java –version
If it is not installed, then refer this
post to install JDK or refer this post to install JRE
6) Create a file called glassfish in
the following path /etc/init.d/ to create glassfish service file. It should have the following lines in it
GF_USER=glassfish
GF_HOME=/app/glassfish
ASADMIN=$GF_HOME/bin/asadmin
case
"$1" in
start)
echo
"starting glassfish from $GF_HOME"
sudo -u $GF_USER authbind --deep $ASADMIN
start-domain
;;
stop)
echo "stopping glassfish from
$GF_HOME"
sudo
-u $GF_USER authbind --deep $ASADMIN stop-domain
;;
status)
gf_id=$(ps
-ef | grep /app/glassfish/glassfish/domains/domain1/ | grep -v grep | awk
'{print $2}' | head -n 1)
if [ -n "$gf_id" ]
then
echo
"Glassfish is Running with PID:" $gf_id
else
echo
"Glassfish is not Running......."
fi
;;
*)
echo "usage: $0
(start|stop|status|help)"
exit 3
;;
esac
|
Note:
Install authbind if required by typing apt-get install authbind
7) Finally apply 0755 permissions to glassfish file in /etc/init.d/ directory
#chown -R glassfish:glassfish /etc/init.d/glassfish
#chmod 775 /etc/init.d/glassfish |
8) Now you can start the glassfish using any of the following commands
# /etc/init.d/glassfish start
|
9) To link the service in desired run levels in Ubuntu server, install the following utility
#apt-get install sysv-rc-conf
|
10) Then open the utility and enable the glassfish service in all run levels as shown in the screenshot
# sysv-rc-conf
|
11) Done, glassfish is ready for use. You can refer the below blog to enable admin access to glassfish admin console.
This comment has been removed by the author.
ReplyDeleteGreat, thanks for detailed steps :)
ReplyDeleteWelcome sir :)
ReplyDelete