How To Create A Virtual Machine With Linux

ReginaOfTech
9 min readJan 26, 2020

Creating a virtual machine with Linux installed is a great way to explore the operating system (OS). This open-source operating system is popular due to its low maintenance, high security, and stability. Because Linux is open-source, a broad range of developers have been able to comb through the OS line by line and correct its weaknesses. Having a virtual machine with Linux installed is a great tool to have since it is a popular OS among businesses.

However, due to Windows’ popularity and ease of use, you may not want to give up Windows entirely. This is where a virtual machine (VM) comes into play. A VM essentially creates a play box within your computer but does not allow either OS to interact. What you do in the VM will not leak over to your main computer.

The VM that we will use for this installation is Oracle’s Virtual Box. It is easy to install and the GUI is intuitive. As well, make sure that there is at least 12GB available on your computer’s memory. This will be allocated to the VM and that your computer is at least 4GB of RAM. If it is less than that, your machine may start to log quite a bit when Linux is up and running.

Getting Your Computer Ready

Before we dive into getting Virtual Box installed on your computer, we need to make sure that the settings are enabled. Being a virtual machine is not a common day to day expected use, the AMD-V or Intel Virtualization Technology setting needs to be checked. If this is your first virtual machine then this is probably a necessary step. If this is not done when you run the VM it will error out because the main OS is stopping the allocation of resources (memory and RAM) from occurring.

To access the AMD-V or Intel Virtualization Technology setting you will need to access the BIOS settings. To do this, Google the maker of your computer and how to access their BIOS and what you need to change for virtual machines to work. Unfortunately, each maker has their own way to get to this. If you know how to access your BIOS skip ahead to the ‘Allowing Virtual Machines’ header.

Accessing System BIOS Without A Hotkey

Sometimes the opportunity for accessing the BIOS is so quick that the user may not be able to get to it the first couple restarts. If you are on a Windows computer, accessing the BIOS can be done with a couple of clicks.

Restart in Advanced Setup

Open the settings window and click on ‘Update & Security’.

Once that is opened, click on ‘Recovery’ in the left panel. Then under ‘Advanced startup’ there is a ‘Restart now’ button. Click that and your computer will go into the advanced startup.

When your computer restarts a blue screen will be presented to you. You can use the arrow keys to move the white box to the desired option and then hit the enter button. If you go into the wrong option, the ESC button will bring you back. To move ahead, select Troubleshoot.

This will bring up another selection. You will need to enter Advanced options.

Under Advanced options, there will be a BIOS, firmware, or UEFI Firmware Settings selection. You will need to select that.

Hit that Restart button and enter the BIOS settings.

Allowing Virtual Machines

Once the BIOS Settings is up, locate the ‘AMD-V’ or ‘Intel Virtualization Technology’ setting. This may be under security options. Be sure that it is enabled and save your changes and exit.

I wish that I could help further in the BIOS settings area, but each maker has their own way of handling that. Before you dive into this be sure to research how to access the BIOS settings and what and where you need to change for the virtual machines to work for your machine.

Installing Virtual Box and Linux

Now that your computer is ready to handle VMs we can start to create one with Linux installed.

Step 1: Download and Install Virtual Box

Go to https://www.virtualbox.org/ and select the version that you would like to install. For this post, we will be using version 6.1 but the steps should be similar between each version.

I’m sure you are well acquainted with installers, so go about your business with that and set it up how you would like. I stuck with the default options, but you do you.

Step 2: Download Ubuntu

This step can be done at the same time as step 1 if your internet allows.

Ubuntu is a great option for beginners. This Linux distribution has been around for quite some time, 1991 to be exact, and there are plenty of forums and docs to help you.

To download Ubuntu, go to https://ubuntu.com/download/desktop and download the version you prefer. It is up to you, but DO NOT RUN THE INSTALLER ON YOUR COMPUTER! It will be run in the VM. Running it on your computer will cause you quite a headache.

Step 3: Create The Virtual Machine

Open Oracle VM VirtualBox Manager and select the ‘New’ button.

