Java/Ubuntu/JBoss/MySql Development Stack Recipe, Free and Fast Part I

This is the first of many blogs on the Java environment.  This shows step by step as to how to install the JDK, JBoss and Eclipse without depending on apt.  The exception is mysql.  The following blog (part II), will show the user how to install Java Development Stack via apt.  I personally don’t like my Java (in both the Linux and Windows) environments, automatically installed by the OS.

You’ve probably read my notes on setting up a LAMP stack on an Ubuntu environment (if you haven’t, read here).  The process takes less than hour, depending on your connection speed, hardware resources, etc.  Well, from my experience, setting up Java development environment has always been a little “hairy”.  Why?  It’s because certain application servers are difficult to setup, along with non-Eclipse or non-IntelliJ based IDE’s.  For most small to mid sized projects, the requirements are actually pretty small in terms of hardware resources, so an application like Weblogic or WebSphere is pure over kill.

These are my notes for setting up a development environment for Java using free (open and proprietary) sources.  Unfortunately, it takes a little longer than an hour, but hopefully, not too much more.

Requirements:

  • Comfortable setting up applications via a command line (with sudo privileges)
  • Comfortable with apt-get
  • Understanding of runtime and container technologies (apache, IIS if your a MS convert, etc)

Downloads (Check the Downloads section below):

Prepwork:

You’ll want to start by setting up your Ubuntu desktop.  It’s super easy.  Chances are, you already have an Ubuntu desktop, but you may not have an Ubuntu server.  Get the 64 bit edition of both.

From here, you’ll have two choices.  First, if you only have one PC, make sure it’s a semi beast (min: dual core, 2 Gigs of RAM; recommended: quad core, 4 Gigs of RAM) because both Eclipse and JBoss can be hogs, albeit not as hoggish as the other application servers (Weblogic, Websphere, OAS prior to Weblogic).  You’ll have to approach the strategy of 1 PC as both the development environment and deployment environment.  If you’re a novice, this may be the route you’ll want to take any way.

Second option is 1 PC for development and 1 PC for your server.  For this, you’ll want to download the server edition of Ubuntu.  If you’re a novice, avoid this strategy and stick with the first option above.  Your first PC, which we will call our developer environment, will be a desktop which will house Eclipse.  Your second PC, which we will call your deployment environment, will be Ubuntu server, which will house JBoss and MySQL.  Both will have JDK 6 installed.

Note: Ubuntu server does not have a desktop per se.  You have to be comfortable with the command prompt, or install a light desktop (like xcfe, however, gnome and kde are too thick, don’t do it).

You’ll want to download the technology stack below.  Start by downloading Sun’s JDK, look for a file named JDK 6 Update X where X is a number.  Don’t download anything that has ‘NetBeans’, ‘JavaFX’ or ‘Java EE’ on this page.  Then download Eclipse (with J2EE) and JBoss (version 5 or 5.0.1 preferred).  MySQL can be installed easily via tasksel or aptitude.

Background Notes:

There’s Sun’s JDK and OpenJDK.  Both are from Sun, OpenJDK is the open source version.  I’ve used OpenJDK for a couple of my hosts, but I do prefer the non open source (but free) version just because I’ve used for so many years.    If you choose to use the OpenJDK version, you may have to do additional configuration not available in the scope of this blog.

Another thing to watch out for is that the newer your environments are, the better.  You may have applications that only work on legacy versions of java, this is unlikely, but a clean system would ensure minimal or zero conflics.

Lastly, make sure that the JDK and Eclipse are both 64 bit editions.

Step 1: Install the Sun JDK on the Developer Environment

The .bin file, which you downloaded, is an executable.  Make sure your permissions are correct before doing so.  You will have to agree to an SLA.  The result should be a folder.  Rename this folder to ‘java’ and move it to your /opt folder.  Add this path to your .bash profile in your home or append it to your /etc/bash.bashrc for global use as such (recommended):

  • JAVA_HOME=/opt/java
  • PATH=$PATH:$JAVA_HOME/bin

You will have to restart your Ubuntu machine, once you do, you know if java works after invoking this command:

  • java -version

Step 2: Install Eclipse on the Developer Environment

The Eclipse download is a compressed tar ball with a tar.gz extension.  You can untar this by typing:

  • tar xvfz <filename>
  • where <filename> is the name of the Eclipse file without the <>

Rename the uncompressed folder to eclipse.  Since this should not be used globally, you should drop it in: /home/<your_username>.   You can make a link to the desktop, or go to the terminal and type in the eclipse folder:

  • eclipse &

This will pull up your Eclipse IDE.

Step 3: Install JBoss

