Saturday, June 2, 2012

Running Fedora 17 in Ubuntu with VirtualBox

VirtualBox is a great tool for testing operating systems, whether for testing a different distributions or simulating a network configuration. What follows is my experience installing and configuring Fedora 17 on my notebook running Ubuntu 12.04 LTS.
First off, this pseudo tutorial assumes a few things are in place. The Ubuntu Desktop is installed and running with VirtualBox installed, and the Fedora 17 ISO has been downloaded. Though my notebook has a 64-bit processor, it does not have the virtualization extensions; something I didn't verify before purchasing back in 2008. So, even though I'm running the 64-bit version of Ubuntu 12.04 LTS, I'm running the 32-bit version of Fedora 17 in a virtual machine.

We begin by starting VirtualBox and then clicking the New button to create a new virtual machine.
In the Create New Virtual Machine wizard welcome screen click on Next. Then in the VM Name and OS Type window, type in a name for the virtual machine, for example Fedora 17. In the Operating System and Version drop downs, select Linux and Fedora respectively, then click Next.
In the resulting Memory screen, assign the amount of memory you want to allocate to the virtual machine. The defaults are normally fine, but since the example host machine, my notebook, has 4 gigabytes of memory, I assigned 1 gigabyte to the virtual machine. Click Next to get to the Virtual Hard Disk screen, leave the default Start-up Disk checked and Create new hard disk radio button selected, then press next. A Create New Virtual Disk wizard now begins, leave the default File type of VDI (VirtualBox Disk Image) and click Next. The Virtual disk storage details page displays, leave the default, Dynamically allocated, radio button selected. This allows the virtual disk used by the virtual machine grow dynamically to its maximum size as needed, rather than creating a fixed fully used file size for the virtual disk, then click Next. The defaults for the Virtual disk file location and size are satisfactory, click the Next button to display the Summary window. Click the Create button to create the virtual disk and finish the wizard.
Now the Create New Virtual Machine wizard displays with the Summary, click create to create the virtual machine with the allocated memory and virtual disk.
The next step is to select the Fedora 17 ISO image to mount in the virtual CDROM drive. From VirtualBox, select the newly created virtual machine and click on the Settings button. In the left pane of the settings windows, select storage. Then under Storage Tree, select the empty CDROM, then under the attributes section, click on the CDROM icon and navigate to and select the Fedora 17 ISO image. Click on OK to close the settings window.
Now the virtual machine is setup and ready for the operating system installation. Click on the Start button to start the virtual machine and boot the Fedora 17 installation media. Several dialog boxes will display regarding the Host key, keyboard and mouse integration, select OK in the dialog boxes to close them, optionally selecting Do not show this message again check boxes. Eventually the Fedora 17 installation will boot and the normal installation procedure is followed.
After the installation is complete the virtual machine is rebooted and running in a default desktop.
The keyboard and mouse integration and video sizing somewhat work, but to get full integration and display configuration the VirutalBox Guest Additions need to be installed. From the VirtualBox menu select Devices, then, Install Guest Additions... I received a dialog box that the Guest Additions ISO image wasn't found and if they should be downloaded. The default installation of VirtualBox from the Ubuntu Software Center didn't install the CD image.
Click on the Yes button to download the ISO image, a confirmation dialog box will display, click on the Download button to begin the download. In the bottom left of the virtual machine, a status bar displays the progress of the download.
After the CD image is downloaded a dialog box will ask if the image should be mounted. Click on the Mount button to mount the CD image. Once the CD image is mounted a dialog box will display asking to automatically run software on the CD. Click on the run button to begin the Guest Additions installation. Another dialog box appears that requires the Super User or root password to install the software, type in the password and click the Authenticate button.
This is where the problem with the installation of the Guest Additions arose. The installation failed complaining the gcc compiler wasn't found or the kernel headers needed to build the Guest Additions kernel modules.
The next step is to install gcc and the kernel modules from the command line. To accomplish this, go to a terminal session and gain root access. Then issue the following two commands per the error message:
# yum install gcc
# yum install kernel-devel-3.3.4-5.fc17.i686
Then perform the Guest Additions installation again. The second attempt should be successful.
After successful installation of the Guest Additions, reboot the virtual machine. Now full keyboard and mouse integration works and the screen can be adjusted by selecting View then Auto-resize Guest Display from the VirtualBox menu. Maximize the virtual machine and after a moment the screen will adjust.
The virtual machine can also go to full screen mode by pressing the Host key (right control key) and the F key simultaneously.

Some final notes. The gcc compiler and kernel headers should be installed first to insure the Guest Additions will install correctly. Each guest operating system needs the Guest Additions installed. For example, if Fedora, Linux Mint and Windows 7 are installed in virtual machines, each virtual machine instance will need the Guest Additions installed independently.  If VirtualBox is upgraded to a newer version, the Guest Additions will need to be upgraded to the version that matches VirtualBox and the guest operating systems will need their installations of the Guest Additions upgraded.

4 comments:

Jay Greene said...

Thanks I got stuck on this

"The next step is to install gcc and the kernel modules from the command line. To accomplish this, go to a terminal session and gain root access. Then issue the following two commands per the error message:
# yum install gcc
# yum install kernel-devel-3.3.4-5.fc17.i686"

part and found your page which helped!

Jay Greene said...

The next step is to install gcc and the kernel modules from the command line. To accomplish this, go to a terminal session and gain root access. Then issue the following two commands per the error message:
# yum install gcc
# yum install kernel-devel-3.3.4-5.fc17.i686

Thanks this helped me get past installing fedora17 in virtualbox on windows.

Unknown said...

Thanks!, just what I needed.

Abel Palaty said...

Thank You
It was really helpful.