Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

OK, I a am a newbie. For some reasons, I need to install Virtualbox. I see that I can easily install it using the Software Center, but I trust most the "apt-get install blahblah" way, because I find it safer, less buggy, and it helps me accommodate more with the Terminal.

So, my question is the following: is there a way to install Virtual box using a command line? I would prefer something easy, like "apt-get install etc" not unzipping, archiving, etc, because this kind of things I still don't know how to do from inside the Terminal.

Thank you in advance for your help!

share|improve this question
For the latest Oracle version 4.3 also see:… which includes CLI instructions. Note that there is no repository for 13.10 yet but the 13.04 version should work too. – Takkat Oct 28 '13 at 11:57
@Takkat - For now, is no problem for me if there is no repository for 13.04 as I don't run the latest version. :-) But it is good that you mentioned it. It might help other users. – Cristiana Nicolae Oct 28 '13 at 13:31

4 Answers 4

up vote 30 down vote accepted

Open a terminal and

sudo apt-get install virtualbox 

Should work

Once you have installed it you probably want to install guest additions in the guest OS

Also you probably want the extension pack which you can get from here:

make sure you get the correct version.

share|improve this answer
@ Warren Hill - Thanks a lot! To be frank, I have used the easier path - just sudo apt-get install virtualbox - without looking for the correct version. Till now, it works fine. But next time when I will need to install it, I'll be wiser and I'll follow your advice. :-) – Cristiana Nicolae Oct 28 '13 at 14:16
Ubuntu 15.04 cloud image - no installation candidate found for virtualbox. This worked last week. Here is a paste: The virtualbox meta-package is not available on my Ubuntu15.04 cloud images so I have to add the repo and update first. – Spyderdyne Nov 17 at 19:25

If you want to have a latest version of VirtualBox, check this:

Add one of the following lines according to your distribution to your /etc/apt/sources.list:

deb vivid contrib
deb utopic contrib
deb trusty contrib
deb saucy contrib
deb raring contrib
deb quantal contrib
deb precise contrib
deb lucid contrib non-free

Alternatively, you can use add-apt-repository to add to your /etc/apt/sources.list:

sudo apt-add-repository "deb vivid contrib"

Add secure key:

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

Install VirtualBox:

sudo apt-get update
sudo apt-get install virtualbox-5.0
share|improve this answer

You can use

apt-cache search virtualbox

to search for packages related to "virtualbox".

Among others this finds a package virtualbox. Use

apt-cache show virtualbox

to get more information about that package.

As the description sounds like what you want use

sudo apt-get install virtualbox

to install the package.

share|improve this answer

My Ubuntu-15.04 cloud images are missing the virtualbox package from the included sources. Kostanos' method works, but since virtualbox is a meta-package with multiple versions depending on the release you are running you may need to specify a particular version.

Here is a script that checks for an installation candidate, installs the repo if there isnt one, then updates the package lists and installs it for you. As noted in his answer, be sure to change "vivid" to your release name.

if [ $(dpkg-query -W -f='${Status}' virtualbox 2>/dev/null | grep -c "ok installed") -eq 0 ];
    if [ $(apt-cache search virtualbox | grep virtualbox) ];
        apt-get install -y virtualbox
        apt-add-repository "deb vivid contrib"
        wget -q -O- | apt-key add -
        apt-get update
        apt-get install -y virtualbox-5.0

I had to write this for a Mythos project automation so I thought I would share.


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.