I highly recommend installing JBoss in a separate machine if you can.  The JBoss 5 download is a zip file (alternative downloads from sourceforge).  You should install the unzip application via sudo apt-get install unzip in the command prompt.  The result is a folder.  Rename the folder to jboss and move it to the /opt folder, along side your jdk.  From this point onward, we will call /opt/jboss as JBOSS_HOME, but no need to alter your bash profile or variable exports to reflect this.  Some notable folders:

  • JBOSS_HOME/bin – the location of the start up script
  • JBOSS_HOME/server/default – the location of where you will drop war/ear files

Step 4: Install MySQL server

Easy step.  Where ever your JBoss lives, invoke this command in the command prompt:

  • sudo apt-get install mysql-server

You’ll have to change a file called my.cnf.  You can find it via going to the root folder (cd /) and type:

  • find . |grep my.cnf

Then:

  • change line: bind-address = localhost
  • to: bind-address = whatever_your_ip_address_is

Lastly, type:

  • mysql -u root -p
  • GRANT ALL PRIVILEGES ON *.* TO ‘your_username’@'*’ IDENTIFIED BY ‘whatever_your_password_is’ with grant option;

This allows your query tool to view/update the data, independent of the machine.  DO NOT DO THIS IN PRODUCTION ENVIRONMENTS!!!!

Note: You have to decide what your query tool is for mysql.  I prefer MySql Query Browser which can be downloaded here.  Others, prefer Tora.

Conclusion:

You now have the minimum resources to develop in Java with a nice application server and a nice database.  The next step is to actually write an application based on JSP’s, servlets and JDBC.  The a later blog, I will let you know how to do that.  It’s pretty simple really.

Meanwhile, acclimate yourself with the Eclipse environment.  Read up on writing war applications and deploying it to JBoss with ant.  I hope this helps.

Optional Tools:

  • subversion – version control which is better than cvs, but a lot of people are starting to use git
  • ant – most popular ‘make-like’ tool for java developers, an alternative is maven but not recommended unless you have a huge project.
  • subclipse – a subversion interface for Eclipse, great tool

References:

  • http://jboss.org/
  • http://www.mysql.com/

Downloads:

Firefox Tip #3: GSpace

Problem: You would like a free, 2 Gig drive managed by the internet.

Solution: Use GSpace Firefox Addon

This is for sure, the coolest addon.  So google published their services for gmail.  The result?  Firefox GSpace addon.  It’s a Firefox addon that manages your google space.  Do yourself a favor and download this now!

References:

  • https://addons.mozilla.org/en-US/firefox/addon/1593

Clouds Within Clouds, Part I

Buzzwords, gotta love ‘em.  So the hottest buzzwords right now include cloud (grid) computing, web 2.0, SaaS, semantic web, the list goes on and on.  The buzzword this blog deals with incorporates virtual desktop on a virtual host, which I call clouds within clouds.  For background on virtualization, please read this blog.

Background:

I’m going to assume you know what cloud computing and virtualization is.  If you do not, please read this blog.  So with the help of web 2.0 technologies (javascript libraries, ajax, adobe air/flex, RIA pluggins), coupled with virtual servers (vmware server, Virtual Box), Desktop as a Service is now possible as a thin client, driven by your browser.  For the past decade or so, we’ve had vpn, and in the past couple of years, we’ve managed to defer a vpn server within the clouds.

The problem (and not necessarily a big problem), is that vpn desktops tend to be a little on the thick side and require LAN like speeds.  This includes Microsoft’s Citrix implementation as well as Linux strains of vpn.  Now we have two relatively lightweight Desktops that’s 100% served by virtual hosts, yet runs on your browser as if it were a web page (assuming you have a modern browser like Firefox).  The implications are unknown but I believe that the influence in the Enterprise 2.0 arena and collaboration will depend upon light weight, open source, browser based desktops.

All Eyes with Ulteo:

There are multiple browser desktops but I will focus on two.  Both are not google’s Chrome OS because Chrome OS seemed to be “geared” towards mobile and netbook market, where as I’m focusing on virtual desktops geared more towards laptop to desktop environments.  The two technologies in question are Ulteo and eyeOS.  Ulteo is created by Gael Duval who also created Mandriva Linux.  Ulteo is one of the more complex virtual desktops and is based off of Debian/Ubuntu.  The cool thing is that it can be deployed off of Microsoft servers which implies organizations can Ubuntu instances under their current infrastructure without adding any non-Windows servers.  For the purpose of this blog, I used a LAMP stack to implement the Ulteo environment.  Of the two virtual desktops, Ulteo is more for desktops but may be light enough for laptops.

EyeOS is a very light weight virtual desktop that’s totally a PHP application.  The back end I used is MySQL and is therefore, LAMP driven.  Unlike Ulteo, it is Linux agnostic (or OS agnostic for that matter) and does not retain any Linux modules or libraries.  It can be light enough for netbooks but can still be robust for your desktop needs.  For the purpose of this blog, I’ve tested with a dual core AMD laptop with 2 gigs of ram and my AMD quad core desktop with 8 gigs of ram.

