Every time I need to set up another virtual machine it has been so long I can't remember how exactly it was done. It is not complicated but finding a working solution always takes time and makes me quite frustrated. So here is an attempt to save time and energy next time it will happen.
Don't ask me why but during my career all computers have run Windows (except a brief time on OSX). So you end up with Windows but very often the software you work with can only run on *nix OS:s. Enter virtual machines (VM). Personally I like VirtualBox, so I stick to it. Ubuntu is a nice Linux distro and most computers these days run Windows 10. So there we go!
- Install VirtualBox using the appropriate installer from their download page.
- Download a disk image (a .iso file) from Ubuntu.
- Create a folder in Windows that will be shared with the VM. It must not have any spaces, eg C:\shared.
- Create a new VM in VirtualBox (by clicking New, chosing Linux and Ubuntu and just going with the default values unless you know what you want).
- Add the folder created to Settings -> Shared Folders in VirtualBox. Be sure to select the Auto-mount option.
- In Settings -> General -> Advanced select the Shared Clipboard as well as Drag'n'Drop to be Bidirectional.
- When starting the VM just created, chose the iso file when VirtualBox prompts for a start medium. (The installation of Ubuntu is outside the scope of this post but being in a VM the worst thing that can happen is that the VM crashes.)
- Install the VirtualBox Guest Additions by selecting Insert Guest Additions CD image in the Devices menu and then restart the VM.
- The shared folder will be mounted at /media/sf_shared but to access it the user has to belong to the vboxsf group, so:
sudo usermod -a -G vboxsf username
- Restart the VM. (This is weird bit the group change is spooky, try id and id username and go figure...)
- I prefer having a link in my home directory for quick access: ln -s /media/sf_shared shared