THE VIRTUAL MACHINE - TYPES AND HOW TO SETUP A VIRTUAL MACHINE
Tags: virtualmachine, cloudskills, linux, azure
Published: 2022-01-28 08:12:26

What comes to your mind when you hear the word virtual? Basically, a logical representation of a physical thing. This applies to the computer world also, when something is said to be virtual, it simply means a logical representation of a physical thing created in a computer through software. To illustrate, take a look at the Ps4, the players aren’t the real players, but a virtual representation of the real players. Take a look at your photo album on your computer, it’s a virtual family. In the game “Temple Run” the person running and jumping is a virtual human being. In these illustrations, the football game, the family, and the person jumping and running are all created virtually using software on the computer.

          Virtual machine, commonly abbreviated as VM is no different from other physical computer like laptop, desktop, smart phone or server, it has a CPU (Central Processing Unit), memory and so much more. While the part that makes up your computer (called hardware) are tangible and physical, VM are often thought of as a software implementation of a physical computer. It creates an isolated duplication of a real computer and allows us to perform operations as we perform operation on a real computer.

          A VM is a software program that not only exhibits the behavior of a separate computer but also capable of performing task such as running it own programs and application like a separate computer. With a VM you can install one operating system in another operating system on same computer. To illustrate; you install a Linux operating system on your virtual machine on your windows operating system which happens to be your physical computer also known as the HOST.

Virtual hosts are able to share resources between multiple guests, or VM’s each with there operating system. The two basic type of VM are;

   1.    System Virtual machine

   2.    Process Virtual Machine


 

## **1. A SYSTEM VM**

    The System VM is also called hardware virtual machine. It is the software emulation of a computer system. It can also be referred to as a fully virtualized VM designed to be a substitute of a physical machine or acting as a substitute for the physical computer. To illustrate; you can install Windows XP/7/8 or Linux Ubuntu/Kali in Windows 10 operating system with the help of VM.

The system VM provides a platform for the execution of a complete operating system. It will create a number of different isolated identical execution environment in a single computer by partitioning computer memory to install and execute the different operating system at the time. Hardware resources are shared and managed, forming multiple environments on the host system. These very environments are isolated from each other but exist on the same physical host. It enables time-sharing among several single-tasking operating systems.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ltqmqt0z4roefv1pvy0w.png)

   Bear in mind that to enable memory sharing between different virtual machine on one computer operating system, memory over commitment system can be applied. With memory pages having identical content, the memory pages can be shared among multiple VM which are present on the same host. But this is highly useful for read-only pages.

 

Examples of system VM

    i.       VMware

    ii.     VirtualBox

 

**I. VMware**

The VMware has two versions. The VMware player which is a free and basic version. The second is the VMware workstation which is a paid application and often time used in enterprise setting. The work station application provides all the benefit you could have on a VMware player and also includes the feature to clone machines. The VMware can run but on Linux and windows operating systems.

**II. VirtualBox**

VirtualBox is an easy user friendly VM application. It has large number of features that makes sustaining multiple virtual machines simple. It also allows files, drive and peripheral sharing with the host computer. The VirtualBox can be used on various application such as Mac Operating System, Windows Operating System and Linux Operating System.
 

## **2. Process Virtual Machine**

     A process virtual machine is also called a language virtual machine or an application VM and sometimes it is been referred as Manage Run-time Environment. This type of VM runs as a normal application inside the host operating system, supporting a single process.
    The purpose of a process VM is to perform a platform-independent programming environment that abstracts the details of the underlying hardware or operating system and also allows a program to execute in the same way on any platform. Process VM are implemented using an interpreter for improving performance.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l6z5iku3emalzeodg449.png)

Example of Process VM are

   I.       Java Virtual Machine (JVM)

   II.     Parrot Virtual Machine (PVM)

   III.  Common Language Runtime (CLR)

**I. JVM**

