These instructions are out-of-date. See the newer post Setting Up A Ubuntu VM on 2016-10-14.

I frequently spin up VirtualBox VMs. For every reason, from quick tests to development projects. I have a file I keep on my desktop to document a few steps I run every time I install a new VM. I figured it was about time I properly document it, even if it is just for myself.


Requirements are relatively simple:

  1. A desktop with a decent amount of memory and 10 GiB or more of available disk space.
  2. The latest version of Ubuntu, which at the time I originally wrote these instructions would be the 12.10 64-bit desktop edition.
  3. I've updated this document in a few places after using Ubuntu 13.04, 13.10, 14.04, and 14.10.
  4. The latest version of VirtualBox, which at the time I originally wrote these instructions would be v4.2.6.
    1. Don't forget to download the VirtualBox Extension Pack if you'll need things like USB support or RDP.


I'm not going to go into details into installing VirtualBox, nor the settings I use for individual VMs. It is specific to each project, and is influenced by the host desktop as well. A very simple linux VM to be used for development purposes can run with a surprisingly small amount of memory and disk space. My desktop runs 64-bit Ubuntu, and all my VMs are 64-bit. I haven't used any 32-bit operating system since January 2008, so in my experience a complete 64-bit setup works very well.

Make sure you've enabled hardware virtualization in your BIOS, such as VT-x or AMD-V depending on the host processor.

If you have problems running VMs, or you experience any crashes or inconsistent behaviour, I would immediately suspect the host desktop. I regularly have several VMs running for several weeks at a time without requiring reboots or restarts, and I would expect no less. If any of my VMs ever crashed, this wouldn't be a workable development setup for me, and the truth is I've been running all of my development work like this since around 2005.


The following is the long laundry list of things I do to my Ubuntu VMs to get them ready for development:

Compilers and VirtualBox guest additions

In addition to sshd which is a useful daemon to have running, this installs everything needed to get the latest VirtualBox guest additions installed correctly.

  1. From a terminal session:
    • sudo apt-get install ssh dkms build-essential linux-headers-generic
  2. Install the VirtualBox guest additions: Devices -> Install Guest Additions...
  3. Reboot (though I think a logout/login is all that is required to get the guest additions loaded).

Getting access to all packages

By default, some of the package repositories are disabled when first installing Ubuntu. To enable them:

  1. In the top-right corner of the Ubuntu desktop, click on System Settings -> Software Sources -> Other Software -> enable the "Partners" repository.
  2. From a terminal session:
    • sudo apt-get update

Installing Chrome

I prefer to use Chrome as my browser. Installing it also automatically creates /etc/apt/sources.list.d/google-chrome.list to ensure that I continue to receive the latest updates from Google whenever they publish a new version of Chrome.

  1. Download the .deb and install Chrome from www.google.com/chrome.
  2. Ran into a problem with Ubuntu 13.04 beta: "Dependency is not satisfiable: libudev0". Solution for now is to install libudev0 before trying to install Chrome. For example, see Chromium bug #226002. This seems to no longer be an issue.
  3. Install adblock from chrome.google.com.

Getting rid of the hidden scrollbars

I dislike the new-style hidden scrollbars in Ubuntu. I find it difficult to find and click on them with my Wacom tablet, and it also prevents me from quickly seeing how far I am in a source file when browsing code. Thankfully, there is a simple way to bring back the old-style scrollbars.

  1. From a terminal session:
    • gsettings set com.canonical.desktop.interface scrollbar-mode normal

Getting rid of the Amazon ads

Lots of discussion on the web about the annoying Amazon ads in Unity, and privacy concerns starting in 12.10. Like my browsing, I prefer my operating system to be ad-free. This will disable the Amazon ads.

  1. From a terminal session:
    • sudo apt-get remove unity-lens-shopping
    • Command is slightly different in Ubuntu 13.04:
      sudo apt-get remove unity-lens-shopping unity-scope-musicstores

A much better and complete method for fixing the privacy issues recently introduced, including the Amazon search ads, is to run the script from fixubuntu.com.

  1. From a terminal session:
    • wget -q -O - https://fixubuntu.com/fixubuntu.sh | bash

Getting rid of the appmenu aka global menu

