Running Linux in a VM
You need a system with virtualization (VT-d), at least 4GB of RAM, and 40GB of free hard drive space in order to run Linux in a VM. If you want to download and compile the kernel, you may need additional space of up to 20GB. Also, ensure that Virtualization is enabled in your Host machine's system BIOS.
If your system doesn't meet those requirements, you will need to be running Linux, or dual boot your machine so you can run both Linux and Windows. We strongly suggest you use the Ubuntu 20.04 64-bit version. If your machine doesn't have 64-bit support, you can use ubuntu 16.04 32-bit version. Once you have Ubuntu installed, please follow the directions here.
Download Ubuntu 20.04 or 22.04
Installing Virtual Machine or Hypervisor
You may choose to install VMPlayer or Qemu KVM as your hypervisor or Virtual Machine software.
1. Install VMPlayer
Go to the VMPlayer website and click the 'download' link. Download the VMPlayer that's appropriate for your operating system (e.g. Windows or Linux 64-bit), and install it.
Linux VMPlayer installation instructions
The VMPlayer download comes as a .bundle file. That's a binary executable, that will launch a setup wizard.
First, change to the directory where you downloaded the VMPlayer binary by using the command cd.
Tip: cd changes the current working directory to a different directory. You can learn more about any command by reading the manual pages. Simply prefix the command with the word "man", e.g. man cd.
Next, check to see if the file is executable. Run this command:
Then look at at the file's listing, and see if it has the executable ("x") bit set:
$ ls -l total 181056 -rw-rw-r-- 1 sarah sarah 185386101 Apr 26 22:19 VMware-Player-5.0.2-1031769.x86_64.bundle
If it doesn't show the executable bit, make the file executable by running:
chmod a+x VMware-Player-5.0.2-1031769.x86_64.bundle
Then execute the binary by prefixing it with a ./ and running it as the root user with sudo:
- Tip: Be careful about what you run as root! The root user has access to all the files on your system, so you usually don't want to run arbitrary commands as root. Always run commands without sudo, and without changing to a root terminal, where ever possible.
Running Ubuntu 20.04 in a VM
Click "Create a New Virtual Machine". "Use an ISO image" and select the Ubuntu 20.04 ISO you downloaded. Hit "Next". Fill in your name, username, and a password, and hit "Next".
The next screen is your computer's information. The "Name" will be used for the machine name, and shown in all terminal prompts, so pick something short and sweet. You can change the Location of your VM independent of what you name the machine.
The next screen is hardware info. Increase the disk size to 40 GB, and chose "Store virtual disk as a single file". This makes it easier to copy the VM image from computer to computer. Uncheck "Automatically Start the VM".
Before you start the VM, you need to make some adjustments to the emulated hardware. Click "Edit virtual machine settings". Now, adjust the amount of memory available to the VM to be the recommended amount of memory. You also want to adjust the number of CPUs available to the guest. It should not be more CPUs than you have available (e.g. if you have a dual core, it should not be more than 2). Click the 'Save' button.
Once you've adjusted the emulated hardware, start the VM by clicking "Play virtual machine". If a "Removable devices" window pops up, click "ok". On the Software Updates window, click "Download and install".
Please wait for the software updates to download and install before you start using the VM. Otherwise the VM will be very VERY slow.
After Ubuntu 20.04 has finished installing, you can proceed to these instructions
2. Qemu KVM as your Virtual Machine
Qemu is a KVM based open source Hypervisor solution. It has significant performance advantages if installed on a Linux based host platform.
Installing KVM on Ubuntu
Follow these steps to install KVM on your Ubuntu host platform:
1. Confirm Virtualization Support
First, confirm that your host platform supports virtualization by running the following command:
$ lscpu | grep Virtualization Virtualization: VT-x
That's what you should see on an Intel based board. If you are running another processor such as AMD, the outcome will be different. In case you do not see any results of the above command, your processor may not support Virtualization.
2. Install Qemu KVM package
Now, you can execute the following commands to get Qemu installed:
$ sudo apt install qemu-kvm
That would install the Qemu based KVM package on your Ubuntu host.
3. Install Virtualization APIs
You now need to install the virtualization API required to communicate with the KVM. You will need to install the following two packages:
$ sudo apt install libvirt-daemon-system
$ sudo apt install libvirt-clients
4. Setting up the user for KVM access
If you now run command cat /etc/group on your terminal shell prompt, you should see new user groups named kvm and libvirt added to the group list. You now need to have your own user to be part of these new groups to be able to work with the KVM system.
To add your userID to the KVM and libvirt groups on the system run the following command:
$ sudo adduser $USER kvm
You will need to reboot your system for the group changes to take effect. Once you are back on run groups command in the terminal to confirm that you are now part of the KVM and libvirt groups.
5. Install the VM UI
It is very convenient to use the Qemu KVM User Interface. We can install it using the following command:
$ sudo apt install virt-manager
That would finish the installation of the Qemu KVM on your Ubuntu Host. You are now ready to launch the Virtual Machine Manager UI from the Ubuntu Apps menu. Once you have the Virtual Machine Manager screen open, use the "Add New Virtual Machine" menu and workflow to add a Virtual Linux guest OS such as Ubuntu, Debian, openSuse etc of your choice.