wiki:StartTestingLinuxOnWindows

Version 5 (modified by Beman Dawes, 9 years ago) ( diff )

--

Getting Started Testing with Linux virtual machine on Windows host

Boost developers using Windows as their development platform may occasionally wish to run local tests on Linux, too. A Linux virtual machine running on the developer's Windows host machine is an easy and free way to do just that. A Linux or Mac developer could do the reverse, although doing so would require a Windows license be purchased, but this article is limited to the Linux on Windows case because that's what I'm familiar with.

Likewise, the article is limited to VirtualBox because that's the virtual machine manager I use. It was free, ease to install and use, and worked better for me than several similar packages. But that was some years ago and your mileage may vary.

VirtualBox and Ubuntu both have excellent installation instructions, but if they are new to you it still takes a while to figure out the various choices. The hope in documenting my personal installation process is to get you started quickly.

Initial downloads and installation

Create a new virtual machine

  • Run VirtualBox. Click the New button to create a new virtual machine. My host machine has four cores with hyper-threading and 16GB of main memory, so I give the virtual machine 2GB of main memory. I also give it 20GB maximum of disk space - VirtualBox only allocates that much if actually needed.
  • Once the virtual machine has been built, click Settings (gear icon) and set:
    • System: Processor: 2 CPU's.
    • General: Advanced: Shared clipboard: bidirectional
    • General: Advanced: Drag'n'drop: bidirectional

If you want to change any of the features of the virtual machine at a later time, you can do so via Settings.

Install Ubuntu on the virtual machine

  • Select the virtual machine, it it isn't already selected.
  • Click Start. When asked to specify a startup disk, browse to your download folder and select the Ubuntu .iso file you downloaded earlier. It will have a name similar to ubuntu-13.10-desktop-amd64.iso, except the version number and machine architecture may differ.
  • If a message about mouse integration appears, you probably want to check "Do not show message again".
  • When the desktop appears, select "Install Ubuntu".
  • Check the box: Download updates while installing.
  • Check the box: Install this third-party software.
  • Hit "Continue", "Install now", and then other than entering your name and the computer name, just keep accepting the defaults. But you probably want to choose "Log in later" for Ubuntu One

At this point, the install starts to run. It does quite a bit of downloading files, and one or two times I have had hangs almost certainly related to network problems or overloaded servers. When that happened I verified the md5 checksum for the Ubuntu .iso file, removed the virtual machine from VirtualBox and just started over. But usually everything goes smoothly.

Post installation restart and VirtualBox Additions install

The first thing to do after the install is to install the VirtualBox Additions. These are helpers such as device drivers that markedly smooth integration between the Windows and Ubuntu desktops.

  • A Ubuntu restart is required after the install finishes. Sometimes the post-install shutdown requires hitting Return (aka Enter).
  • After the post-install shutdown, start the virtual machine again.
  • When the Ubuntu Desktop appears again, from the virtual machines menu-bar select "Devices" and then "Insert Guest Additions CD Image...".
  • When asked if you would like to run the VBOXADDITIONS, click "Run". A terminal window (Linux-speak for command line window) will open and the additions will build. When you see the "Press Return to close this windows..." message, hit return.
  • Some of the additions don't become effective until a reboot, so click the vaguely gear-like icon in the upper right corner of the Ubuntu Desktop, and select: Shut down...

Set up Ubuntu for Boost library maintenance

Now we need to set Ubuntu up for Boost library maintenance. These steps only have to be done once.

  • Start the virtual machine.
  • Verify that if the Windows window that the virtual machine runs in is resized, the Ubuntu Desktop within it is automatically resized. That's a sign the VirtualBox Additions are installed properly.
  • Click the vortex-like icon at the top of the launch bar on the left side of the Ubuntu Desktop window. Enter "terminal" (without quotes) in the search box that appears, and hit return. Drag and drop the Terminal icon that appears to the launch bar.
  • Click the Terminal icon now on the launch bar. A terminal window (I.E. command line window) now appears running the bash shell.

Note: Your clipboard is being shared between Windows and the Ubuntu Linux virtual machine, so you can copy-and-paste or drag-and-drop stuff between windows on the two machines, just like you do between windows on Windows.

  • In the terminal window, check for the presence of Git, GCC/g++, and Clang/clang++ and install if necessary.

Note: See TracWiki for help on using the wiki.