These instructions are for a Windows host machine. An article here gives instructions for Mac OS X, but are unlikely to be very different. This assumes you've already downloaded and installed VirtualBox.
The next step is to install the operating system. A "Select start-up disk" dialogue box comes up, with a drop-down menu. The default selection is "Host drive 'D:'". Rather than use a DVD installation disk however, I've previously downloaded an ISO disk image file. I can select this directly from the drop-down menu (see Figure) because I've used it before, so VirtualBox remembers its location. If this isn't the case for you, you can click the folder icon to the right of the drop-down menu, which opens up a file browser and allows you to navigate to wherever you stored the downloaded ISO file (look here for a download). Click "Start", and the VM will start to boot from the ISO.
From here on the instructions are as to install Ubuntu from disk. Click through the defaults and self-explanatory settings, until the installation begins proper. This takes a while, and when it's complete you'll be prompted to restart.
First, the Linux VM needs Dynamic Kernel Module Support (DKMS) to be installed. Open a terminal on the VM and run:
sudo apt-get install dkms
This allows it to build external module kernels.
Select, from the VM's "Devices" menu, "Insert Guest Additions CD
image...". This will open File Manager showing the contents of the
CD, and the path, which will be something like:
Return to the terminal,
cd into the Guest Additions directory, then run:
sudo sh ./VBoxLinuxAdditions.run
Restart the VM. You're done.
While I try to have a VM for each project I'm working on, I start each one with a few bits and pieces that I expect to find useful on most projects. To make this as quick as possible I have a script on GitHub that performs the installation for me. To use this:
sudo apt-get install git
Clone the repository:
git clone https://github.com/0x7df/mkvm.git
Run the script:
cd mkvm ; ./mkvm.sh
You can see the software that gets installed from the listing below:
# mkvm - Make virtual machine # This script configures an Ubuntu virtual machine how I like it sudo apt-get -y update # Must be done before upgrade sudo apt-get -y dist-upgrade # Does upgrade with intelligent dependency- # handling sudo apt-get -y install dkms # For installing VirtualBox Linux Guest # Additions (https://www.virtualbox.org/ # manual/ch04.html) sudo apt-get -y install git sudo apt-get -y install nedit sudo apt-get -y install python-numpy # Contains, amongst other things, f2py sudo apt-get -y install python-dev # For Python.h; required by f2py sudo apt-get -y install gfortran sudo apt-get -y install python-pip sudo apt-get -y install python-matplotlib sudo apt-get -y install okular sudo apt-get -y upgrade graphviz sudo apt-get -y install texlive sudo apt-get -y install doxygen sudo pip install robotframework sudo pip install prospector[with_frosted] sudo pip install prospector[with_pyroma] sudo pip install prospector[with_vulture] sudo add-apt-repository ppa:staticfloat/juliareleases sudo add-apt-repository ppa:staticfloat/julia-deps sudo apt-get -y install julia # python-scipy # matplotlib # If Java JDK is required, determine the path: # > update-alternatives --config java # Set JAVA_HOME=/usr/bin/java (or wherever) in /etc/environment, which is the # preferred location for JAVA_HOME or any system variable. echo " # Now install the Linux Guest Additions for VirtualBox. Go to the # \"Devices\" menu of VirtualBox when the VM is running (make sure it is not in # stretch mode or the menu bar will not be visible); select \"Insert Guest # Additions CD image...\"; then run VBoxLinuxAdditions.run with administrator # privileges. Re-boot the VM; after this the VM desktop should resize with the # VirtualBox window, rather than being a fixed (small) size. "
One extra useful thing to do is enable the shared clipboard, which allows copy-and-paste from the host to the guest, vice versa, or both. Make sure the VM is shut down, select it in the VirtualBox Manager window, go to "Settings", "General", "Advanced" and select from the "Shared Clipboard" drop-down. Detailed descriptions with screen shots are here.