Install VirtualBox 4.2 via Its Repository in Ubuntu 12.04

Last week we showed you how to install VirtualBox 4.2 in Ubuntu by downloading and install it from Software Center. To read that post, click here.

Well, that method too, works. But if you prefer to install it via its repository, it’s now possible to do just that, and this brief tutorial is going to show you how to accomplish it. Installing software in Ubuntu through its repositories allows for automatic updates and security patches.


  • Install VirtualBox via its repository
  • Enjoy!

To get started, press Ctrl – Alt – T on your keyboard to open the terminal. When it opens, run the commands below to add its repository’s key.

wget -q -O- | sudo apt-key add -




Next, copy and paste the commands below to add its repository.

sudo sh -c 'echo "deb precise contrib" >> /etc/apt/sources.list'




Finally, run the commands below to update your system and install VirtualBox 4.2

sudo apt-get update && sudo apt-get install virtualbox-4.2





5 thoughts on “Install VirtualBox 4.2 via Its Repository in Ubuntu 12.04”

  1. Does not work

    E: Unable to locate package virtualbox-4.2
    E: Couldn’t find any package by regex ‘virtualbox-4.2’

Leave a Reply

Your email address will not be published. Required fields are marked *