Virtualization with VirtualBox

author-image
CIOL Bureau
Updated On
New Update
Advertisment

With virtualization you not only achieve consolidation but also get a new way of deploying applications in the form of pre-configured virtual disk images. Such an image can be deployed by attaching the hard-disk image to your virtual machine and booting it up. It means that you can practically set up a fully operational and configured server in just a few minutes.

PCQLinux 2007 Enterprise Server provides all these features out-of-the-box. Not only has virtualization been provided in the form of VirtualBox, but we have also provided you with two pre-configured virtual appliances for Collaboration and Content Management. In this section, we will talk about how to get started with VirtualBox and create and attach more virtual machines with it. We show you how to use the appliances shipped with PCQLinux 2007, elsewhere in this story.

iSCSI Refresher

Configuring IP for the Host: To configure an IP address for the host machine, you have to run the ifconfig command and give the address manually. This is needed as tunctl doesn't work well with dhcp clients. For this issue the command:

#ifconfig eth0 you_ip_add netmask 255.255.255.0 up

Attaching Appliances: If you want to attach appliances shipped with the PCQLinux 2007 DVD, you have to first go to the /mnt/cdrom/Appliances folder and copy the appliance file to your hard-disk. Uncompress the file using the following command:

#bunzip2 appliance_name.bz2

This command will generate a .vdi file. You can attach the .vdi file by the method described
in Step 5.

Advertisment

Configuration
To get VirtualBox running, you have to first install the PCQLinux Server. To do so, you have to write 'enterprise' when you boot off the PCQLinux 2007 DVD. For more info on how to install PCQLinux  2007 Server, read the section on 'How to install PCQLinux 2007.'

Once the server is installed, boot into the machine and again place the PCQLinux 2007 DVD into the drive. Now go to cdrom:/Appliances/Required!/ folder and you will see two more RPM files called parprouted-0.63-1.2.el4.rf.rpm and uml-utilities-o.20040406-2.fc4.at.rpm. Install both the RPMs by running the following commands:

#rpm -ivh parprouted-0.63-1.2.el4.rf.rpm --nodeps
#rpm -ivh uml-utilities-o.20040406-2.fc4.at.rpm --nodeps

Advertisment

Remember to use the nodeps switch else you might see some errors. Once this is done, go to the /opt/virtualbox/bin/src folder and run the following commands to compile and install VirtualBox binaries:

#make KERN_DIR=/usr/src/kernels/2.6.9-42.0.8.EL-i686/
#make KERN_DIR=/usr/src/kernels/2.6.9-42.0.8.EL-i686/
install

After this you have to run some more commands to enable the network in the virtual machine. To do so first of all create a tap device, which is a virtual Ethernet device that can communicate with the Ethernet card of a virtual machine. You can do so by running the following command:

Advertisment

#tunctl –t tap0

If you see the output that says, 'Set tap0 persistent and owned by uid 0,' then your tap device is ready to work. Now you have to create a route between the physical Ethernet card in your server and the tap0 device. You can do so by running the following command:

#parprouted eth0 tap0

Advertisment

Now the only one thing required is to get your virtual machine to run. For this you have to enable IP forwarding in your machine so that the virtual machine sitting inside VirtualBox is able to access your physical network. You can do so by running the following command:

#echo 1 > /proc/sys/net/ipv4/ip_forward

Now the entire configuration is over and you just need to start VirtualBox. For this you have to run a few commands. First of all, load the drivers required for VirtualBox to run properly. This can be done through the command:

Advertisment

#modprobe vboxdrv

Once this is done, start the VirtualBox server by running the following command from /opt/virtualbox/bin/ directory:

#./VBoxSVC &

Advertisment

Running the GUI
As VirtualBox has a very comprehensive, graphical interface and the PCQLinux 2007 Enterprise Edition doesn't have any X windows running; you must be wondering how we are going to actually run VirtualBox. Don't worry; we don't expect you to use VirtualBox from the command line only.
Instead the idea here is to use SSH with X windows exported and running the GUI from some other machine. For this, go to any Linux machine where you have Xwindows installed and have an SSH client running. Run the following command:

#SSH –X ip_add

Here, replace the ip_add with the IP address of the Server where you have PCQLinux Enterprise Server running. A standard SSH terminal will open, but using the –X switch you have enabled the X Server of the Enterprise Edition to get exported to the client machine.
So, whenever you run a command which requires X, it will automatically connect to X Server of the client machine and start up the application there itself. To start VirtualBox from the SSH terminal, run the following command:

#./VirtualBox

A cool looking window will open, where you can create, run and configure virtual machines. Follow the screen shots stepwise to use the VirtualBox GUI.

In this screen of VirtualBox, select the type of guest OS you are going to install and give it a suitable name Here provide the amount of RAM you want to dedicate to the guest OS
Here select the first option if you want to create a dynamically growing Hard disk else select the second option If you have opted for creating a new disk then you have to give it a size in this screen
If you have selected to use a pre-existing disk in step 3, then locate and attach the .vdi file here When you are through with all the settings, click on the start button. Your Virtual machine is now ready to run

Source: PCQuest

tech-news