The introduction of Software containers is widely regarded as a revolution in server administration. The idea of isolating applications in virtual runtime environments is nothing new, but with platforms like Docker, users can enjoy extensive functionality, which facilitates working with server containers. So, what exactly can application containers do?
The virtual machine (VM) is a classic concept inhardware virtualization and is usually used to provide virtual environments to cater for software needs. Numerous software solutions enable the operation of several guest systems on a common host system. But how do virtual machines work, and what advantages and disadvantages are associated with this virtualization concept? We’ll introduce you to the basics of hypervisor-based hardware virtualization and show you step by step how to deploy virtual environments for Windows or Linux.
- What is a virtual machine?
- Virtual machines in practical use
- An overview of the advantages and disadvantages of virtual machines
- Tutorial: how do you create a virtual machine?
- Step 1: selecting hypervisor software
- Step 2: installing Oracle VM VirtualBox
- Step 3: download operating system image
- Step 4: create a new virtual machine
- Step 5: select the operating system and name VM
- Step 6: allocate hardware resources – memory
- Step 7: allocate hardware resources – disk space
- Step 8: install guest system
What is a virtual machine?
A VM is a virtual machine with its own operating system that uses the hardware resources of an underlying host system. Guest systems like this behave like a stand-alone PC with RAM, hard disk space, and a file system.
Every virtual machine is based on hypervisor software (also known as a virtual machine monitor VMM). The hypervisor runs as an application on the host operating system (hosted hypervisor) or rests directly on the hardware of the physical machine (bare-metal hypervisor) and manages the hardware resources provided by the host system. The hypervisor software creates an abstraction layer between physical hardware and virtual machines. Each VM runs isolated from the host system and other guest systems on its own virtual environment. This is referred to as encapsulation. Processes within a virtual machine do not affect the host or other VMs on the same hardware.
Numerous hypervisors combine hardware virtualization technologies with emulation functions. Appropriate virtualization products not only create an abstraction layer between the physical hardware on which they are deployed and the virtual layer used: they also bridge incompatibilities between different system architectures. This allows users to emulate runtime environments for different operating systems on a host system. Users can then also run guest systems in virtual machines whose system architecture does not correspond to that of the host system.
The following screenshot shows the operating systems Windows 7 and Ubuntu 17.10 as virtualized guest systems on the same host system. Each virtual machine runs in a separate window. Oracle VM VirtualBox is used as virtualization software.
Virtual machines in practical use
In hardware virtualization, physical system resources can be distributed across multiple virtual systems. Each guest system (including all programs running in it) is separated from the underlying hardware.
In practice, virtual machines are mostly used to isolate certain processes and applications for security reasons. Compared to other virtualization concepts, VMs offer a strong encapsulation, functioning as a basis for hosting products in which several customer servers are operated on a common hardware platform. The provision of virtual machines is the basis of shared hosting and VPS (virtual private server) setups. Since each guest system runs in an isolated runtime environment, processes encapsulated in a VM do not affect the host system or other systems on the same physical machine.
In a business context, virtual machines are used to reduce costs for operating and maintaining IT infrastructures. Companies often run an extensive IT infrastructure that is idle most of the day. Virtual machines can significantly reduce this wastage. Instead of providing each application area of a business IT department with its own physical machine, more and more companies are moving to running mail, database, file, or application servers in isolated virtual environments on the same powerful hardware platform. This concept is implemented in the context of server consolidation, as it is usually cheaper to maintain a large computing platform for different virtual systems than to operate several small computers. Processors, in particular, are still expensive to buy. In other words: unused processor time is an unnecessary cost factor that can be avoided by switching to virtual systems.
Another field of application for virtual environments is software development. Programmers who develop applications for different system architectures often use virtual machines for software testing. Numerous hypervisor products allow the parallel operation of different operating systems or system versions. Virtual machines can be created, cloned, and removed from the physical hard disk space at the touch of a button without leaving any data behind. In addition, faulty processes within a virtual machine have no effect on the underlying system due to encapsulation.
Home users typically use hypervisors with emulation capabilities to run applications originally written for a different system architecture. However, it should be noted that hardware virtualization, as well as emulation, always goes hand in hand with performance losses. For example, if a user wants to run a Linux program in a VM on their Windows machine, additional resources must be spent on both the hypervisor and the guest system. An encapsulated Linux application like this no longer has the same performance of the underlying hardware at its disposal. This is referred to as an overhead.
In information technology, IT resources like computing time, memory, or bandwidth, which are used or lost during the execution of a process without directly contributing to the result of the process, are referred to as overhead.
Hardware virtualization is reaching its limits, especially for resource-intensive workloads. If multiple virtual machines are running on the same host system, the resource requirements of one machine during performance peaks can also affect the performance of the other machines on the same host. This can be counteracted by guaranteeing each virtual machine a fixed contingent of hardware resources. Make sure that the total of all virtual resources used simultaneously never exceeds the maximum available power of the physical machine.
An overview of the advantages and disadvantages of virtual machines
The following table compares the main advantages and disadvantages of virtual machines. To what extent these benefits and limitations matter depends primarily on the framework within which you want to deploy VMs and the purpose of virtualization.
|Operating several guest systems in parallel: Hypervisor-based virtualization enables the parallel operation of several operating systems on the same hardware basis. Many hypervisors offer emulation functions with which incompatibilities between different system architectures can be bridged.||Hypervisor (and guest system) overhead: Virtual machines are less efficient than physical machines because some of the available resources are used to operate the hypervisor software.|
|Improves hardware utilization by consolidating hardware: By running multiple virtual machines on a physical machine, hardware resources can be better utilized. This kind of consolidation increases how much the provided hardware can be utilized, reduces idle time, and saves costs.||When it comes to shared hardware: power peaks often lead to bottlenecks: Since all virtual machines on a host system share the same hardware resources, performance peaks can lead to bottlenecks.|
|Strong encapsulation of guest system and all processes running within it: Each guest system runs isolated in a virtual runtime environment. If a virtual machine crashes due to a faulty process, or is infiltrated by hackers or malware, this usually has no effect on VMs running in parallel or the underlying host system.||Hypervisor as a single point of failure: If attacks by hackers or malware are directed against virtualization software, all guest systems managed by the hypervisor may be affected.|
|IT resource maintenance and administration savings: Virtual machines offer great savings potential in the provision of IT resources. Switching to a powerful hardware platform for various virtual systems reduces maintenance and administration costs, since the corresponding tasks can be centralized.||Unclear legal situation regarding the licensing of virtual operating systems: Virtual machine operation raises new questions about operating system licensing.|
|Flexible deployment and porting of virtual servers and PCs: Virtual machines are independent of the underlying physical hardware and allow flexible deployment of IT resources. Virtualized servers or personal computers (PCs) can be easily created, cloned and moved to another hosting platform.|
Tutorial: how do you create a virtual machine?
The following step-by-step instructions will show you how to create a virtual machine on a Windows host and run it as a guest system in this Ubuntu Linux. For the tutorial we use Windows 7 and Oracle VM VirtualBox as hypervisor software.
To follow the instructions on your own system, all you need is a Windows PC with internet access. The software used in the tutorial can be downloaded free of charge from the internet.
Step 1: selecting hypervisor software
Various software solutions are available to create a virtual operating system. Market leaders are products from Oracle, VMware, and Parallels.
The following table shows the most popular hypervisor products for Windows, Linux, and macOS as well as possible guest systems.
Oracle VM VirtualBox
| || |
VMware Workstation Player
| || |
| || |
Parallels Desktop for Mac
| || |
For the following tutorial we used the hypervisor VM VirtualBox from Oracle. The software is available free of charge to users under the GNU General Public License (GNU GPLv2). We recommend downloading from the vendor’s website. To do this, proceed as follows:
- Access http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html
- Select the current download package for your operating system (in our example, Windows)
- Save the .exe file with the binary data in any directory on your computer
Oracle also provides the Oracle VM VirtualBox Extension Pack, a proprietary extension module for open source virtualization software, free of charge. However, you do not need the extension pack for this tutorial.
Step 2: installing Oracle VM VirtualBox
Once the download is complete, double-click the .exe file to execute the binary data package. Follow the instructions of the install wizard to install Oracle VM VirtualBox locally on your system.
At the end of the installation process, the software starts the Oracle VM VirtualBox Manager. This is where you create and manage your virtual machines.
Step 3: download operating system image
To run a guest system in a virtual machine, you need an operating system image. This is a memory image that can be interpreted by the hypervisor software as a system hard disk. This can be in the open file format .iso. Common virtualization solutions also use proprietary container formats for image files such as .vdmk (VMware), .vhd (Xen and Microsoft Hyper-V) and .vdi (Oracle VM VirtualBox).
For this tutorial, we are using the open source operating system Ubuntu 17.10.1, which can be downloaded as an .ido file from the official Ubuntu project website. To do this, proceed as follows:
- Access https://www.ubuntu.com/download/desktop
- Select the current version of the operating system and click on “Download”
- Save the .iso file locally on your system
Step 4: create a new virtual machine
Use the “New” button to add a new virtual machine to the Oracle VM VirtualBox Manager.
Step 5: select the operating system and name VM
Name the new virtual machine and select which operating system you want to run in the VM.
Confirm your selection by clicking on “Next.”
Step 6: allocate hardware resources – memory
Allocate a portion of the memory provided by the host system to the new virtual machine.
Confirm your selection by clicking on “Next.”
Step 7: allocate hardware resources – disk space
In the next step, decide whether you want to create a new virtual disk or assign an existing virtual desk to the virtual machine.
In this tutorial, we will create a new virtual hard disk on which to reinstall the guest system from scratch.
Select the option “Create a virtual hard disk now” and confirm your selection by clicking on “Create.”
Miscellaneous vendors provide users with fully configured virtual machines as memory maps. If you would like to take advantage an offer like this, download the virtual machine in one of the supported container formats and select it through the “Use an existing virtual hard disk file” option. Oracle VM VirtualBox supports the proprietary file format VirtualBox disk image (.vdi) and memory images in virtual hard disk (.vhd) and virtual machine disk (.vmdk) formats.
In the next step, select the container format that VirtualBox should use for the new virtual hard disk. Unless you plan to run the newly created VM using another virtualization solution, we recommend the default VDI format.
Confirm your selection with “Next.”
The next step is to decide whether you want to allocate a fixed amount of available disk space to the virtual machine. Alternatively, you can dynamically allocate space on the physical disk. In this case, no fixed contingent is assigned to the VM; instead, the memory resources used on the physical hard disk automatically adjust to the VM memory requirements.
A dynamically allocated amount of disk space grows as the virtual machine’s memory requirements increase. However, you should note: the amount of disk space used does not decrease automatically when you free space within the VM by deleting files.
For this tutorial, we choose a fixed storage contingent.
We define the storage target and the size of the virtual hard disk in the next step.
Click “Create” to complete the configuration process and instruct VM VirtualBox to create the new VM.
The newly created VM appears with your chosen name in the list of available virtual machines.
VM VirtualBox creates a file folder for each virtual machine. This is automatically created in the storage designation you selected and contains the VDI file for the virtual hard disk, a log file, and a definition of the VM.
Step 8: install guest system
Start the newly created virtual machine by selecting it with the mouse and clicking the “Start” button in the ribbon.
Immediately after startup, the program asks which image file should be used to run the virtual machine.
Select the operating system image you downloaded in step 3. Confirm your selection by clicking on “Start.”
We select the .iso file with the Ubuntu 17.10.1 memory image.
Since .iso files contain the image of a complete operating system, they are usually very large files. In our case, the operating system image for Ubuntu 17.10.1 is 1.4 gigabytes.
Once you have selected the desired image, VM VirtualBox boots the operating system stored in the file in an isolated virtual environment. Each virtual machine runs in a separate window. Since we decided to reinstall Ubuntu from scratch, the virtual machine window shows the operating system boot screen.
Click on “Install Ubuntu” and let the installation wizard guide you through installing the guest system.
Once the installation process is complete, the operating system can be used just like any other system installed on physical hardware.
Set up additional virtual machines as needed.
All changes that you make in your VM are automatically written to the VDI file that you created as a virtual hard disk during configuration. If you want to run the guest system on another computer, simply copy the file folder on your virtual machine (including VDI file, log file, and definition) to the corresponding device. Note that each machine that you want to run your VM on must have compatible virtualization software.
An alternative to providing guest systems in virtual machines is container-technology. We’ll explain to you how applications can be virtualized using containers at the operating system level and what kind of advantages this type of virtualization brings in our beginner tutorial for the docker container platform.