Friday, January 18, 2013

Install Oracle VirtualBox on Fedora 18

This procedure is to install Oracle VirtualBox on Fedora 18. You can also use the same procedure to install VirtualBox on Fedora 15, Fedora 16 and Fedora 17. 

If you had follow my post before and confident with my script, you can scroll down to the bottom of the post and download the script. The script will automatically download, configure and install VirtualBox.

Manual Procedure
First, you need to download the repository file from VirtualBox using the following command:

If your system could not recognize wget using the command to install wget:
sudo yum install wget

Then you need to move the file "virtualbox.repo" to the folder /etc/yum.repos.d/. In the terminal, navigate to the location where you kept the file and use the command:
sudo mv virtualbox.repo /etc/yum.repos.d/

Then you need to install gcc, kernel-devel and dkms:
sudo yum install gcc kernel-devel dkms

To install the latest version of VirtualBox use the command:
sudo yum install VirtualBox-4.2

If you prefer the older version of VirtualBox just change the version number such as:
sudo yum install VirtualBox-4.1
sudo yum install VirtualBox-4.0
sudo yum install virtualbox-3.2
sudo yum install virtualbox-3.1
sudo yum install virtualbox-3.0

Automation Script
I've created an automation script that perform the previous steps and install the latest version of VirtualBox. You can download this script FC00-vbox-install-noarch. If you prefer to install the older version, you need to modify the script.

The entire script is listed below:
#! /bin/bash

# This script is to install VirtualBox in Fedora
# This script must be used with root access 
# This script will download the repository file for yum from
# Then this acript will move the repo file to the yum depository folder at /etc/yum.repos.d/
# VirtualBox need to recompile the kernel, if you have just updated a new kernel, you should reboot the system before running this script

# Downloading repo file
echo "Downloading repo file from VirtualBox..."
yum install -y wget

# Move repo file to the repositary directory
echo "Moving VBox repo file to Yum repo folder..."
if [ -e virtualbox.repo ]; then 
 mv virtualbox.repo /etc/yum.repos.d/
 echo "Done!"
 echo "Could not find the file virtualbox.repo! Please check your Internet connection!"
 echo "If you download the file manually, make sure that the file is place in the same directory as this script"
 exit 1

# Installation of VirtualBox
echo "Installing files required for running VBox..."
yum install -y gcc kernel-devel dkms

echo "Installing VirtualBox...."
yum install -y VirtualBox-4.2

Please remember to change the script to execution mode:
chmod +x FC00-vbox-install-noarch

To run the script use the command:
sudo ./F00-vbox-install-noarch

*** End ***


  1. my kernal failed to be installed in fedora 18 by installing the latest virtualbox 4.2.
    anyway to solve it?

    1. Make sure you have installed dkms and kernel-devel. After installing kernel-devel, you need to restart the system before installing virtualbox. If you install kernel-devel without rebooting, you will encounter failure while installing virtualbox.


Note: Only a member of this blog may post a comment.