loading...

CentOS 7 – Virtualization

How to Install Docker on macOS

These days, computer infrastructures have changed in many ways. We no longer see a room full of servers, each responsible for providing several services depending on how powerful they are. In these times, we only see a few big servers composed of several units so as to reinforce their capacities. This type of server hosts several virtual servers that serve the same old purposes as per the infrastructure requirements.

In our days, being a system administrator for bare-metal machines is just not enough. Virtual machines are on the rise; we should admit this. Big companies are no longer using old architectures; it is no longer a good option. A lot of money and huge management effort is required to sustain them.

In this chapter, we are going to explain virtualization as a concept, where we will see how to set up several virtualization technologies, and then give an example of how to create some virtual machines for each one of those technologies. Finally, we will explain, in brief, what Docker is and how to add an image and access the Docker container.

Through this chapter, you are going to learn the following topics:

  • Basics of virtualization
  • Concept of full virtualization
  • Concept of paravirtualization
  • Understanding Xen and how to use it
  • Using KVM to set up some Linux virtual machines
  • Creating a virtual machine using OpenVZ
  • Setting up and configuring virtual machines on VirtualBox
  • Understanding Docker and how to create a container and access it
  • Establishing services’ high availability using HAProxy

The basics of virtualization on Linux

Virtualization is the capacity to create a machine-like program that simulates, the physical behavior of a real machine running through virtual hardware including CPU, RAM, Hard disk, Network card, and so on, where those resources are all being taken from the physical machine running the virtual one.

Earlier, the way of managing services was to deploy a new server or upgrade the old one to meet the requirements of the new services to perform long and complex migrations in the event of a hardware failure. All the time, there would be too little RAM, too few disks, or low processing power. Managers got tired of trying to fix the existent system while paying a lot of money to help maintain an old server that was no longer supported. However, they did not have too many options, since the services running on those machines were very important and essential. Companies were deploying servers that would not work on their peak capacity, and there was no better way of controlling every server’s capacity for the right services with the right hardware equipment. All of these reasons made the newborn solution of virtualization grow so fast. Just after a while from its first deployment, virtualization has been integrated in many fields, specially in the field of computer science. Virtualization allows an abstraction of the physical hardware, to run multiple virtual machines on a single shared resource (CPU, Memory, Networking, and Storage):

Source: http://cdn.arstechnica.net

Now, this new technology is booming. We are witnessing a new virtualization service being born each day. Virtualization has been divided into many types:

  • We have network virtualization, which is related to virtual network creation and management to separate groups of machines from each other. They are connected to the same switch and group of switches.
  • We also have application virtualization, wherein we put an application or an ensemble of applications inside a container, and then we make the application believe that it is running on its original supported system. So, it believes that it can access the resource that it needs.
  • Finally, we have full machine virtualization. This is a kind of virtualization that creates a full virtual machine (desktop, server) with its virtual hardware and the dedicated services on demand. This virtualization involves abstraction of the server-based workload (the work load demanded by the virtual machine user) from the underlying hardware. The virtual machine won’t notice if it is running on a physical or a virtual hardware as long as the hardware answering its service’s demands for resources (store data, network access to other machines, and so on).

In this chapter, we will focus on both application virtualization and desktop virtualization.

A piece of software called hypervisor is executed on the physical machine to help with the virtualization of the data center, with a goal of a platform for the virtual machines. The hypervisor’s main job is to organize dynamically the physical resources between the different virtual machines running under its control. This gives them the capacity to run independently of the physical machine where a system administrator can relocate a virtual machine from a host to another without affecting it. A hypervisor, also called a virtual machine manager, is a program that allows multiple operating systems to share a single hardware host.

While using a virtual machine or a container, we are expecting to provide the applications or services with an operating system that can host them and simplify their communication to the hardware. Since those machines are not really running on the physical hardware, virtualization allows them to access dynamically and flexibly the CPU, memory, storage, and networking resources as necessary.

Virtualization can increase flexibility and management and offers a better scalability with an enormous saving in costs. The service’s workload gets deployed faster, with a visible increase in performance-on-demand availability, while getting the scalability function automated, to simplify the infrastructure management for the IT support guys.

Let’s enumerate some of the major advantages of having a virtualization solution installed on a server infrastructure:

  • Reduction in the number of hardware and operating costs
  • Delivery of high availability of applications and services
  • Minimization or elimination of downtime (with best practice methods)
  • Increase in the IT team’s productivity, efficiency, agility, and responsiveness
  • Increase in speed and simplification of application and resource provisioning
  • Support for business continuity and disaster recovery as an increase in the system’s security
  • Enabling centralized management
  • Building a true software-defined data center
  • Exploiting the full advantages of multicore processor machines

The following figure shows an example of three Linux virtual machines running on one Linux server. These machines are controlled and managed by a type of hypervisor depending on the virtualization chosen:

A virtual machine really is just some files in some format stored at a specific location on the host machine. For some technologies, it can also be an LVM logical volume or a direct device. The virtual disk used by a virtual machine is just another file encapsulated within it. Inside a virtual machine, managing the OS and applications can be simplified (in some ways; it is complicated in others).

But the good thing is that having the virtual machine as just a folder full of files that can be copied and moved makes it easier to backup in the event of a hardware failure on the physical machine. In such cases, the manager should simply buy a new server, load the backed-up virtual machines on it, and run the entire environment again as if nothing ever happened.

Using the CentOS repository, we have a choice between two virtualization technologies: Xen and KVM. To understand these virtualization technologies, you need to understand the two different approaches to virtualization: full virtualization and paravirtualization.

Note

A combination of paravirtualization and full virtualization has been created, called hybrid virtualization. In it, some parts of the guest operating system use paravirtualization for certain hardware drivers, and the host uses full virtualization for other features. This often produces superior performance on the guest without the need for the guest to be completely paravirtualized.

Comments are closed.

loading...