How to install Virtualbox on Ubuntu 12.04 LTS Precise Pangolin

1. Download and install Oracle’s public key.

danesh@python:~$ wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -

2. Create a repo file for Virtualbox

danesh@python:~$ sudo -s  echo "deb http://download.virtualbox.org/virtualbox/debian precise contrib" >> ~/virtualbox.list

danesh@python:~$ sudo mv ~/virtualbox.list /etc/apt/sources.list.d/

3. Install Virtualbox

danesh@python:~$ sudo apt-get update

danesh@python:~$ sudo apt-get install dkms

danesh@python:~$ sudo apt-get install virtualbox-4.1

Enjoy.
  • Lloyd

    Minor omission, step 3 second command should be:

    sudo apt-get install dkms

  • Eric draven

    Everything here works exsept this one line “sudo apt-get dkms”. I get “invalid operation” but other than that this works.

    UBUNTU 12.04LTS 64 Bit
    intel i7
    6GB RAM
    750GB HDD

  • Thanks for spotting that Lloyd, updated the line.

  • ralph nicole

    guys, can you help me, i need to install virtualbox in my ubuntu linux 12.04 but when I typed the first line of code given in this web page tutorial, I got a message in my terminal saying : “gpg: no valid OpenPGP data found.” what should I do?

    • kukori

      set the proxy (http,https,ftp,socket) in /etc/wgetrc file

  • Michael Bo

    That worked Great…
    Can you show how to install the…

    Oracle VM VirtualBox Extension Pack

    Thanks for all the advise!

  • aki
  • Not working for me… :-S Neither other solutions I have found googling. My errors with your solution:

    * Trying to register the VirtualBox kernel modules using DKMS Error! Your kernel headers for kernel 3.5.0-18-generic cannot be found.
    Please install the linux-headers-3.5.0-18-generic package,
    or use the –kernelsourcedir option to tell DKMS where it’s located

    * Failed, trying without DKMS
    * Recompiling VirtualBox kernel modules
    * Look at /var/log/vbox-install.log to find out what went wrong

    Some idea ? Thank you very much in advance !!

    • try “sudo apt-get install kernel-headers” first

      • Solved. My problem was I had 3.5.0-17 instead of 3.5.0-18 headers. I solved enabling “Recommended updates” to let Ubuntu download 3.5.0-18 headers. All is working like a charm now. Thanks Danesh for your response.

  • Edan

    I’m getting this message – no valid OpenPGP data found, when I tried to download the public key

  • Thanks ! Works perfect !

  • Pingback: INSTALL ORACLE VIRTUAL BOX | Alexander Odhiambo()

  • Nerella Thirupathi

    Hi Danesh, i got the following error when i have execiuted the command “sudo apt-get install dkms”

    Error message :
    The hostname -f command returned: $1

    Your system needs to have a fully qualified domain name (fqdn) in
    order to install the var-qmail packages.

    Installation aborted.

    dpkg: error processing qmail (–configure):
    subprocess installed post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of qmail-run:
    qmail-run depends on qmail (>= 1.06-2.1); however:
    Package qmail is not configured yet.
    dpkg: error processing qmail-run (–configure):
    dependency problems – leaving unconfigured
    Setting up dkms (2.2.0.3-1ubuntu3.2) …
    No apport report written because the error message indicates its a followup error from a previous failure.
    Setting up fakeroot (1.18.2-1) …
    update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode.
    Errors were encountered while processing:
    qmail
    qmail-run
    E: Sub-process /usr/bin/dpkg returned an error code (1)

© 2008-2012 The Danesh Project
Powered by Wordpress and made by Guerrilla. Hosted at ServerFreak