Open In App

How to Run Multiple Virtual Machines Windows and Linux Inside VirtualBox?

Last Updated : 22 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Virtual Machines are the software applications/files which emulate the physical computers.

This process of emulating a physical computer and making able to run instances of it on a single physical machine is called Virtualization.

A Virtual Machine (VM) allows us to run multiple or different Operating systems on a single physical machine and share the same hardware, networking, storage among them. Virtualization helps us to utilize the underlying hardware more efficiently.

A normal single computer system or a machine runs only one OS at a time, where as VM’s allow us to run multiple OS at a time.

We call it virtual because, there are no actual machines present, it creates an illusion as if we are actually using different machines each having it’s own hardware, input/output devices, CPU, storage, networking components etc.

In this article, we will primarily see :

  • what are virtual machines?
  • Working of a virtual machine.
  • Benefits of using them.
  • Popular Virtualization Software
  • Installation of VirtualBox
  • Creating Windows 10 and Linux Virtual Machines
  • Running Windows 10 and Linux VM’s on a Windows 11 platform.

Before going into the detail of Virtual Machines, lets see some primary terminologies.

Primary Terminologies:

What is a Computer System?

It is a Physical device typically consisting of hardware like CPU (for processing data), input devices, output devices, and software applications which allows users to perform their desired functionality and an operating system.

What is a hardware ?

Hardware comprises the physical parts of the machine like RAM, Hard disk, Keyboard, CPU etc..

What is an Operating System?

Operating System is a system software which acts like an Interface between hardware and User. Dealing directly with the hardware and managing the resources like storage, CPU etc.. can be tedious, So an Operating System abstracts all of these and allow us to efficiently work with the applications requiring hardware, and provide a lot of convenience.

oshardware

Operating System between Hardware and User

– Refer more here for learning about Operating System in detail, and difference between Operating System and Hardware .

What is a Host OS?

Host operating system is typically the first operating system that you install on the machine, it is installed on the physical machine and interacts directly with the underlying hardware.

What is a Guest OS?

Guest Operating System is the OS which is associated with the Virtual Machine, It might not interact with the hardware directly, Each Virtual Machine have it’s own OS known as Guest Operating system. It sits top on the Host Operating System. Host OS will generally works as an Intermediary between Guest OS and hardware.

Screenshot-(61)

Guest OS vs Host OS

What is a Hypervisor?

Hypervisor is a software component in Virtualization software which creates, runs and coordinate between the Host OS and Guest OS. It is also called as Virtual Machine Monitor(VMM). Refer more.

  • Type-1 Hypervisor: Type 1 hypervisor directly deals with the hardware without interacting with the host operating system.
  • Type-2 Hypervisor: Type-2 hypervisors interact with the host operating system which is directly installed on the machine and relies on Host OS for managing the resources. Here, It runs as any another program in a computer system and interacts with the Host OS and the virtual machines. It cannot interact with the hardware directly.
    Screenshot-(62)

    Type-1 Hypervisor vs Type-2 Hypervisor

Intuition to Why we need Virtual Machines?

Note : If you are comfortable with why virtualization concept has been introduced, you can Skip to the Benefits of virtual machines section

Consider two individuals Kiran and Navya who are developing some applications individually and want to test their application on multiple platforms or different versions of a specific OS etc.

Kiran’s system has Windows 11 installed and now he wants to test his application on Linux, Windows 7 and Windows 10. Whenever he wants to test, he will switch between OSes leading to unnecessary booting and switching time between OSes.

Where as Navya has the same Windows 11 machine and she has installed a Virtualization software by which she can create virtual machines and she has installed the Linux, Windows 7 and Windows 10 OS on the top of Virtualization software, where she can run multiple OS on the same Windows 11 machine and test those simultaneously without rebooting and switching between multiple OS.

Also, Both wants their applications to be deployed, fortunately they both used .NET for application logic and MySQL for database and wants to deploy application server on a Windows machine and Database Server on a Linux Machine. Moreover Users demand for resources like CPU , Database vary upon time (Like for sometime if need for processing or serving web pages is in demand, may be dealing with database might be low and vice-versa). Now for running those Linux and Windows machines, Kiran thought obviously he needs two physical servers as he though he cannot run multiple OS on a single physical server and bought them and then installed windows on one machine and Linux on the other.

Here, Both the machines are not utilizing the hardware efficiently most of the time. As Both machines might have a idle time and sometimes they might not require the full capacity of the machine like power of CPU, RAM, Storage it has etc..

So, unnecessarily More Cost for buying 2 physical servers, maintenance time when upgradation required, lesser efficiency in resource utilization of hardware.

But Navya bought a single physical server and installed virtualisation software and created Virtual Machines with Windows OS and Linux OS -one running application server and the other running the database server, Now the only single machine is providing the resources like hardware, CPU etc for both the virtual machines here, If any point of time, if any resource requires high utilization and other machine needs less resources, Hypervisor can automatically share the resources among VM’s what they require.

Here Navya have incurred Lower Expenditure Costs, Maintenance Costs as upgradation is very easily and almost no manual involvement, and Higher efficiency in Resource Utilization as the hardware is shared by two machines here.

– So let us look at the advantages of using virtual machines.