JVM is an abbreviation of Java Virtual Machine. It allows any system to run Java application as if they were native system. It also allows other programs written in other languages as far as they are compiled to Java bytecode.

**II. PVM**

The parrot VM is designed to efficiently compile and execute byte code for dynamic language. It is a host to various languages implementing in various stages of completion, including TCC, JavaScript, Ruby, Lua, Scheme, PHP, Python, Perl 6, APL and .Net bytecode translator.

**III. CLR**

This is the virtual machine component of Microsoft .Net framework. It manages the execution of .Net. Just-in-time compilation convert the manage codes (compiled into mediate language code), into machine instructions which are then executed on the CPU of the computer.

Let create a virtual machine with the following steps;

VM name: Web01

Region: Closest region to your location

No infrastructure redundancy required

Image: Windows Server 2019 Datacenter Gen1

Size Standard _DS1 with 1 VCPU 3.5 GB of memory

If you do not see that size, select the closest size available

Username: iisadmin

Password: Enter your desired password

Enter ports 80, 443, and 3389

Click review and create.

Connect to your web server via RDP.

Go to the Server Manager and add the IIS (Server Role).

After installation, go to file explorer and access the path %SystemDrive%\inetpub\wwwroot.

Add a file named “index.html” with the text

Welcome to my initial web page.

Do not worry about adding HTML /markup.

Test the website by going to the public IP address. You can access the public IP address from the Azure Portal, by going to the Overview section of the Virtual Machine

Here are the detailed step-by-step on how to complete the exercise:

Login to the Azure Portal.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wx5ayibwnssek6p758ld.png)

Click on Search bar at the top of your Azure portal, type Virtual Machine and click on it.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/azvoqtgub2pf7hdz2fxo.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/616lkobtutwbz6rccoxp.png)

Click on Ctreate > Virtual Machine


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/koz2srm4dxclp69tjjag.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8wouwrzpcc5f47spjvfl.png)

Subscription can be left on default - Azure Subscription 1. (just like the screenshot above.)

To create a new **Resource Group** click on **Create New** 

Name the resource group **Webservers**

Next will be the **Virtual Machine Name** set to _**web01**_

The **Region** can be left at default but double check that it is the region that is closest to your location. 

**Availability** options set it to **_No infrastructure redundancy required_**.

**Security Type** >  **_Standard_** 

**Image** use _**Windows Server 2019 Datacenter-Gen1**_

 You might not see Gen1 so click on **Configure VM generation** > _Generation 1_ then go back to the image and use _**Windows Server 2019 Datacenter-Gen1**_.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/klliejn699a1sohykpx4.png)

**Size** use _**Standarrd_DS1_v2 - 1 vcpu, 3.5 GiB memory**_

If you do not see this size, you can choose the size in the standard section with the closest specifications.

**Username** use _**adminblock**_

**Password** use a password that meets the given requirements

 **Inbound Port Rules** leave it at **_Allow Selected Port_**

**Select inbound ports** click on **_HTTP (80) HTTPS (443) RDP (3389)_**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/evfafe21rt42idzmcea4.png)

Next is **licensing**  Don't change options for the licensing.
Click on **Review** + **create**.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xag5oypvhn45ai12pmns.png)

**Next** click on **Create**.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/04742ugjsaxxgxitxrjv.png)

This might take a few seconds but once provisioning is complete you will get a page that says something along the lines of

Your deployment is complete.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c8dpeep9rg2fl1d6cqaw.png)

## **Pat yourself on your back for getting to this point, You deserve it.**

Next click on the button **_Go to resource_**.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jixkpus5oten3n6ovufz.png)

Next On the top left click **Connect** and select _**RDP**_

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ozn06t153r902j69onm.png)

To Connect with **RDP**:
IP address used **_Public IP address (102.133.184.189)_**
**Port number** is set to _**3389**_.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8t07q1wgnp501u5lllsn.png)