The Technology:

What’s great about the tech stack for both virtual desktops is that both are driven by the LAMP stack on the server side.  EyeOS, on the client side, needs javascript enabled as it depends on technologies like ajax and json to interact with the server.  Ulteo is thicker, as does require a Java Virtual Machine (JDK 5/6) installed in the browser.  Not only does a jvm need to be installed, but the hardware and network requirements are fairly heavy.  Heavy as in dual or quad core CPU with a minimum of  a gig of RAM.

The Installation Process:

Both the installation instructions are included under the references below.  Of the two, eyeOS was the easiest, by far.  It required a 3.6 MB tar ball download, an extraction to my php folder, a change to the database and we are in business.  Ulteo wasn’t complicated, but was time consuming.  First, the host I initially installed it on was a 64 bit instance of Ubuntu Jaunty (9.04).  I quickly found out the install binaries are 32 bit.  I could have downloaded a generic, Linux independent version of the binaries, extract, make and configured the application but I didn’t want to.  I went down the path of including the package references in my sources.list file and work with aptitude package manager via the command line.  Once I rebuilt my host with a 32 bit version of Ubuntu (Jaunty 9.04), the installation process was self explanatory.  The longest part of the installation process were the downloads for the session manager and session manager administration modules (roughly a gig total once it was said and done).

Configuration:

Configuration was easy for both Ulteo and EyeOS.  I spent less than half an hour going through various settings for each and found that the process was intuitive.  Ulteo was slightly more complicated because you have an option of installing both the administrative module and the desktop engine on different servers.

Performance:

I evaluated both Ulteo and EyeOS on wireless and LAN environments.  My wireless setup is Wireless-N end to end on the desktop.  On the laptop, the wireless setup is Wireless-N on the broadcasting portion and receives at Wireless-G.  The LAN is a gigabit environment.  That said, the wireless on EyeOS was blazing fast.  That’s totally different from Ulteo.  Ulteo’s wireless requirement, unfortunately, does not include wireless.  At least at my speeds (which isn’t too shabby by today’s standards).  My LAN handled the Ulteo interface rather well, but the wireless issue is near deal killer on the netbook/laptop side, especially with the Wireless-G card I have in my laptop.

Features:

The features for both are extensive.  Both can browse the internet, create documents and launch apps.  EyeOS’s applications are more like widgets, but this isn’t a bad thing.  The widgets are fast and effective (and pretty).  Ulteo resembles launching true applications.  In fact, Ulteo utilizes xfce desktop found in XUbuntu.  It installs (default out of the box) Open Office, Adobe Reader and even Gimp, which all renders well provided you are wired to a LAN line.  Both can install new apps rather easily.  The only thing I really wished I could do is open a terminal and type cool commands like chmod (at least on Ulteo).

Conclusion:

The future of Enterprise level collaboration depends highly on this type of technology.  Don’t be surprised if people start to update their tweets or facebook statuses via virtual desktops.  I wouldn’t be surprised if social networking and collaboration sites are virtual desktops.  It’s a new paradigm on applications and traditional web pages blending into a collaborative desktop like interface.  It certainly has its use in Enterprise 2.0 like applications and I’m excited to see how.

References:

  • http://wiki.eyeos.org/Install_EyeOS
  • http://www.ulteo.com/home/ovdi/openvirtualdesktop/documentation/installation?autolang=en
  • http://en.wikipedia.org/wiki/Cloud_computing
  • http://en.wikipedia.org/wiki/Ulteo
  • http://en.wikipedia.org/wiki/EyeOS
  • http://news.cnet.com/8301-17939_109-10281744-2.html

Firefox Tip #2: Speed Dial, Please Thank Opera

Problem: 95% of your web use consists of 10 web sites.  Wouldn’t be nice to access them with a very quick key stroke?

Solution: Use the Firefox Speed Dial addon

Easy to install, easier to use, the Firefox speed dial is cool.  Once installed, the speed dial page will display when pressing ctrl-t for a new tab.  Click on any square and it will prompt you to add a website.  So when you click on that box again, it will forward you there.  You can also access that box via tapping the control key and a number from 1 – 9.  So to access google, per se, hit ctrl-t and then ctrl-1 on your keyboard (assuming that the first box is associated with google).

This may not be the coolest Firefox addon, but it is the most used addon I use.  But Firefox, please thanks Opera.

Reference:

Windows 7: Will It Be Worth It?

At the time of writing, the scheduled release date for Microsoft’s Window’s 7 is October 22, 2009.  Are you excited?  Probably not.  Why?  Is it because of the YEARS of sloppy user interface and unreliable/prolonged release cycles?  Is it because of banal and antiquated features that other OS’s have implemented years ago?  Is it because of the extremely high hardware requirements of the OS itself?  Or is it Microsoft’s silly pricing model for various “versions” of the OS?  If this is an SAT question, the correct answer is: ALL OF THE ABOVE.

