What is Virtualization: How to set up a Linux Virtual Machine with Virtual Box
Tags: linux, virtualmachine
Published: 2023-05-31 22:12:55

Virtualization is the process of creating virtual instances of computing resources such as operating systems, CPU, storage, servers, etc. It involves abstracting the physical infrastructure and separating the software from the underlying hardware, allowing multiple virtual instances to run on a single physical machine or infrastructure.

## What is a Virtual Machine?

A virtual machine is the software emulation of a physical computer that acts as a separate computer with its operating system (OS ), CPU, and storage. It gives the ability to isolate and compartmentalize different computing environments.

So you have a Windows machine running on a Windows operating system and you want to run or test an application that only works on another OS for example Linux. This means you need to get another computer and install the Linux OS to test that application. Instead of doing this, you can install a virtual machine that allows you to run Linux OS simultaneously with the Windows OS on your Windows machine. The virtual machine helps to isolate the Linux and Windows OS running on your computer without any interference.

## What is a Hypervisor?

A Hypervisor is a software that creates and manages virtual machines(VM). It allows the hosting of multiple virtual computers on a physical computer. It allocates resources such as CPU, memory, and storage to the virtual machine without interfering with the operation of the physical computer. 
There are two types of hypervisor:

- **Type 1:** This is also known as `Bare Metal hypervisor` and it runs directly on the computer hardware instead of the operating system giving it direct access to the computer resources. It is mostly used by large organizations for their infrastructure common examples include VMware ESXi and Microsoft Hyper-v.

- **Type 2:**  The hypervisor is hosted on an existing operating system and it depends on the host computer for virtualization. It is mainly used for personal computers and end-to-end computing. This hypervisor is also known as `Hosted hypervisor` and common examples include VirtualBox and VMware workstation.

## Setting up a Linux (Ubuntu) Virtual Machine with VirtualBox

Now that you’ve seen virtualization and virtual machines, I’ll show you how to install Linux (Ubuntu) Virtual Machine with VirtualBox.

`VirtualBox` is an open-source virtual machine created by Oracle that allows you to create and host multiple operating systems on a physical computer. It is compatible and can run on any operating system including MacOS, Windows, Linux, etc.

**Step 1:** Install VirtualBox

From the [VirtualBox download page](https://www.virtualbox.org/wiki/Downloads), select and download the package compatible with your computer’s operating system. Follow the installation process to have VirtualBox running on your machine.


![VirtualBox download page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/szkfyx7f9ml44byzoyd0.png)

**Step 2:** Download the ISO file.

From the Ubuntu [website](https://ubuntu.com/download/desktop), download the ISO file for the Ubuntu operating system. An ISO file also known as ISO image is commonly used in virtual machines because it allows you to easily install an operating system or other software without needing a physical CD or DVD. 

**Step 3:** Setting up the Virtual machine environment

Now that your VirtualBox is running, you can go ahead and create a virtual machine. 

- Click on `New` to create an operating system and this will open up an interface to configure your operating system.


![create a new vm](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6xofsf9ijf4mctvzgk21.png)

- Next, you’ll see a prompt that allows you to enter the name of your virtual machine and VirtualBox will fill the type and version field based on what you entered. This can be changed afterward. You will also select the ISO file for the virtual machine.

![create a new vm](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u59mixmq5ry0m6y74srd.png)

- Next, you enter the username and password for your virtual machine.

![create a new vm](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n1uhln15gv44vesqmnof.png)

- Assign Ram storage and processor.

![create a new vm](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3st8hvxnty2sci10af2g.png)

- Add virtual hard disk to the virtual machine.

![create a new vm](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yvh2fb7few43hnph1hkn.png)

- Finally, you should see the summary of the configurations for your virtual machine.

![create a new vm](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kx3i0ejna8ks6p83fcft.png)

Click on finish and allow the virtual machine to load the operating system selected. The operating system will require setup and when this is done, your machine should be up and running. 


![create a new vm](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y80y7p63od6ud8bktepd.png)

That's it!!! You now have a Linux operating system running on your virtual machine.