A window will pop up asking you to name the VM. You can name it whatever your heart desires. Conventionally, it is named the operating system. For this demo, we will name it Ubuntu. The ‘Type’ and ‘Version’ will auto-fill, but just be sure that the ‘Type’ is Linux and the ‘Version’ is Ubuntu. Also, the ‘Machine Folder’ will be pointing to where the VM will live.

Hit the next button and the Memory size will be allocated. You can stick with the default size of 1024 MB and that is roughly 1GB. It is normally recommended to double that to 2048 MB so that 2 GB will be used for memory.

Once you have selected the memory size, hit the Next button. The next page will be creating a Hard disk. You will keep with the default ‘Create a virtual hard disk now’.

Select the Create button and keep with the default ‘VDI (VirtualBox Disk Image)’ on the Hard disk file type page.

On the next page, you can select how much storage to use for the hard disk. You can pick your poison on this one. I will stick with the default ‘Dynamically allocated’ option.

Almost done. From there you will select how much memory the virtual machine will be allocated. Normally you will want to have 15–20 GB. So, go ahead and set it to 15GB. Hit the Create button.

There should now be a virtual machine in the left panel named Ubuntu.

Step 4: Installing Linux In The Virtual Machine

First things first, move the Ubuntu installer into the folder where your VM is living. If you kept the location defaults you should see a folder named VirtualBox VMs on your C drive. Within there, a folder named the VM, in our case Ubuntu, will be there. Place the installer in that folder. This will allow the VM to access the installer. In several situations, I have been unable to access anything outside of the VM domain and the way around that is to place it right where the VM can access it.

Now we are ready to start up the virtual machine that will have Linux. Select the newly created VM and hit the start button.

The virtual machine will start up and the start-up disk window will pop up. The dropbox should auto-fill with the Ubuntu image, but if not select the folder to the right and direct it to the installer.

Hit the Start button when you are ready and the VM will get ready for the installation. This may take a couple of minutes, but when it is ready, select the language to the right and hit ‘Install Ubuntu’.

Install Ubuntu

You will be prompted to select the keyboard layout. Fill that out to your preference and continue. We will stick with the default ‘Normal installation’ and continue.

Installation Type Breakdown

The next page is the installation type. Here you can select the best option for you. Here is a breakdown of what each one means:

  • Erase disk and install Ubuntu — If your system will only have Ubuntu and erasing everything else will not harm anything, then choose this
  • Encrypt the new Ubuntu installation for security — This will completely encrypt all of your disks. This is greatly extended security if what you will be working on is confidential. If you are a beginner, then this shouldn’t be necessary. If you need to update this option, creating another VM is an option.
  • Use LVM with the new Ubuntu Installation — Choose this if you use LVM based file systems
  • Something Else — If you are an advanced user and have the urge to create the partitions. This is what you will choose if you are installing alongside an OS such as Windows.

Since we are using a virtual machine and do not need to worry about working alongside another OS, we will stick with option 1 and erase the disk.

When you hit the Install Now button another window will pop up. It is informing you of what partitions are being created. Hit the continue button if everything you see is to your preference.

Create Account

Ubuntu will ask you what time zone you are in. Select the time zone and continue. The next window will be creating an account. You can fill this out however you like. When you are ready hit the Continue button.

This is the final window before Ubuntu is fully installed on the VM. This may take a couple of minutes, so just relax and let Ubuntu do its thing.

Once Ubuntu is installed you will be prompted to restart. Before you do that be sure to remove the installation routine that we placed in the folder earlier. If you happen to forget to remove it, not a big deal. It will prompt you to remove it and restart the virtual machine with Linux installed.

You are now the proud developer of a virtual machine with Linux installed! It is a simple process to have a VM with any OS that is not your primary installed on your computer. Experience with this operating system is a great tool to have in your belt and a relevant resume enhancer.

If you are interested in other virtual machines, check out how to create a virtual environment with TensorFlow!

Until we learn again,

Originally published at https://reginaoftech.com

--

--

ReginaOfTech

A tech explorer with the drive to learn, apply, and expand her mind | https://www.reginaoftech.com