In this tutorial we will demonstrate how to create in a matter of minutes a JBoss AS 7.1.1 appliance designed around a Linux distribution. The software we will use for this purpose is Oracle's Virtual Box.
VirtualBox is a cross-platform virtualization application. What does that mean? For one thing, it installs on your existing Intel or AMD-based computers, whether they are running Windows, Mac, Linux or Solaris operating systems. Secondly, it extends the capabilities of your existing computer so that it can run multiple operating systems (inside multiple virtual machines) at the same time.
So, for example, you can run Windows and Linux on your Mac, run Windows Server 2008 on your Linux server, run Linux on your Windows PC, and so on, all alongside your existing applications. You can install and run as many virtual machines as you like -- the only practical limits are disk space and memory.
Start by downloading VirtualBox from https://www.virtualbox.org/wiki/Downloads choosing a format which can be run on your OS.
Install VirtualBox using the simple Wizard and now execute it.
Create Your Virtual Machine
Click on the "New" button at the top of the VirtualBox Manager window. A wizard will pop up to guide you through setting up a new virtual machine (VM). In the first screen enter the VM name and the Operating system you intend to install on it. In our case, we will install a Linux Ubuntu OS:
Click Next. In the next screen select the amount of memory which will be assigned to the VM. Since I don't have lots of memory available on this machine, I'll just create a tiny Linux VM with about 1500 MB of RAM. Click Next:
In the next screen we will decide to create an Hard drive for our VM where data will be stored:
Choose Create. In the next window select the default option, that is using a VirtualBox Disk image that can be shared across other VMs running on Virtual Box.
Click Next. This will bring up the Storage Type window:
As a matter of fact, VirtualBox supports two types of image files:
- A dynamically allocated file will only grow in size when the guest actually stores data on its virtual hard disk. It will therefore initially be small on the host hard drive and only later grow to the size specified as it is filled with data.
- A fixed-size file will immediately occupy the file specified, even if only a fraction of the virtual hard disk space is actually in use. While occupying much more space, a fixed-size file incurs less overhead and is therefore slightly faster than a dynamically allocated file.
We will choose the first option which will prevent your hard disk growing up too much, until you have little data stored on it.
Fine now your VM Creation is complete. We will start it in a minute.
Now we need an ISO image file of your operating system ( If you have got a media like a CD/DVD of your Operating system will just work the same). For this purpose let's download a free Linux OS like Ubuntu from: http://www.ubuntu.com/download/desktop
Once downloaded, click on the Start button on your Virtual Box console. The VM will start and needs to be bound to a virtual CD/DVD disk file. From the Devices menu select "Choose a virtual CD/DVD disk file" and point to your Ubuntu ISO image file. Now your ISO will be enlisted in the VM menu and Virtual Box will attempt to boot Linux.
The Ubuntu Installer will begin. Once that you have completed your installation (Test drive or on the HD) your VM will start kicking:
At this point your can start installing software on your Linux VM. Installing JBoss AS 7.1.1 requires at first a JDK installation and proper JAVA_HOME settings. Then you just need to dowload and unzip JBoss AS from the distribution site.
If you need more details about how to install JDK and JBoss AS 7.1.1 checkout the following video which has been captured on an Ubuntu machine:
When you are done you can turn off your VM. Now we will export our Appliance. What does it mean ? simply that you can create your own Linux VM distribution which already contains a set of applications installed on it (in our case JDK and JBoss AS 7) so that we can reuse it how many times we want it.
From the File menu choose "Export Appliance":
In the next screen pickup the Virtual Machine you want to export, in our case "Ubuntu":
Select the Appliance settings: basically if you choose to export is as OVA appliance the result will be a single Virtualization Archive. Otherwise you can choose the OVF format which makes the appliance more portable but files will be written separately.
In the next screen enter the Virtual Machine information:
Now click Export in order to create your appliance. This will create an appliance named Ubuntu.ova on the location you have specified. Now we can test importing the appliance from another installation of VirtualBox. Pickup the "Import Appliance" option from the File menu:
Choose the location where you have stored the Appliance:
That's all. You should see enlisted your Ubuntu 12 appliance in your VirtualBox menu: