A Beginner's Guide to Installing Linux OS Using VirtualBox on a Windows Machine.
Tags: beginners, linux, tutorial, ubuntu
Published: 2022-08-19 14:44:26



On a Windows machine, there is only one operating system (OS) available, which is the Windows OS, pre-installed and used by default, which powers the computer. An operating system is software that allows one to use a computer and maintain its efficiency by handling all of its hardware resources.
 It is also the link between the hardware and software components of a device. If this balance does not exist, a desktop and laptop can simply not function. 


![Windows Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ckrnlyxu15o8atg44lr0.png)
Because many computer users are very familiar with Windows, and may not like to switch completely over to Linux OS, by installing it directly and configuring it to become the main OS on their computer systems, it is advisable to host the OS on a virtual machine.

![Linux Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jxcl4dg15zy85kpe6hp4.png)
The virtual machine used in this article is VirtualBox, third-party software that enables virtualization. It looks like this.

![VirtualBox Logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jvk4aln5md4hugxehzqc.png) 

You might wonder, how is this possible, running two operating systems on one computer system? 
This is possible by the presence of the Hyper-V on the windows OS, known properly as Windows Server Virtualization. It is a hypervisor that permits virtual machines to run and allows for the virtualization of ``x86-64 servers`` on the computer.  

![VirtualBox x86-64 servers](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y0cyuv8ed3zfjjgxbteg.png)

At the end of this article, you should be able to install Linux OS on your desktop or laptop using VirtualBox without having to get rid of the default OS. 

To start, simply search for VirtualBox on any search engine of your choice, go to the official website and download the ``.exe`` file. There are several options, for different OS, click on that of Windows, or simply follow this [link](https://www.virtualbox.org/wiki/Downloads) to download it.  

The Windows version is represented as ``x86/amd64``. Click on that to download the file. There are checksums to indicate that what you are downloading on your machine is secure, and the same as what the developers have created. It is displayed as ``SHA256 checksums`` and ``MD5 checksums`` on the page. 

When that is done, it will show up on your device as Oracle VM VirtualBox Manager. Install it and follow the instructions given.
  

After this, it will request that the file is allowed to make changes to the computer. You are to click **Next** and move on to the next step. 
 

![VB Changes](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ugdnnrt25dl69pketlww.jpg)
VirtualBox is wonderful in many ways in the sense that it is an emulator. It mimics the environment and makes it into a desktop. 

Give the virtual machine whatever name you have in mind, something descriptive, create a folder for the machine that you can easily have access to located on the RAM of your local machine, and choose ``Ubuntu (64-bit)`` as the type of Operating System (OS) amongst the several options present.

![VirtualBox Name and Operating System](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pxcf72kkel3a8pt4ssk4.png)
 
![VirtualBox](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ap8oz9kj4huwt9abo6e1.png)
NB: While downloading Ubuntu, setting up the LTS version on your local machine is important, as in ``Ubuntu 20.04 LTS``. This will ensure that you receive any updates that are given. It normally comes within a six months interval. Any other applications without the LTS will become outdated with time. 

Next, you will be asked to select the amount of memory space that is to be allocated to the virtual machine. Although the recommended memory is 1024 MB, you can decide to add more, depending on the overall space on your local machine. Take care not to allocate too much, as this will affect the local machine's performance.
  
![VB Storage Space](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1kefynpvdg39li2jhyax.png)

After that, you will be asked to choose a hard disk. Choose the second option, which is to **Create a virtual hard disk now**. The recommended memory is 10.00GB. 

![VB Storage Space 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ap2hqnxcuxnp72lraad4.png)

For the type of hard disk, choose the first; **VDI (VirtualBox Disk Image)**, although VirtualBox supports all three options available. 

![VB Storage Space 3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w4i9m6n6f1dk9pznmqf1.png)

For the storage on the hard disk, it should be **dynamically allocated**. A fixed size may take longer to create and cause storage issues later on, especially if the local machine does not have much space. 

![VB Storage Space 7](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0lwanlx16em14ln72vzx.png)

File location and size should be left at the recommended portion of 10.00GB, out of the 2TB option displayed on the screen. 

You can then **Create**. This should be the result after giving the server a name of your choice.

![VirtualBox Linux Server](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ltt5r4fhogsb7wgn4fnx.png)

This will then show the virtual computer that has been created on the left side of the panel, under the section called **Tools**. It is powered off on default. 

![VirtualBox Setup](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ocwsh9zi1kivmdk5uhkm.png)

After creating a virtual computer that will enable the use of another OS on the local machine, it is important to download software that will enable its use. **Vagrant** will be used to illustrate that in this article. Search for [Vagrant by HashiCorp](https://www.vagrantup.com) to download and install. 

![Vagrant Setup](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/94ojeucopqyi2kau72fe.png)
A folder is to be created in the file explorer of your local machine for its running. It can be named after Vagrant.

It is important to note that Vagrant does not have an interface, so everything will be done in your local machine's **command line terminal (CMD)** using GitBash. 
There is no need to install this, it is already present in your Windows OS.  
This is what the command prompt looks like.

![Command Line Interface](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jf2lx1rrg5ppmlgjrsfq.png)

An ISO image is to be downloaded and installed, like a normal installation, for virtual machines. This is because while working with servers (physical metal devices), a CD/ DVD, flash, or external hard drive is needed to do the installation.
 All of this is done differently on Vagrant. Here, there are already default boxes created, that are hosted online. When they are downloaded, depending on your choice, Vagrant automatically sets them up.  

The following are commands that can be typed in the terminal to create a new folder and procure the boxes. 
_NB: Do not forget to press the **Enter** key after each command is written so it can be initialized._

```
 cd vagrant 

ls 

cd boxes 
```

 

**Vagrant init** is the command used to create the file used to proceed with the configuration. 

```Vagrant init ubuntu/focal 64``` is used to install ``focal 64``, a box needed to initialize the function of Ubuntu.

**Vagrant up** is used to examine the configuration files and check if you have the necessary boxes needed. If it is not present, it automatically downloads it. 

```Vagrant up``` 

After all of this is done, there might be a virtualization error when trying to run the Ubuntu server. This can be corrected by enabling virtualization technology on your local machine.  

To achieve this, the computer has to be switched off and turned back on again.  

Once it's turned on, click on F10 immediately, more than once, if necessary, to enter the system **BIOS**.  

Navigate the environment with your arrow keys, as the mouse may, or may not work, depending on the model of your machine. 
Enable the Virtualization setup. It is located under System Security. It is disabled by default.

Save your changes and exit the BIOS environment. The machine will switch on by itself after this is done.  The Ubuntu server will be able to function properly after this.  

**Vagrant ssh** is used as the third and last command, but it is written in the Vagrant terminal this time, as the virtualization has been enabled. 

```Vagrant ssh``` 
 It is used to be able to access the machine.  

There is a ``welcome`` message that shows up on the terminal after this command is run. 
An accompanying message might follow which asks for ``log in `` and ``password``. Input ``vagrant`` for both fields.

After following all of these steps, you have successfully installed Linux OS on your local machine using VirtualBox as a virtualization compartment. 

## Wrap Up
We have gone through the process of installing Linux OS using a virtual machine, without getting rid of the default OS. 
Download and install VirtualBox first, then Vagrant, and enable virtualization in your system BIOS to ensure it reaches its full potential. 
Linux OS is a powerful operating system, and it's an amazing feat to comfortably access two operating systems on one machine. 
I hope this article has been helpful!