Thursday, 8 August 2013

Setting up the Raspberry Pi installing Debian. Java and JBoss

Setting up the Pi  

Before we can start playing JEE on the Raspberry Pi, a few things need to be set up.
As this is not too interesting, I try to cover it in a hurry. Please leave a note if you want one topic or the other dealt with in more detail.

What this post will cover:

  • Choosing and installing a suitable operating system for your Pi
  • Installing Java on the Pi
  • Installing JBoss on the Pi
  • Setting up the Pi network

Choosing and installing a suitable operating system for your Pi

The first task now is to choose and install a suitable operating system for your Pi.
There are several options available on the download page of the Raspberry Pi Foundation: http://www.raspberrypi.org/downloads
We go for Soft-float Debian “wheezy” for the reasons described on the page:
This image is identical to the Raspbian “wheezy” image, but uses the slower soft-float ABI. It is only intended for use with software such as the Oracle JVM which does not yet support the hard-float ABI used by Raspbian.”
 If we want to run java, what we do, we must stick to an operating system offering a soft-float ABI.
I tried the Java8 preview offered by Oracle here: http://jdk8.java.net/download.html which is supposed to support the hard-float ABI. But sorry, this works only when running Java in client mode. As soon as your software needs server-mode, you are out of the game.
This is also true for the embedded version of the Standard Edition.
Do we need server mode? Yes, because software like JBoss AS7 needs it.
So as of now (at the time of this writing) the soft-float Debian “wheezy” seems like a good idea for starting off:
  • Download soft-float Debian “wheezy” image
  • Bring the image to your sd-card
  • Start the Pi and run through the config-script that will start up on first boot
Hint: The config-script now offers to assign a hostname to your Pi. It is a good idea to make use of this. Later, when you have a couple of console windows open on your desktop machine pointing to different Pis, you will be glad to see meaningful prompts identifying the Pis respectively (of course you can change the hostname of your Pi later, but using the config-script is easier).
Later, when plugging your Pis into your network, you want to add these names to your router’s configuration.

Installing Java JDK on the Pi

The next step is installing Java on your Pis.
Software like the Oracle Java 8 preview would have to be installed manually.
The regular Java versions are maintained in the Debian software repositories and can easily be installed by Debians package manager.
I chose this package and installed it with apt-get.
Open up a console and enter:

sudo apt-get install openjdk-7-jdk

After the dust has settled, you have an openJDK 7 on your Pi.

Installing JBoss AS7 on the Pi

When installing JBoss, a little bit more manual effort is required. Here is what you have to do:

Step 1: Download the package

At the time of this writing, JBoss AS7 was available in version 7.1.1.Final.
You can download this package from the console using wget:

sudo wget http://download.jboss.org/jbossas/7.1/jboss-as\
 -7.1.1.Final/jboss-as-7.1.1.Final.tar.gz

Step 2: Extract the download 

Now that we have the tar-file on the pi we have to extract it into a suitable directory.
/usr/local is a good choice:

sudo tar zxvf jboss-as-7.1.1.Final.tar.gz -C /usr/local

(don't forget the -C option or the necessary directories will not be created)

Step 3: Smoothen the installation directory

JBoss AS7 is now installed in /usr/local/jboss-as-7.1.1.Final
If you find this to be a bit unhandy, change it like this:

sudo mv jboss-as-7.1.1.Final/ jboss7

Step 4: Make pi the owner of the installation

I like my pi user to be the owner of the installation.
You can do this with the Change Owner command:
sudo chown -R pi:pi /usr/local/jboss7/

JBoss AS7 is now installed and ready to run on your Raspberry Pi.
Quite some heavy lifting for a little Pi like that. But we'll see JBoss behaves itself very well.

Network configuration

My setup consists of 3 Raspberry Pis plugged into the local network behind my router.
On the router assigned static IP addresses and logical names to them. The Pis are named “frodo”, “samwise” and “gandalf”. 
Naming your Pis according to your rooter's configuration will help you to stay on top of things later.

Before getting serious with playing JEE on the Pi we'll have to do some minor configurations on JBoss.
But I leave this for the next post.

3 comments:

  1. Hi... can you say me about jboss performance?

    I tryed install with open jdk, oracle default in raspberry, debian armel soft-float, and with all of them, the jboss is very slow.

    Do you test to deploy apps on jboss? Do you make some extra configuration?

    ReplyDelete
    Replies
    1. Hi, I must admit that I am not concerned with performance on the pi.
      I'm just using it to play around with distributed computing issues. I guess you can't expect that much here: A full fledged Linux, Java VM, JBoss on top, some heavy weight JEE stuff, all with 500mb of memory? The interesting thing is that it works at all. If you need some speed, best turn to low footprint services like lighttpd (I need to try that one on the pi, btw).
      As for your question concerning deployment: no, I don't use any special configuration. I built with eclipse and copy to the pi. As I said, just playing...
      Best regards
      Volker

      Delete
  2. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Alfresco , kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on Alfresco. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us:
    Name : Arunkumar U
    Email : arun@maxmunus.com
    Skype id: training_maxmunus
    Contact No.-+91-9738507310
    Company Website –http://www.maxmunus.com


    ReplyDelete