The steps are not too difficult but I did have to find a few places for information. Search on the forum turn up nothing on this subject so hopefully this HOWTO would be helpful to someone out there.
Note: This is not using the OSE version.
VirtualBox has a very good GUI running on the host to manage guest OS. However when running a server, we typically do not want to run X on it. Fortunately VirtualBox has commandline tools to manage guest systems. It also provides the VirtualBox Remote Desktop Protocol (VRDP) to allow connection to the guest remotely.
Clarification of terms used:
Host – refers to the machine we are trying to install VirtualBox.
Guest – the VirtualBox guest system that is setup on the host.
Remote – the PC that we are working on to connect to the host via SSH.
This setup was done on a fresh install of Ubuntu Server 8.10 with openssh-server installed.
All the following steps are done by SSH into the host from a remote (I’m using Windows for now).
1. Get required packages
Download the Ubuntu package for VirtualBox from http://www.sun.com/software/products/virtualbox/get.jsp
wget “download link here” -O virtualbox-2.0_2.0.4-38406_Ubuntu_intrepid_i386.deb
We are using the non-OSE version here.
The manual from http://www.virtualbox.org/wiki/Downloads is also very useful.
sudo dpkg -i virtualbox-2.0_2.0.4-38406_Ubuntu_intrepid_i386.deb
This will generate a bunch of dependencies. Fix them with
sudo apt-get -f upgrade
3. Decide on user, disk files location
First decide which user you want to run VirtualBox. Add this user to the vboxusers group.
sudo usermod -a -G vboxusers vboxuser
By default VirtualBox creates the directory .VirtualBox on the user home directory and put all the config and disk file there. In my setup, I put the disk files in /var/vbox as I had created a large partition for this purpose.
4. Install a guest OS
You will need an iso for the guest OS install CD. Copy or download it to the host. We will use windowsxp.iso
-create a vm
VBoxManage createvm -name winxp -register
VBoxManage modifyvm winxp -memory “256MB” -acpi on -boot1 dvd -nic1 nat
-create a disk
VBoxManage createvdi -filename “/var/vbox/winxp.vdi” -size 5000 -register
-add disk to vm
VBoxManage modifyvm winxp -hda “/var/vbox/winxp.vdi”
-register an install iso
VBoxManage registerimage dvd /var/vbox/windows.iso
-mount iso on vm
VBoxManage modifyvm ubuntu -dvd /var/vbox/windows.iso
-start the vm with port
VBoxHeadless -startvm winxp -p 3389 &
If you are running just 1 guest, the -p 3389 is optional. For more than 1 guest, it has to listen to different port.
5. Connect from remote
Since my desktop is still Windows, I use Remote Desktop Connection. (On XP, Start>All Programs>Accessories>Communications)
For Mac, use http://www.microsoft.com/mac/products/remote-desktop/
For Ubuntu, look at http://ubuntuforums.org/showthread.php?t=824710
Just fill in the IP of your host (or IP:port if not the default) and you should see the Windows installation waiting for you.
Other useful commands:
VBoxManage controlvm winxp poweroff
VBoxManage controlvm winxp reset
6. Install the Guest additions
You will need the latest ‘VBoxGuestAdditions.iso that is located here:
wget http://download.virtualbox.org/virtualbox/2.0.4/VBoxGuestAdditions_2.0.4.iso –O VBoxGuestAdditions.iso
Now just move it in /var/vbox/ since all our images are here.
sudo mv VBoxGuestAdditiond.iso /var/vbox/VBoxGuestAdditiond.iso
Don’t forget to register your image!
VBoxManage registerimage dvd /var/vbox/VBoxGuestAdditiond.iso
Now we will mount it on the guest OS
VBoxManage controlvm winxp dvdattach /var/vbox/VBoxGuestAdditiond.iso
Now you should see it in you Guest OS! 🙂
I will make other how-to like that with different OS and also i will post how-to put you Guest OS in your network so you can share file with all you pc’s on this network.