I dislike the Mac-style global menubar across the top of the screen. I much prefer every window keep their individual menubar which I can always see. With the global menu, it means I have to click on a window first, then go back to the top of the screen to click the menu option I want. If the menubar is kept in the window, then I can always go directly to the menu I want.

Some applications -- such as LibreOffice -- will still continue to use the global menu. But most other applications will revert back to their usual menubar with this change.

  1. From a terminal session:
    • sudo apt-get remove appmenu-gtk appmenu-gtk3 appmenu-qt firefox-globalmenu thunderbird-globalmenu
      sudo reboot
    • Command is slightly different in Ubuntu 13.04:
      sudo apt-get remove appmenu-gtk appmenu-gtk3 appmenu-qt firefox-globalmenu thunderbird-globalmenu appmenu-qt5
      sudo reboot
    • Ubuntu 13.10 has changed this yet again:
      sudo apt-get remove indicator-appmenu
    • Ubuntu 14.x has made this easier:
      Click on System Settings -> Appearance -> Behavior -> Show the menus for a window -> In the window's title bar

Using fish as a shell

I like bash. But recently I discovered fish, which I find offers a better command-line user experience.

For the newer version of fish, see the v2 release ppa or the nightly build ppa.
  1. From a terminal session:
    • sudo apt-get install fish
      chsh --shell $(which fish)
  2. Once I run fish, I like an alias for dir to be similar to ls -l. (Old DOS habits from 30 years ago die hard...!)
    Type these command at the fish command prompt:
    • function dir ls -l $argv end funcsave dir

Changing the default font size

Depending on your monitor size, you may want to increase or decrease the default font size. Ubuntu Tweak exposes this (and many other!) settings. Install it from the web site, or manually with the following command.

  1. From a terminal session:
    • sudo apt-get install gnome-tweak-tool
  2. In Ubuntu Tweak, find the setting to modify the font text scalling factor. In my case, I find all the fonts slightly too large for the monitors and resolutions I use, so I scale the fonts to 0.8 or 0.7. Otherwise, I would have to individually modify the default font for each editor, terminal session, and text-mode application I want to use.

Enable scrollback

Terminal sessions by default don't keep a large amount of scrollback. This can easily be fixed.

  1. In a terminal session:
    • Terminal -> Edit -> Profile Preferences -> Scrolling -> Unlimited
  2. You can now use SHIFT + PGUP and SHIFT + PGDOWN to scroll to the very start of any terminal session.

Install an IDE

For many years I was a big fan of Eclipse. There are several problems with Eclipse-CDT: it is a resource hog, complicated to configure correctly, and it needs Java. Installing Java in Ubuntu is frustrating, and I have little patience for confusing and conflicting instructions.

I also tried Anjuta a few years ago, and I note it continues to be developed for anyone looking for a suggestion. But for the past few years, I've been using KDevelop as my development environment for most of my projects.

This will install KDevelop, cmake, git, and subversion.

  1. From a terminal session:
    • sudo apt-get install kdevelop cmake git subversion

Install Doxygen

I'm probably quite slow to join this particular train, but I've recently grown to appreciate Doxygen. I'm a prolific commenter by nature, so all it took was a very small format change to my day-to-day source code comments to get them recognized by Doxygen. To get it installed correctly with all the other tools it needs:

  1. From a terminal session:
    • sudo apt-get install tk graphviz doxygen doxygen-gui

Man Pages

If it is a VM where I'm going to be doing a lot of development, having the right man pages installed can definitely help:

  1. From a terminal session:
    • sudo apt-get install manpages manpages-dev manpages-posix manpages-posix-dev unity-scope-manpages
    • Note the Unity scope help lens will only be activated once you reboot or logout and log back into your desktop.


If I need to use the Boost C++ libraries in my project:

  1. From a terminal session:
    • sudo apt-get install libboost-all-dev libboost-dev

Disable Screensaver

Since this is a VM, I find I have no use for the screensaver. Instead, I rely on my host to have a screensaver configured. To prevent the screensaver in the VM:

  1. In the top-right corner of the Ubuntu desktop, click on System Settings -> Brightness & Lock.
Last modified: 2016-10-15
Stéphane Charette, stephanecharette@gmail.com