Benefits of Virtual Machines:

  • Resource Utilization: The hardware resources like CPU, Storage, Network components are utilized very efficiently when there are several machines using these resources.
  • Lower Expenditure costs: Utilizing the hardware resources properly for several machines will makes us to buy only fewer machines which will lower the expenditure costs.
  • Shorter Development and Testing times: We do not manually switch between different operating systems to test our applications.
  • Flexibility: Using Virtual Machines, we can dynamically allocate resources to a machine, and hence for scaling out or in, we have a great flexibility to do , unlike in physical servers, we have to manually place a new server and upgrade it.
  • Lower Maintenance Time: Upgrading or adding more no. of servers physically to the existing ones and enabling co-ordination between them will take much time and might result in server down time.
  • Energy Efficiency: Lesser the Physical servers, lower the power consumption, lower carbon foot print and hence energy efficient.
  • Space Savings: More the servers, we usually require more space to accommodate them in the data centres.
  • Cloud Computing: Cloud computing is the technology where IT resources like servers, networking components, Run time environments, storage, computing power are provided on demand over Internet by the third party and usually follows a pay-as-you-go principle. It helps us to get rid of manually owing a physical server and upgradation of servers (which might take lots of time and may result in high costs, inefficient space and energy resources). Rather everything can be provided by the cloud provider on demand ( in a very less time, almost instantly with a few clicks). This would be only possible if they are using virtualization (as they can upgrade easily, more flexibility in allocation of resources to us than the traditional way of owing a physical servers and manually upgrading it). Hence, Virtualization is one of the backbone of Cloud Computing technology.

    Check out here, for in-depth Cloud computing tutorial

Working of a Virtual Machine:

  • Virtual Machines are created by the user, by specifying the initial requirements like RAM, storage etc..
  • Hypervisor will allocate these resources to the virtual machines.
  • When a Machine is started, it runs as if is a separate computer system with each having it’s own CPU, RAM, storage, networking components etc. These Virtual Machines do not interact and they are isolated from each other.
  • Each processes or tasks running on different virtual machines interacts with the hypervisor and hypervisor interacts with the hardware allowing programs run simultaneously utilizing the hardware efficiently.
  • If there is a demand for more resources for a particular machine, hypervisor will dynamically allocate it.
  • We can save the state of a particular VM and then we can also transfer it to other systems (we are cloning the system very easily).
  • Stopping a particular VM will stop running a virtual machine and the progress, applications installed, tasks done are preserved if we close a Virtual Machine after saving it’s state.

Popular Virtualization Software:

– List of Available Virtualization Software

Steps for Creating and Running Virtual Machines:

– We will try to Install a Linux based PepperMint OS, Windows 10 OS using VirtualBox on a Windows 11 OS machine and run those virtual machines.

  • Here, we will install the VirtualBox software.
    For detailed installation steps on how to Installation of VirtualBox, Refer here.
  • Downloading the Required OS.

    Download PepperMint OS – ISO file from the official site and Windows 10 setup file from the official site.

    Installing PepperMint OS.
    Installing Windows 10 OS.

  • After Installing ISO files, Open VirtualBox Manager.
    Screenshot-(38)

    VirtualBox Manager

  • Toggle on Machine navbar and click on New for creating a new virtual machine.
    Screenshot-(39)

    Creating a New Virtual Machine

  • Set the Name of the machine, select the location of ISO file.
    Screenshot-(47)

    Selecting OS ISO file and naming the Virtual Machine

  • Choose how much storage and the no. of CPU cores you want to allocate to your Virtual Machine.
    Screenshot-(48)

    Allocating Cores and Memory for Virtual Machine

  • Click on Next and finish the Installation. Then, we will have a New virtual Machine inside virtual box as shown in the below image.
    dsd

    Finish the Installation of Virtual Machine


    Screenshot-(51)

    Linux PepperMint Virtual Machine on Windows Machine

  • Similarly, create a new Virtual Machine using VirtualBox for Windows 10 OS and you will see similar to the below image.
    Powering Up the Virtual Machine
  • Select the Virtual Machines and click on Start to run the Virtual Machines.
  • Finally, we ended up creating two Virtual Machines( Windows 10, Linux PepperMint ) which can run simultaneously and share the resources on a single physical machine( Windows 11) as shown in the below GIF.

    Windows 10 OS based Virtual Machine and Linux Peppermint OS based Virtual Machine on Windows 11 based Physical Machine.

    Windows 10 OS based Virtual Machine and Linux Peppermint OS based Virtual Machine on Windows 11 based Physical Machine.

  • Here, We are running both Virtual Machines with different OSes and they are sharing the same underlying physical hardware. In this case, Windows 10 and Linux PepperMint are Guest OSes and Windows 11 is the Host Operating System. And Oracle Virtual Box is a type-2 hypervisor based virtualization software and it relies on Host OS for managing the resources and co-ordination between Virtual Machines.

F.A.Q’s

Q.1 Even without having VM’s, If we have a server which requires only lesser resources (let’s say 100GB hard disk, 32 GB RAM, 8 cores of CPU) and other servers which require higher amount of resources,((let’s say 300GB hard disk, 16 GB RAM, 6 cores of CPU) we can buy those servers only according to the requirement and then utilize the hardware efficiently without wasting the resources, then why only VM’s?

Answer:

While it is true that even without VM’s, you can buy servers with only according to specific requirement of yours, but in most of the cases, your requirement for the resources do not remain the same, and sometimes you might need additional amount of resources and sometimes lesser, so scaling our resources when we have physical servers is costly as we have to buy new servers again, but if we have VM’s, we can scale as per our requirement and share the hardware among multiple machines effectively.

Q.2 Using which Hypervisor is more efficient?

Answer:

Generally, Using Virtualization software with Type-1 Hypervisor are more efficient as is deals directly with the hardware, but not with the host operating system.

Q.3 Does Virtualization means adding the more storage or IT resources when we exhaust the actual resources of the existing system?

Answer:

No, Virtualization do not add any resources, It simply enables to virtualize the hardware and use it efficiently by running as many VM’s as we want.

Q.4 Does Hypervisor automatically modifies the requirement specifications of virtual machines present when they require more resources or do we need to manually?

Answer:

Hypervisors can dynamically allocate the resources to virtual machines, although IT administrators can define policies on up to what limit those automations are allowed.



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads