Thursday, March 25, 2010

Experimenting Java Enterprise Edition (EE) SDK 6 on Ubuntu Linux

Soon after downloading the Java EE on Ubuntu machine through the website the file (~48 MB) called An attempt to run the shell script resulted in the following error.
Could not locate a suitable Java runtime.
Please ensure that you have Java 6 or newer installed on your system
and accessible in your PATH or by setting JAVA_HOME
This requires installation of Java 6 by using the following command (another roughly 55 MB).
$ sudo apt-get install sun-java6-jdk
Now going back to the Java EE installation through the following command.
$ sh
Going through the clicks (one has to only write the password for admin account and the proxy if any). Rest of the information is filled in by default.

Verifying Installation
Now go to the web browser and type the following in the address box.
If you changed the value of admin control panel port. Please replace 4848 with the port number you specified during installation. This would open the administration control panel (shown below) and demand user name and password. Please put the username/ password which were set during installation.

After the username and password has been entered the following window will appear.

Deploying Sample Application

Download the application hello.war from the website here. Click on Applications on the tree on the right side and click the button deploy and then point to the path where the hello.war was downloaded.

Then write the following in the address box of the web browser and write your name in the box and click submit.


The following output will appear hence showing that the Java EE 6 has not only been installed but also working.

The next step is to develop applications using the Java EE standard. This requires knowledge of EJB, Components, three tier architecture and advanced java programming.

Monday, March 22, 2010

Virtualization :: Old wine in new bottles

Virtualization dates back to the introduction of CP/CMS later renamed IBM VM-370. VM-370 provided two key ingredients. Multiprogramming and extended machine with better interface with the hardware[1]. The recent interest in Virtualization came on the back drop of energy conservation and providing services to users. The explosive growth of the needs of internet and data centers has fueled this renewed interest in Virtualization.

Virtualization Software
Already have experimented with a virtual machine player VMware Player marketed by VMware Inc. Using this we installed FreeBSD, Ubuntu, Gentoo on top of Windows XP.

Whats the next step towards Virtualization? Hypervisor? Hypervisors are of two basic types. Type one are those which provide direct interface between the Guest OS and the hardware. While the type two hypervisor has a host OS onto which the virtualization software is installed and then the guest OS is installed. VMware ESX and GSX are examples of type 1 and type 2 hypervisors.

So what exactly does Virtualization achieve? The increasing needs of users demanded setting up servers for individual applications. Email Server, Web Server, Internet Server, Print Server, File Server and many more servers are routinely installed and maintained by IT departments in large organizations. Now with the advent of superior hardware the needs of the users can be served by using only one machine with all these server applications running on it. This is generally not possible due to limitations/ requirements of using different OS for different applications. So its better to use hypervisors and install as many applications as possible over a set of hardware. This is not only energy efficient but due to hypervisors as easy to maintain as the each individual servers.

The primary drawback is performance issues. Maintenance could also prop up as a problem (which it tended originally solved) but separate machines might be better from Maintenance. Another issue is security.

Genuine breakthrough or simply old wine in new bottles
Virtualization is one of the few ideas which came back from the dead and took the world by storm. Its importance is gaining due to another technology. Cloud Computing is getting more and more pervasive and this has helped virtualization gain more strength and appeal. Clouds of applications can be maintained by using virtualization like never before. Calling it old win in a new bottles will be a little bit too simplistic. Although on the face of it, virtualization does borrow from the good old VM/370 but with the advent of internet and cloud computing its given the old wine a very nice taste. Application like VMware vSphere for data center virtualization are changing the meaning of virtualization. Amazon's Elastic Cloud Compute (EC2) enables users to rent out computers to run applications using virtualization as a building block to create the EC2.  Grid Computing, an effort where (even geographically) diverse machines come together and try to solve a single task, is defined by Plaszczak/Wellner as "the technology that enables resource virtualization, on-demand provisioning, and service (resource) sharing between organizations."[3].
A very nice but pretty detailed and long introduction is available here.

[1] Tanenbaum, A. S., "Modern Operating Systems", Third Edition, 2008
[3] P Plaszczak, R Wellner, Grid computing, 2005, Elsevier/Morgan Kaufmann, San Francisco

