Convert Iso to VirtualBox Vdi

A issue recently is I have been playing with some new distributions as I have been doing more development using linux as my desktop operation system.

Before I would commit to using a new distribution os my main laptop operating system. I have been trailing them as virtual systems on VirtualBox.

Some of the distributions only come on live iso images, with no installation application. So my solution was to convert the live iso image into a VirtualBox vdi. The process is only one command to convert the iso to a vdi file.

Step One:
Locate the live iso image for conversion to a vdi file..

Once this is complete you want to add this to your VirtualBox machine. When you create your virtual machine, instead of creating your new your new vdi file, load the newly created vdi file.

Enjoy…

Auto Start VirtualBox VM’s…

logo-virtualboxI have started using virtualbox more and more for development work, and started getting a bit cheesed off on how to auto start the virtual machines on my server. Server being headless, I thought there would I would create some initialisation scripts under ubuntu get the job done. Then I thought, that someone else has already done this. Why reinvent the wheel, when the wheel has been invented.So a quick google search brought to a webpage that allowed me to start the vm’s when the host server starts up. The link to the original page is here The page is exactly what I needed but it missed a few steps that I have added here to simplify installation.

The issue is if you are not a root user you need to change the “VBOXUSER” in the above script, to the user you want.

If you have not added the user to the vboxusers on the host system the command is

Once this is done you need to add the script to the right /etc/rc*.d directories. This can be done simply with the command.

Once this is done, you should be ready to go unfortunately not. There is still one more process and that is populating the init script config file so it knows what virtual machines you have to start up. The following command I used to startup any unstarted virtual machines so the init script knew about them.

Once this was done you can run the init script if needed to test all your virtual machine startup.

Enjoy…

Create a VirtualBox Headless Machine…

More and more I have been running Virtualbox virtual servers upon my main Ubuntu 10.04 server. I used to create the virtual server upon my Macbook Pro 13″, then export the image, and reimport the image upon the linux headless server. Recently I found it was much easier to create the VirtualBox server upon a headless linux server. Certainly creating the virtual server upon a guy based tool is a lot easier, but it does not save time when you need to export and import the image across to the linux server.

The following steps below will show you howto setup a VirtualBox virtual headless server.

Ubuntu 10.04.03

We now create and register the virtual server with the command VBoxManage.

# VBoxManage createvm -name “server” –ostype Ubuntu_64 –register

We allocated the amount of memory the virtual server will have, the sequence of boot, e.g. dvd first, and which either net adapter does the virtual machine attach itself too. The memory we have allocated is 1024mb and the ethernet it uses is eth4.

# VBoxManage modifyvm “server” –memory 1024 –acpi on –boot1 dvd –nic1 bridged –bridge adapter1 eth4

We now create the hard disk or virtual disk for the virtual server. We allocated 100gb of hard disk space, and store the virtual hard disk file in /home/vbox

# VBoxManage createvdi –filename “/home/vbox/server.vdi” –size 100000

We state that the virtual server uses a ide controller. We can use ahci also, but ide is safe to use.

# VBoxManage storagectl “server” –name “IDE Controller” –add ide

We state that the virtual server uses the ide controller and attach the vital server hard disk to the ide controller.

# VBoxManage storageattach “server” –storagectl “IDE Controller” –port 0 –device 0 –type hdd –medium “/home/vbox/server.vdi”

We need also attach the dvd driver to the ide storage controller. Also we attach the iso image to the dvd drive, so that when we boot the virtual server for the first time, it boots the  virtual dvd driver and uses the iso image.

# VBoxManage storageattach “server” –storagectl “IDE Controller” –port 1 –device 0 –type dvddrive –medium “/home/vbox/ubuntu-10.04.3-server-amd64.iso”

We now allow remote desktop software to connect to the virtual server.

# VBoxManage modifyvm “server” –vrde on”

We now set the port, we can connect to the virtual server on with the remote desktop software. We can connect to the virtual server on port 3392. You can use Microsoft Remote Desktop Connection to connect.

# VBoxManage modifyvm “server” –vrdeport 3392

Once this is all done we can now startup the headless virtual server.

# VBoxHeadless –startvm “server” &

You can shutdown the virtual server with the following command.

# VBoxManage controlvm “server” poweroff

You can pause and restart the virtual server, but within the means of this document, I will not explain them, as they are commands not really needed.

Install Virtualbox Headless Server for Guests Operating Systems.

To install Virtualbox which is a free virtual machine software, that allows you to run machines/containers upon a physical server. Virtualbox is free open source technology. It is available for all platforms e.g. Mac OSX, Centos, Windows etc. Virtualbox is very easy to setup upon linux variants as there is software packages already available that you can install in one easy command. Below I will show you howto install Virtualbox and create a container. Virtualbox has a very active community, where help can be found very easily.

This installation will show you how to install via headless solution where no gui isused.

CENTOS:

To install Virtualbox upon Centos is a very easy procedure. The following steps will tell how to install Virtualbox upon centos.

# cd /etc/yum.repos.d

# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo

# yum –enablerepo rpmforge install dkms

Below we will now install the kernel drivers for Virtualbox.

# yum groupinstall “Development Tools”

# yum install kernel-devel

Now we will install the Virtualbox package itself.

# yum install VirtualBox-4.1

The last item we need to do is add the user who will run the Virtualbox application to the Virtualbox group.

# usermod -G vboxusers username

Ubuntu:

To install Virtualbox upon Ubuntu is a very easy procedure. The following steps will tell how to install Virtualbox upon centos.

# cd /etc/apt

# vi sources.list

Add the following line below to the sources.list file so we can talk to the Virtualbox repository.

deb http://download.virtualbox.org/virtualbox/debian lucid contrib non-free

Now we will install the Virtualbox package itself.

# wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add –

The last item we need to do is add the user who will run the Virtualbox application to the Virtualbox group.

# sudo apt-get update

# sudo apt-get install virtualbox-4.1

Below I use the root user, you can use any user you believe you want to run

# usermod -a vboxusers

Next we will now post howto setup/create a virtual machine in our next post.