Setting Up Ubuntu Virtual Machine on Windows
Tags: ubuntu, tutorial, windows, vm
Published: 2021-04-18 11:46:32

# Introduction
We have a number of operating systems (OS) in the tech space today like linux, windows and so on. Sometimes, it is possible that there is a particular feature in one OS that we will love to use in another OS. AntMedia Server for instance is a live streaming application created for linux but can be used on windows too. This is made possible by virtual machine (VM).

In this tutorial, I will guide you step by step on how to set up Ubuntu Virtual Machine on Windows. When installed, you can now run applications such as AntMedia Server on windows through this VM.

## Prerequisites
In order to be able to follow through on this installation process, you need to have windows 10 or later installed on your machine.

## Set Up Virtual Box
A virtual machine (VM) is a virtual environment that functions as a virtual computer system with its own CPU, memory, network interface, and storage, created on a physical hardware system.

Happily, we have so many virtual machines in the tech space to pick from. We will be using [Oracle VM VirtualBox](https://www.virtualbox.org/) for the purpose of this tutorial. 

> Let's download and install the VM.

* Go to [Virtualbox Downloads page](https://www.virtualbox.org/wiki/Downloads)
![Virtualbox Downloads page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bi4df26ct8gb972tnmp1.JPG)

* Click on the **Windows Hosts** Link
* The application should start downloading or give you a popup to do so.

![Click on the Windows Hosts Link to start download](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bfhl5n5agjqnpy78rpgf.JPG)

*You should have the downloaded file*

* Double Click on the file and follow the installation process. It is straight forward. 

* When the installation is completed, start the application and you should have the following screen

![Virtual Box Home page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2cykf555p0n6yv4t7mw5.JPG)


## Setup Ubuntu Virtual Machine
Next, we will setup Ubuntu VM. To do this, we will do the following:

1. Create a new VM in the Virtual Box
2. Add Ubuntu to that VM

### Create a new VM in the Virtual Box
* Click on the **New** button at the top menu to create a new virtual environment

![Click on the New button at the top menu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s3rz66ljnekxz2jsm2vo.JPG)

* In the pop up window that shows up, Give it a name and click **Next**

![Name the virtual environment](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/492bucjrecaay2hu587r.JPG)

* Next, set a RAM size. Use the recommended memory size and click **Next**

![Set a memory size](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/miuk0g4ltry4yalgs24e.JPG)

* Choose how you want to set up the hard disk. It's advisable to use the recommended method and click **create**

![Choose how you want to set up the hard disk](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3a6n2gt5d8nx5r7crj8i.JPG)

* Choose the hard disk file type and click **Next**

![Choose the hard disk file type](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iy26nzvln4xcit0esxem.JPG)

* Select how the storage on the physical hard disk is to be allocated. **Dynamic storage allocation** is the recommended method. Click **Next** afterwards

![how the storage on the physical hard disk is to be allocated](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f8hv09txq84eg6cgk52c.JPG)

* Select the file location for the VM we are creating and give it a size. Click **Create** once you are done

![the file location for the VM we are creating and it's size](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1u6z9bh4cvvvw1kgggvp.JPG)

*You should have the following screen after a successful creation of the VM:*

![VM Screen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bobwb4w0bo4qtghy5kg0.JPG)

*Notice that it bears the name you gave it when you were creating it*

### Add Ubuntu to that VM
To add Ubuntu, do the following:

* Navigate to [http://releases.ubuntu.com/16.04/](http://releases.ubuntu.com/16.04/)
* Select the Ubuntu image that matches your operating system (64 or 32 bit)

![Select the Ubuntu image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xcwkzu23mq70q4fvroit.JPG)

*That will trigger the download of the ``.iso`` file. Once it is done, do the following:*

* Head back to the VM that you have created and click on the **Start** button on the menu bar

![click on the Start button on the menu bar](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gfsksuta5j25p3qghuzw.JPG)

* In the pop up that follows, click on the **storage** in the side menu

![click on the storage in the side menu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3vrwa3cly7hk0ux68n91.JPG)

* Next, click on the **Empty** link in the **Controller IDE** section

![click on the empty link in the Controller: IDE section](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8wx36iqhviawbcpjbzzp.JPG)

*This will lead you to add the Ubuntu file that you downloaded*

![add the Ubuntu file that you downloaded](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hf61hcwyk14ip31cris1.JPG)

*After adding the Ubuntu file, it should run an installation process. Once it is done you should have the following screen:*

![Ubuntu Home Screen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ad9xe26ek1h2bxhv7bcc.JPG)

> **Possible Error!**

It is possible to that after adding the Ubuntu image, it might not run and show ``failed to open a session for the virtual machine`` error message. The Error window will look like this:

![Error Window](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uxcedwimzkunw0tli1x7.JPG)

> **Fixing The Error**

To fix the error, do the following:

* Open Command prompt as **administrator**
* Type in the following command: ``bcdedit /set hypervisorlaunchtype off``
* Hit the **Enter** button. 
*You should get a success message like so:*

![Command prompt as administrator](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/aos9193rnkp93k52iolr.JPG)

* **Restart** your computer system

* After the restart, run the **Oracle VM Virtual Box**

* When the Oracle VM Virtual Box Manager is open, Click on the **Start** button at the top. 

*The process of loading Ubuntu VM should run correctly without error like so:*

![Ubuntu VM loading after without error](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r463d2teafbuvxqj199z.gif)

At the end, you should have the Ubuntu home screen like so:

![Ubuntu Home Screen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ad9xe26ek1h2bxhv7bcc.JPG)

> Wow... We now have another OS asides our initial OS. That is awesome!!!

## Conclusion
We have been able to see what a VM is and how important it is in our day-to-day operations especially when we need to cross-use an application in more than one OS. We also saw how to install a virtual box and setup a virtual machine.

Now with the Ubuntu terminal on your machine, you can run an app like AntMedia Server like you will normally do it on Linux. Why not give it a shot. See installation procedures [here](https://github.com/ant-media/Ant-Media-Server/wiki/Installation).

Thank you for reading!