Monday, March 08, 2010

How and where should I change proxy settings in Linux?


How and where should I change proxy settings in Linux? This is a most frequent question posed by newbie (and not so new) Linux users ? This mountain can be scaled in three steps.

Step 1 Using proxy to get simply connected to the internet

Just change proxy setting in Firefox and/ or browser of your choice and start using internet. Ignore the rest of urges of Linux to get updates etc and life will be cool and simple.

Of course life cannot continue to be so simple. One has to after all install programs etc.

Step 2 Adding proxy for system-wide settings

Now the next step is to setup proxy for "system-wide" setting. If using GNOME got to the System-> Preferences -> Network Proxy. Typical settings could be ip address/ host name of the proxy server and port name (typically 8080).  Click system-wide settings button and then authenticate by the root password. This would add system-wide system proxy settings and ability to use package managers and instant messengers.

Step 3 Adding proxy to the terminal

Reading through the manuals/ howtos (including those on this blog) the sudo apt-get install (or yum or other variants of package install commands) frequently need proxy settings. The proxy settings can be setup via the following command sequence.

Edit your .bashrc file present in home directory in your favorite editor. Here vi is used for demonstration.
$ vi .bashrc
Go to the end and add the following please note # indicates comments its healthy practice to write comments so that later we know why we wrote the particular lines.
# Proxy settings
export http_proxy="http://MY_PROXY_IP_OR_HOST:MY_PROXY_PORT"
export ftp_proxy="http://MY_PROXY_IP_OR_HOST:MY_PROXY_PORT"

Please ensure to replace MY_PROXY_IP_OR_HOST by the proxy server ip or host name and MY_PROXY_PORT by port number (typically 8080).

Close the terminal and start again. Test out by writing export in the command line and it should be followed by a long list and at the end you should find.

declare -x http_proxy="http://MY_PROXY_IP_OR_HOST:MY_PROXY_PORT"
declare -x ftp_proxy="http://MY_PROXY_IP_OR_HOST:MY_PROXY_PORT"

{Please note the MY_PROXY_IP _OR_HOST and PROXY_PORT will be replaced by the ip/ host name and port number you specify earlier}

A simple test whether the settings have been done is by the following command (if available). It should open the command line browser and open google's webpage.
$ w3m

Now the apt-get install and other commands requiring connection to internet via proxy should work.

Monday, March 01, 2010

Linux LAMP raising jinn and exorcising demons

In the early nineties Linux was a hobby, which in the words of Linus Torvalds might never be professional like GNU. It took off and shook the foundations of empires aspiring to bleed every penny by selling server operating system. The contributions of open source community have caused severe headache for software companies. Apache Foundation is one such name. How much does it cost to setup a web server? Around the cost of a LAMP, compare this with the cost of aptly named vamp or is it WAMP?  What jinn did the lamp raise? What changes did it trigger? A very simple question is how come Ethernet and Networks were around in the seventies but it took just a couple of years after Linux for Internet to raise it head? The answers to all these questions is there was no LAMP earlier.

LAMP stands for Linux Apache MySQL PHP (Python / Perl).  This is open source combination which gives a head start to web development environment. LAMPs have been around for not very long but the LAMP was developed gradually. First came Linux and then after couple of years it was Apache, followed by MySQL and PHP. Apache web server became the default choice because number one it was open source (and free) and secondly it integrated pretty well with Linux. Just imagine telling a windows user that the configurations of Apache can be done via httpd.conf file. Now first question asked by the window's user is ok http is understandable but what is the “d” and secondly what is .conf extension? So the integration of Apache into windows as a service is pretty much artificial and although it works ok but Linux & Apache go together.

Next comes MySQL. MySQLis open source (and free). So that makes it the choice for database and its whole organization and architecture seamlessly fits into the Linux frame of mind. Just imagine having web interface for database management and then using ports to access databases. Windows does not deal in ports (until very late).

Now PHP is a completely scripting language which looks somewhat like C. Again C and scripts rings  Linux/Unix bells. PHP created circa 1995 so were Apache and MySQL. Internet boomed and growth quadrupled ever since.

This article  also deals with similar subject and associated history.