Virtual machines using VirtualBox
Tapping into all the wonderful tools and languages that make our lives as developers so interesting can throw up some fun (?) challenges.
You start installing the latest linter or library, and before you know it you’re in dependency hell. Required libraries require even more libraries, with difference versions numbers and clashing with your existing setup. If you’re really unlucky you break some essential software along the way.
A safer approach is to use virtual machines, for experimentation, and to keep different (and clashing) environments separate.
For more detail see the step by step instructions at Everyday Linux User.
These instructions are for installing VirtualBox on Linux Mint (17.2), and then creating a Linux Mint virtual machine
Installation and setup
I used mostly used the default settings. This may not be right for everyone
- Use a package manager to install VirtualBox.
- I used Synaptic, and selected virtualbox-5.0
- When I started VirtualBox and tried to create my first virtual machine (VM), it only let me create 32 bit VMs, even though my computer is fully 64 bit
- Fix this by going into the BIOS and enabling (Intel) Virtualisation
- If like me you have multiple drives (SSDs and/or HDDs) or multiple partitions, specify where VirtualBox stores the virtual drives (files):
- File -> Preferences -> General -> Default Machine Folder
Your first virtual machine
- Download a copy of the relevant linux Distro
- Start VirtualBox: Menu -> Administrate -> Oracle VM VirtualBox
- Click on “New”
- Name: E.g. “Linux Mint 1”
- Type: “Linux”
- Version: Linux 2.6/3.x (64 bit) or Other Linux (64 bit)
- Memory: Recommended size or higher (note: you can always change it later)
- During my first attemp I used the default of 256MB. When trying to boot Linux Mint off the install ‘disk’, the virtual machine ground down to a halt. Increasing this to 1GB fixed this)
- 512MB minimum, 1GB+ is probably better
- Hard drive: Create a virtual drive now
- Note: VirtualBox creates a file and pretends that it is a whole hard disk (i.e. a “virtual drive”)
- Type: leave as is (VDI)
- Size: Dynamically allocated
- Limit: leave as is or increase
- The machine has been created, but isn’t running yet. Click on the “New” button
- Click on the folder with green ‘arrow’ icon
- Select the previously download distro
- Click Start
- This will start the VM, which will boot off the downloaded distro
- Follow the instructions to install the new OS
- Suggestion: Use a different password from your main password. This is generally good security practice, but in this case it may stop you doing something on your actual Linux install whilst thinking you’re working on a VM. I realised this when I tried to stripdown all s/w on a VM to only that relevant to development work, and nearly removed some software of the host operating system
- If you get a large error message “Running in software rendering mode”:
- With VM stopped, go into settings -> Display -> Enable 3D accelleration
I suggest you clone this VM before you start experimenting, to save you having to reinstall the OS should you need another (clean) VM