LAMP+Glassfish server in openSUSE 11.4

After the openSUSE 11.4 release, I thought about deploying a home server, with web, database and application server (Glassfish in my case).

First of all, a standard text-based system installation has to be done, you can add the specific patterns during installation process, but I prefer to add specific repositories after installation, as I would like to program in Java and learn some other languages:

  • openSUSE 11.4 11.4-0 updates
  • BuildService de openSUSE – Databases
  • openSUSE BuildService – Java:packages
  • openSUSE BuildService – devel:languages:per
  • openSUSE BuildService- PHP
  • openSUSE BuildService – devel:languages:python
  • Main repository (Contrib)
  • openSUSE-11.4-11.4-0
  • Packman Repository
  • openSUSE-11.4-Debug
  • openSUSE-11.4-Update-Debug
  • openSUSE-11.4-Non-Oss
  • openSUSE-11.4-Oss
  • openSUSE-11.4-Source

After adding those repositories (from YaST, community repositories), a zypper dup operation was performed (so the system gets updated to the latest package versions, no matter in what repository are they stored)

Finally, some the command to finish the package installation: zypper in -t pattern lamp_server.

You have to open the ports the firewall ports in YaST (and configure apache server to start on system boot): yast2->net services -> http server -> enable http server+open firewall ports.

After the whole process is done, you should be able to see the “It works!” web page (default for an apache web server installation).

To install glassfish in the new server, you should type the following (as root):

# cd /opt/
# wget -c http://download.java.net/glassfish/3.1/release/glassfish-3.1-ml.zip
 
# unzip
# rm glassfish-3.1-ml.zip
 

Now you have to create the init.d scripts:

# vi /etc/init.d/glassfish

And copy this into the script:

#! /bin/sh
GLASSFISHPATH=/opt/glassfish3/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

You need to add permissions to new file (thanks to David Blanco):
#chmod a+x /etc/init.d/glassfish

You can now start the server by typing :

# /etc/init.d/glassfish start

And finally, access the server in the host url+port 4848

Have fun!