Windows Core:

This version of Windows will be fundamentally better than the previous versions.  How?  Because both Vista and XP are just so awful that almost any change to the kernel will be better than what we currently have today.  That being said, I am excited to see how Windows 7 will implement programming for multi-core processors.  For modern hardware architectures, this should be a “Win” for Windows.  I can’t tell you how frustrating it is to see cpu cycles being wasted when running the simplest of applications.

Security:

The good news is that Windows security policies can be better set.  Currently, under the Vista regime, it’s an all or nothing approach.  Instead, the new User Account Control (UAC) will be driven by a slide bar.  The parent of this new UAC will be the Action Center, replacing the Security Center, so the user will have better control of what should be reported to the user.

The bad news is that Windows is still behind the *nix security policies.  Unix is designed on security foremost and will always consider it top priority, Linux follows suit.  For example, I am an Ubuntu user (bandwagon, I admit, but I’ve been using Suse prior to Ubuntu).  Ubuntu does server security things right.  For instance, the root user is disabled by default.  Some find this annoying, I think it’s great.  For actions which require admin level authentication at both the GUI and shell level, it prompts the user for credentials.  At the command line level, the user has to type ‘sudo’ for every admin level action, even to be considered to be authenticated.  When I’m performing heavy admin tasks, I simply su into root.  I usually close the shell and it’s back to my protected user again.

To protect against the six (yes, six) known viruses for linux, I install ClamAV for good measure.  It’s free, it’s unobstrusive and it works great.  Most virus (if not all) in the Linux world is actually a Windows virus embedded in a Linux email.  Couple this with Firefox extensions and security best practices, my Ubuntu box isn’t worth being hacked into.  Some of these best practices include using strong passwords, only using ssh (w. root login disabled), increasing the delay time for bad logins, keeping ports locked unless you absolutely need them open, implementing rootkit protection practices, etc.

The Desktop:

The new Windows Desktop looks pretty good.  It has a modern look about it while still retaining that lovable “square” like feel.  Windows 7 will have a better task bar.  It has a auto snap feature for comparing documents.  It will also implement touch and hand writing recognition.  Sounds cool but at the same time, kind of useless.

For my Ubuntu desktop, I installed Compiz.  This allows a sweet, rich desktop experience.  The coolest, by far is desktop cube.  You can have multiple desktops represented by a cube.  This cube rotates to a different desktop via a mouse (scroll up/down on desktop), keyboard mouse gesture combo (alt-ctrl-left mouse button) or just the keyboard (alt-ctrl-left or right).  If you want to switch it up, you can traverse desktops via the flat desktop features, where keyboard strokes (alt-ctrl-down, then left or right) give it a “film” like effect.  These features are just the tip of the ice berg.

Hardware Requirements:

The minimum hardware requirements for Windows 7 is 2 Gig for the 64 bit version.  This is where Windows 7 truly loses.  My quad core, 8 Gig Vista desktop sits idle at 3+ Gigs, granted I do have apps running in my task bar.  This is silly.  What’s more silly is that the OS installation requires 20 Gigs.  Compare these hardware requirements with that of Ubuntu, or even XUbuntu at the 64 bit level.  XUbuntu requires 256 MB or RAM and 1.5 Gigs of HD space. Ridiculous.

Price Point:

I’m not going to lecture you, the reader, of Linux’s perfect price point (it’s free).  I will purchase a copy of Windows 7, but I have to agree that the migration path matrix is confusing (six editions, 2 architectures).  Some editions do not have a migration path.  A fresh install is the only way to upgrade.  Still, is the new operating system worth it?  For Home Premium Edition, yes (about $119 upgrade).  I tend to suppliment software with free open source applications like VLC and Firefox.  I love Open Office (OOo), FileZilla, 7zip, among others.

Conclusion:

The Windows 7 OS gets my recommendation but only one edition, which is the Home Premium Edition of Windows 7.  In my household, Microsoft has lost the battle.  I keep one desktop around for games and software not available for Linux (like printer drivers).  For those who do not play games or need the latest wi-fi adapters (or can find wi-fi alternatives like access point / router combo), I recommend either Ubuntu or openSuse at the desktop level, Ubuntu Server or CentOS for light web servers, or CentOS or RHEL for heavy load production servers which may require support.

References:

  • http://en.wikipedia.org/wiki/Windows_7
  • http://www.microsoft.com/windows/windows-7/
  • http://news.cnet.com/8301-10789_3-10078931-57.html
  • http://www.compiz-fusion.org/
  • http://blogs.zdnet.com/Bott/?p=1246

Follow

Get every new post delivered to your Inbox.