How to install Virtualbox in Ubuntu :
Go to
Virtualbox download site and download the binary file compiled for your OS.
This should install Virtualbox in your system. Once the installation is complete, you can start the Virtualbox by going to Applications -> Systems -> Innotek Virtualbox. Before you start using Virtualbox, go to System -> Administration -> Users and Groups. Click on
Manage Groups button on the right. Scroll down until you see
vboxusers in the list (see below):
(Manage Users)
(Vboxusers)
Click on
Vboxusers and click
Properties button on the right. You’ll see a screen as shown below with the list of users. Check the users to whom you want to give access to Virtualbox. Click OK and close the boxes.
(Vboxuser group)
Once you attach the Vboxusers group to the users, change permission to access USB devices. Open a terminal and enter
gksudo gedit /etc/udev/rules.d/40-permissions.rules
Change the line that says
SUBSYSTEM==”usb_device”, MODE=”0664″
to
SUBSYSTEM==”usb_device”, MODE=”0666″
Save and reboot your system.
Update: If you are using Ubuntu 8.04 Hardy Heron, refer to this
instruction to modify the 40-permissions.rules file.
Once logged in, start Virtualbox from the menu. You’ll see a screen similar to one shown below. My screen is blank because I deleted the default one. You can use either the default one or you can create a new one. I’m going to explain how to create a new one.
(Virtualbox started)
Click on the New button on top left. You’ll see an installation wizard as show below:
(Installation Wizard)
Click next. Enter a name for the virtual machine. I gave WinXP to show it’s Windows XP installation. Select the OS type you want to install. It’s Windows XP in my case. Click Next.
(Name and OS type)
The next screen is where you allocate memory to the virtual machine. I have 1GB RAM, so I allocated 512MB to the virtual machine. The more the better, but then it might slow down your Ubuntu installation if your virtual machine memory allocation is more than Ubuntu’s. Click Next.
(Memory Allocation)
The next step allows you to create a virtual hard drive for the virtual OS. You can create a new one or use an existing one, if you had already created one. It’s going to be a new one in my case, so I selected New.
(Hard drive)
It opens another Wizard to allocate hard drive space as shown below. Click Next
(New wizard)
Now you have two options to create a virtual drive. The first option is to dynamically expand the space and the second one is to create a fixed size. If you have enough space, then select the first option. You still have to allocate the maximum space, but it’ll fill that as it gets filled. You can’t allocate 1GB and think it’ll add more space as it needs. It didn’t work like that for me the first time I created. I created with 2GB and thought it would add more as it needs, but it errored out due to lack of space (it filled the 2GB) even before the SP2 installation could complete. I think it takes more space from the allocated space as it needs. The fixed size image option takes the entire space at one time. I went with the 1st option. Click next after you choose whichever option you want.
(disk option)
Now give a name for the virtual disc image file and select the size you want to allocate. I gave the name as WinXP, so it created a file called WinXP.vid. I allocated 6 GB. Click Next.
(disk size)
Click Finish in the next step to finish the virtual disk creation and Click Finish again to finish the Virtual OS creation.
(Finish)
Now comes to OS installation part. Before you install the OS, Click on the virtual machine you just created and click on the settings button on top. It’ll show you all the configurable settings. Under the general setting, you can resize the RAM settings and you can also adjust the video memory setting. I have 256MB video card, so I allocated 128 MB for video.
(general setting)
Click on CD/DVD-ROM on the left side. Once you are there, Check Mount CD/DVD drive and select your CD/DVD drive from the drop down box. My default CD drive is /dev/cdrom, so I selected that. I had
problem with Edgy when I tried to install Virtualbox in Edgy. Virtualbox
didn’t detect my CD drive. I didn’t have that problem with Feisty version.
(CD drive)
The next step is Audio. Click on Audio on the left side. I’m not sure if this step is needed, but I did it anyway. It may work without doing this step. Check Enable Audio and select ALSA Audio Driver.
(Audio)
Click on the USB option. Check Enable USB Controller. Click on the tiny USB cable icon with small green dot on the right. It’ll show you all available USB devices. Add those to the ****** (picture below). This won’t load the USB devices automatically when you boot the virtual OS, but it’ll give you an option to load them when you want.
Update: If you are using
Ubuntu Gutsy Gibbon or
Ubuntu Hardy Heron, Ubuntu removed support for /proc/bus/usb/*. Open a terminal and enter
sudo gedit /etc/init.d/mountdevsubfs.sh
Go to the lines as shown below:
#
# Magic to make /proc/bus/usb work
#
#mkdir -p /dev/bus/usb/.usbfs
#domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
#ln -s .usbfs/devices /dev/bus/usb/devices
#mount –rbind /dev/bus/usb /proc/bus/usb
Uncomment the last 4 lines and make it look like below:
#
# Magic to make /proc/bus/usb work
#
mkdir -p /dev/bus/usb/.usbfs
domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount –rbind /dev/bus/usb /proc/bus/usb
If you are using
Ubuntu 8.10 Intrepid Ibex, You won’t find those lines. Add those lines inside do_start() function before closing }. The file should look like this:
do_start () {
#
# Mount a tmpfs on /dev/shm
#
SHM_OPT=
[ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT=”,size=$SHM_SIZE”
domount tmpfs shmfs /dev/shm tmpfs -onosuid,nodev$SHM_OPT
#
# Mount /dev/pts. Master ptmx node is already created by udev.
#
domount devpts “” /dev/pts devpts -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE
#
# Magic to KEEP /proc/bus/usb working
#
mkdir -p /dev/bus/usb/.usbfs
domount usbfs “” /dev/bus/usb/.usbfs usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount –rbind /dev/bus/usb /proc/bus/usb
}
case “$1″ in
“”)
If you are using
Ubuntu 8.10 Intrepid Ibex, type the following command in a terminal:
grep vboxusers /etc/group
You should see something like this
vboxusers
:123:username
Open the fstab file by issuing the following command:
sudo gedit /etc/fstab
Add the following line
none /proc/bus/usb usbfs devgid=123,devmode=664 0 0
Save and exit.
Reboot and continue with the rest of the setup.
Close and restart virtualbox. You should see the USB options in the settings. You can add the devices you want. Thanks to
Virtualbox for the information.
(USB)
Click OK. You are now ready to start the installation of virtual OS. Put the Windows XP installation CD in the CD drive. Select the virtual machine you created from the Virtualbox and click the Start icon on top. It’ll start the installation of Windows. Windows installation will show you the virtual disk as the disk to install. Format it and install the OS. Once the installation is done and you login, you can select the USB devices you want to install from the menu. Select mount option from the VM menu and select the USB devices you want to mount.
Virtualbox starts the virtual OS in a small window. You can run it full screen by selecting full screen in the menu. Once you click on virtual OS, the control of your mouse, keyboard and USB devices go to the virtual OS. If you want to get the control back to your Ubuntu box, click the
CTRL key on the right side of the keyboard. This will give the control back to the original OS.
I hope this helps you to setup your virtual machine. If you have any suggestion, please leave a comment. I felt Virtualbox is little slower compared to VMWare server and also slowed my Ubuntu machine a little bit, but the real advantage are, Virtualbox is open source and it supports USB devices like webcam without paying $$$s.