Next Click on **_Download RDP_** file and open the file.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p9ok7lartunrzhpj8ai6.png)

Next input your **_Password_**, the password that you created within the Azure Portal. (If this doesn't work, not to worry check the next screenshot)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8m4jfv3a1qd806zp6kw3.png)

Depending on your network you may need to click on **_More Choice_** then click on **_Use a different Account_** input the login credentials which you use on your Azure Portal: **_adminblock_** as the **_Username_** and the **_Password_** you setup.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ynxkl4uecjkl4c6o8b9n.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6spenud3v5lx9eptqmly.png)

Next click connect and yes to accept the certificate.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b6u3f2qgex7zppgpck72.png)

## **Ta-Da! you've created your first Virtual machine. Please give yourself a pat at the back.**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/je27k7y0y5qt8i09h1bw.png)

Now lets create a **Webserver**

**Login** and **Server Manager** should be open. If not, you can click on the icon at the bottom middle

Next click on **Add roles and features**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j0xqcgtj74fghj19pyo6.png)

Follow the wizard and leave all the settings in the default settings, keep clicking next until you get to **Server Roles**.

    **Server Roles** select _**Web Server**_ (IIS).

   Select Include **management tools** (if applicable)

   Click _**Add features**_.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ufgey66wn2k1h07gzwfs.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pqdmtsdiy39iu1w3ulcb.png)

Click **Next** . The minimal features should already be selected and adequate.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/niapvn46yhku4bgocz2n.png)

Click  **Next** till you get to **Role Server**

   Scroll down, select **_IIS Management Console in Management Tools_**, then click **_Next_**.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eq3s70dfgxle7snczqu1.png)

Select **Restart the destination server automatically if required,** click on **Yes**  then click **Install**.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wfzqiry4yqg1vzqizpy9.png)

The installation will take a few munities. Once the installation has completed, click **Close**.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lyidaofzmj50hmbef51u.png)

Go to the main menu for you computer and search for **inetmgr** and open **Internet Information Services (IIS) Manager**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0k3y1mpn2g6kir9k5gcn.png)

Click **web01** _(web01/iisadim)_ to open up the pane.
Click the arrow next to **sites** to access the **default website**.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kkvbqiyf2e3xab8nv139.png)

Right click on the **Default website.**
Select **Manage Website.**
Select **Advanced Settings.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pxtbr2b6aqamadqx7e84.png)

Look for and copy the physical path which should be some thing like %SystemDrive%\inetpub\wwwroot

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vph3pwkgbhje6sigw3hk.png)

Open **File Explorer**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i2obirg0i5i71jlgtpdl.png)

Click on **This PC** >  **Windows (C)** 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nneo2oi9uxsk2zb0rx7q.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b0s2d2mx0eegxsb9nu6d.png)

Click on **inetpub**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ade6kztfbuno0tseoxk9.png)

Click on **wwwroot**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p3oo4xr90p8tzh9fvl4w.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7o3gcbic4nkvro6n9uag.png)

Right click on the empty space and select New then click on Net Text Document.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fdvo75z2pi36qrz3buh8.png)

Enter the following text with no markup into the text document.
**"Welcome to my initial web page"**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t69woxy3wcom04738y8c.png)

Click **File** and save as **index.html**
Change the Save as type as **All Files**.
Click **Save**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r6vhi40zc9qoyxw8s8r1.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6jqsbkybf9vxt1ubxo51.png)

  This will take precedents over the **adminblock file** and you should now see this page as your home page when you go to the public IP address.
  Go to the main **Menu** of your Virtual Machine and click on **internet explorer**.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6rfshxu23fchrqckwurs.png)

Impute the **Public IP** address from your RDP and click enter. You should see the home page you created with the text **"Welcome to my initial web page"**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n0z7yha98msxpmheairm.png)

If you got to this point, I want to say a big **Well Done**.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y0pxa9tdrd91ysr8dhzw.gif)