Blogs - You must sign in to post comments. Registration takes 30 seconds. Blogs - You must sign in to post comments. Registration takes 30 seconds.
Blogs »
How to set up an Ubuntu, Glassfish, MySQL, Java stack

Follow these instructions to get a nice clean install of the GUMJ stack. That could be the MyJUG stack though by that logic the LAMP stack might become the MyLAP stack...  anyways... here's how I set up Ubuntu, MySql, Connector/J, Glassfish and Java on Ubuntu.

These instructions were carried out on a VMWare virtual machine with Ubuntu 9.10 Server minimal install.  During installation I selected the virtualization and minimal packages.  If you're not running in a virtual machine there's no need to include the virtualization package.  I'm not going to go into further details on this here as it's a pretty straight forward follow the on screen prompts install and I'll post full installation guide for the Ubuntu 10.04 LTS release at the end of this month.

One thing to note about these instructions is that the Glassfish Application Server (formerly Sun Java System Application Server) will run as root.  This is not best practice for a production environment and was done for simplicity in my environment.  I will update these instructions after the Ubuntu 10.04 release with details on how to install and run Glassfish as a non-privileged system user.  Update:  Ubuntu, Glassfish, MySQL, Java stack on Ubuntu 10.04 Lucid Lynx Server

Environment:

  • Ubuntu 9.10 Server, minimal install with SSH Server

Configuration:

  • Server IP Address: 192.168.180.160
  • Username: username1

Procedure:

All these instructions can be entered at the command prompt or over an SSH connection.

1.  [optional] Connect to the SSH Server form remote client (enter password if requested)

ssh 192.168.180.160 -l username1

2.  Update the repository index and upgrade all packages

sudo aptitude update
sudo aptitude upgrade

3.  Install the required packages

sudo aptitude install sun-java6-jdk wget nano

4.  Create a user download directory and download the latest Glassfish (I chose the multi-language version)

cd /home/username1
mkdir Downloads
cd Downloads
sudo wget http://download.java.net/javaee5/v2.1.1_branch/promoted/Linux/glassfish-installer-v2.1.1-b31g-linux-ml.jar

5.  Copy the Glassfish install jar to where you'd like to install Glassfish.

sudo cp /home/username1/Downloads/glassfish-installer-v2.1.1-b31g-linux-ml.jar /opt

6.  Run the installer then you can remove the install jar.

cd /opt
sudo java -Xmx256m -jar glassfish-installer-v2.1.1-b31g-linux-ml.jar
sudo rm glassfish-installer-v2.1.1-b31g-linux-ml.jar

7.  Give executable permissions to the Glassfish ant scripts and run setup.  This will create domain1 with http port 8080, https on 8181 and admin on 4848.

cd glassfish
sudo chmod -R +x lib/ant/bin
sudo lib/ant/bin/ant -f setup.xml

8.  Create a startup and shutdown script for Glassfish.

sudo nano /etc/init.d/glassfish

9.  Add the following to the file

#!/bin/bash
GLASSFISHHOME=/opt/glassfish
case "$1" in
start)
    ${GLASSFISHHOME}/bin/asadmin start-domain domain1
    ;;
stop)
    ${GLASSFISHHOME}/bin/asadmin stop-domain domain1
    ;;
restart)
    ${GLASSFISHHOME}/bin/asadmin stop-domain domain1
    ${GLASSFISHHOME}/bin/asadmin start-domain domain1
    ;;
*)
    echo $"usage: $0 {start|stop|restart}"
    exit 1
esac

Save and exit nano (Ctrl+o,Ctrl+x)

10.  Make the script executable and set it for automatic startup and shutdown.

sudo chmod +x /etc/init.d/glassfish
sudo update-rc.d glassfish defaults

At this stage you have a working Glassfish install.  The remaining steps will install the MySql Server and allow Glassfish connect to the database server.  Skip to step 15 now if you do not wish to use MySql Server.

11.  Install MySql Server

sudo aptitude install mysql-server

12.  Download MySql Connector/J

cd /home/username1/Downloads
sudo wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.12.tar.gz/from/http://sunsite.informatik.rwth-aachen.de/mysql/

13.  Extract the contents

tar xvfz mysql-connector-java-5.1.12.tar.gz

14.  Add the Connector/J jar to the domain1 lib directory and remove the extracted folder

cd mysql-connector-java-5.1.12
sudo cp mysql-connector-java-5.1.12-bin.jar /opt/glassfish/domains/domain1/lib
cd ..
rm -r mysql-connector-java-5.1.12

15.  Reboot the server to ensure all went well.

sudo reboot

You can now log into the Glassfish Application Server at http://192.168.180.160:4848/

Username: admin
Password: adminadmin

It's a good idea to change the default password as soon as you log in.  Application Server > Administrator Password

Previous

  • Comments
Trackback URL:

Profile Profile
Garry Donnelly Garry Donnelly
 Open Source Enthusiast
Follow Garry Donnelly on TwitterFollow me on Twitter
Follow Great White IT on TwitterFollow Great White IT on Twitter
View Garry Donnelly on Linked InView my Linked In Profile
Add the Great White IT RSS feedAdd my RSS feed

    Born in Ireland, worked in Dublin, London and Australia on IT projects for financials, hi-tech and energy sectors.  Currently interested in exploring the potential of open source tech for small and medium enterprise.   Would love to spend some time working in the US or Canada next - I'm addicted to travel after Australia.  If you're involved in a project you think might be of interest to me please get in contact.

Blogs Aggregator Blogs Aggregator
How to Install Oracle Sun Java JDK and JRE in Ubuntu 10.04 Lucid Lynx
ubuntu java 10.04 lucid lynx oracle sun icedtea openjdk
For the sake of completeness I've decided to add an entry on the alternatives for installing the propriety licensed version of the Oracle ( Sun Microsystems ) JDK and JRE.  This applies to
How to solve Ubuntu 10.04 Lucid Lynx and Windows Dual Boot hanging on load
ubuntu lucid lynx dual boot grub upgrade windows
Had a issue today with getting my Dual Boot Windows Media Center and Ubuntu Desktop to start.  This Medion box was originally a Window Media Center install which I'd added dual booting Ubuntu
Ubuntu, Glassfish, MySQL, Java stack on Ubuntu 10.04 Lucid Lynx Server
glassfish mysql ubuntu java linux connectorj myjug 10.04 lucid lynx server headless server oracle sun microsystems
Following on from my entry on installing Linux Ubuntu 10.04 Lucid Lynx Server I'm revisiting how to set up the  Ubuntu , Glassfish , MySql , Connector/J , and Java (MyJUG)
Thirty Screenshots to Install Ubuntu 10.04 Lucid Lynx Server
ubuntu vmware 10.04 lucid lynx minimal install server virtual machine
In this visual tutorial I will run through how to install the latest version of Ubuntu 10.04 Server LTS .  This edition of Ubuntu will remain in maintenance for 5 years so now is a good time to
Ubuntu Lucid Lynx 10.04 LTS free to download NOW
ubuntu openoffice 10.04 accessibility canonical compiz empathy evolution f-spot firefox gimp inscape lts lucid lynx me menu openarena rythmbox tomboy ubuntu one
The latest release of the Ubuntu Operating System in free to download or torrent today!  Code named Lucid Lynx and version number 10.04 this is a significant release for the Ubuntu
Subscribe to this blog. Subscribe to this blog.
Showing 1 - 5 of 12 results.
Items per Page
Page of 3
Widgets Widgets

Technology Blogs