Linux平台虚拟化技术
主机支持:KVM 是一种内置于 Linux 内核中的虚拟机管理程序,因此只能在运行 Linux 的系统上使用。另一方面,VirtualBox是一个跨平台的应用程序,可以在各种主机操作系统上使用,包括Linux,Windows和MacOS。允许虚拟机直接访问底层硬件资源。每个VM都被实现为一个Linux进程,由Linux调度器调度,使用专用的虚拟硬件,如CPU、图形适配器、网卡、内存和磁盘。性能:K
文章目录
The Linux community has created several virtualization tools or Virt tools like QEMU, KVM, Libvert, or libguestfs which act as the basis for creating open-source virtualization software. The article will highlight several open-source virtualization software like Oracle VM VirtualBox, Linux-KVM, Redhat virtualization, Microsoft Hyper-V, Xen Project, oVirt, and boxes in Fedora.
KVM和virtualbox的区别
KVM(基于内核的虚拟机)和VirtualBox都是软件应用程序,允许您在单个物理主机上运行多个操作系统(OS)。但是,它们在几个关键方面有所不同:
主机支持:KVM 是一种内置于 Linux 内核中的虚拟机管理程序,因此只能在运行 Linux 的系统上使用。另一方面,VirtualBox是一个跨平台的应用程序,可以在各种主机操作系统上使用,包括Linux,Windows和MacOS。
性能:KVM通常被认为比VirtualBox更有效率,性能更好,特别是在运行资源密集型工作负载时。这是因为KVM可以直接访问主机硬件,而VirtualBox作为用户级应用程序运行,并依靠主机操作系统来提供硬件访问。
特点: VirtualBox 具有功能更丰富的用户界面,并提供更广泛的配置选项,使其更易于某些用户使用。另一方面,KVM 是一种更简陋的解决方案,旨在轻量级和高效,而不是功能丰富。
用例:KVM 通常用于性能和稳定性至关重要的企业和生产环境。VirtualBox更常被个人用于个人或开发目的,因为它在主机和来宾操作系统支持方面更易于使用且更灵活。
大米叔叔:
kvm和virtualbox的区别
KVM(Kernel-based Virtual Machine)是一种虚拟化技术,可以在Linux内核中运行虚拟机。 KVM使用硬件虚拟化技术(如Intel VT-x或AMD-V)来提高性能,并且可以使用现有的Linux系统管理工具(如libvirt)来管理虚拟机。
VirtualBox是一款虚拟机软件,可以在Windows、MacOS和Linux操作系统上运行虚拟机。 VirtualBox支持使用多种操作系统,并提供了丰富的虚拟硬件设置选项。
主要区别:
- KVM是一种虚拟化技术,而VirtualBox是一款虚拟机软件。
- KVM只能在Linux操作系统上使用,而VirtualBox可以在多种操作系统上使用。
- KVM使用硬件虚拟化技术,而VirtualBox使用软件虚拟化技术。
- KVM可以使用现有的Linux系统管理工具来管理虚拟机,而VirtualBox提供了自己的管理工具。
在选择虚拟化解决方案时,应根据您的具体需求来决定使用哪种解决方案。如果您需要在Linux操作系统上运行虚拟机,则可能更倾向于使用KVM。如果您需要在多种操作系统上运行虚拟机,则可能更倾向于使用VirtualBox。
The concept of virtualization
Virtualization creates an abstraction layer over the physical hardware to create a virtual computing system, known as virtual machines (VMs). It allows a user or a business to run multiple virtual computers and operating systems on a single physical server. In essence, the main advantage of virtualization is that it’s a more efficient use of physical computer hardware.
Virtual machine
A virtual machine (VM) is a virtual representation of a physical computer. You can create multiple virtual machines, each with an operating system and applications on a single physical device. A virtual machine can’t interact directly with a physical computer. However, you can use a hypervisor (a lightweight software layer) to manage the physical hardware.
Hypervisor
The hypervisor is a thin software layer that allows multiple operating systems to share physical computing resources and run alongside each other. The hypervisor assigns each VM a portion of the underlying computing resources like memory and storage, thus preventing them from interfering.
Top opensource virtualization software for Linux
1. Oracle VirtualBox
VirtualBox was founded in 2007 by Oracle Corporation. VirtualBox is a powerful, robust, open-source, cross-platform virtualization software that supports x86 and AMD64/Intel64 architectures. You can run VirtualBox without hardware virtualization. Hence it efficiently runs on any system or architecture with no Intel VT-X or AMD-V technology present. You can use it to provision virtualization environments for personal use, small embedded desktop system, data center deployments, or cloud computing platforms or environments.
VirtualBox can run several OSs including a majority of Windows operating systems (NT 4.0, 2000, XP, Vista, Server 2003, Windows 7, 8, 10), Linux 2.4, 2.6, 3.x, and 4.x, DOS/Windows 3.x, OpenBSD, Solaris, OpenSolaris, and OS/2.
Top features
- It is cross-platform with support for different host platforms like Mac, Windows, Solaris, and Linux.
- Supports drag & drop functionality.
- Supports seamless mode, shared folders, and clipboards.
- It supports four operating systems as a host.
- SMP, teleportation support.
- It supports live VMs transportation, migration, and switching between multiple physical hosts and the cloud.
所以说K8s和虚拟机不是竞争关系而是合作关系。虚拟机可以让K8s方便迁移,K8s则让虚拟机的作用更大。这应该是虚拟机对K8s最重要的一点了。 - Allows execution without hardware virtualization that eliminates the requirement of Intel VT-X or AMD-V technologies.
不需要硬件虚拟化是一个关键点。之前在windows 虚拟机上准备使用VMware的station搭建虚拟机,竟然是因为硬件不支持虚拟化。如果使用virtualbox应该是不会有这个问题的。VMware和virtualbox区别参考链接
- It supports public API (Python, XPCOM, SOAP, Java) to control VM configuration and execution.
VirtualBox is under constant development from its community with frequent releases, bug fixes, and new features. The project is community-based, while Oracle ensures it meets its enterprise-level quality. 社区相当活跃
Installing VirtualBox
# Ubuntu
sudo apt-get update
sudo apt-get install virtualbox
#Install VirtualBox Extension Pack
sudo apt-get install virtualbox—ext–pack
Fedora 34
#Install development tools & dependencies
sudo dnf -y install @development-tools
sudo dnf -y install kernel-headers kernel-devel dkms elfutils-libelf-devel qt5-qtx11extras
#Add VirtualBox RPM repository
cat <<EOF | sudo tee /etc/yum.repos.d/virtualbox.repo
[virtualbox]
name=Fedora $releasever - $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/fedora/34/$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
EOF
#Import VirtualBox GPG key
$ sudo dnf search virtualbox
#Install VirtualBox 6
$ sudo dnf install VirtualBox-6.1
#Add user to vboxusers group
$ sudo usermod -a -G vboxusers $USER
$ newgrp vboxusers
2. Linux KVM
Kernel-based Virtual Machine (KVM) is a virtualization tool built into the Linux operating system and is dedicated to x86 computers( 我们的BC 远程桌面好像就是KVM). It is an open-source virtualization software developed by the Linux Kernel Community. KVM was announced in 2006 and merged into the Linux kernel since Linux 2.6.20. 搞不懂一个开源软件为何要掏钱去买呢?
KVM transforms the Linux kernel into a hypervisor by utilizing its loadable kernel called KVM.ko that allows the Virtual Machines to gain direct access to the underlying hardware resources. Each VM is implemented as a Linux process, scheduled by the Linux scheduler, with dedicated virtual hardware like CPU(s), graphics adapter, network card, memory, and disks.
KVM通过利用名为KVM的可加载内核将Linux内核转换为管理程序。允许虚拟机直接访问底层硬件资源。每个VM都被实现为一个Linux进程,由Linux调度器调度,使用专用的虚拟硬件,如CPU、图形适配器、网卡、内存和磁盘。
Top features
- It features SELinux and (sVirt) secure virtualization, enabling enhanced VM security isolation that allows mandatory Access Control (MAC) security for guest VMs.
- It supports the use of any storage supported by Linux, such as local disks and network-attached storage (NAS).
- Supports hotplug vCPUs.
- It features non-uniform memory access balancing and kernel same-page merging for effective memory management.
- It supports teleportation and dynamic memory management.
- It supports live migration that allows you to move a running VM between physical hosts without interruption.
- Supports limiting disk I/O requests from virtual to host machines.
- It allows execution of several VMs for unmodified Linux or Windows images after installation, where every VM has a virtualized hardware, network card, graphics adapter, and disk.
- KVM offers decent integration with the OS.
- A VM in KVM is a Linux process that the kernel manages and schedules through control groups, scheduler, real-time extensions, and network namespaces.
- Real-time extensions allow VM-based applications to run at lower latency with higher prioritization as compared to bare metal.
KVM is part of the Linux community and provides consistent new features, bug fixes for its Linux users. KVM is versatile enough to manually manage a handful of VMs on a single workstation without a management tool. However, large deployments might require a tool like Red Hat Virtualization to simplify and streamline resource allocation, operations and enhance data analysis.
Installing KVM in Ubuntu
#Install the minimal setup of QEMU & KVM
$ apt-get install qemu-system libvirt-clients libvirt-daemon-system
#Install QEMU & KVM on a server without extra graphical packages
$ apt-get install --no-install-recommends qemu-system libvirt-clients libvirt-daemon-system
#Add your user to the libvirt group
$ adduser <youruser> libvirt
3. Microsoft Hyper-V
Microsoft Hyper-V is an advanced virtualization tool that has been under development since 2008. It is cross-platform virtualization software that supports both Microsoft and Linux systems. Initially, Microsoft Hyper-V was not released as an open-source project and did not support Linux until 2019, when Microsoft launched open-source Linux drivers for Hyper-V.
Hyper-V lets you run each virtual machine (VM) in its own space, which prevents a crash from affecting other workloads and also manages service access among different people and systems. The hypervisor consists of various components such as the Windows hypervisor, Hyper-V Virtual Machine Management Service, virtualization service provider (VSP), virtualization Windows Management Instrumentation (WMI) provider, virtual infrastructure driver (VID), and virtual machine bus (Vmbus) to effectively manage interactions between the hardware and the VMs.
Top features
It supports shielded Virtual Machines improvements like Linux compatibility and Virtual Machine Encrypted Networks.
It features nested virtualization and cluster rolling, Dynamic Virtual Machine Multi-Queue.
It supports vSwitch Receive Segment Coalescing, persistent memory support, and Enhanced sessions.
It supports live migration that allows you to move running VMs to other hosts.
It supports storage migration, import, and export to make it easier to distribute your VM.
It features enhanced host CPU resource utilization monitoring.
It features enhanced security components such as secure boot, BitLocker Encryption, Virtual Trusted Platform Module (vTPM) to store keys safely, and Host Guardian Service to validate hosts and prevent unauthorized access.
To effectively manage virtual machines running Linux distributions, you’ll need to install and activate Hyper-V Linux Integration Services manually. Hyper-V LIS consists of two types of components: drivers and services. The drivers will enhance the performance of Linux virtual machines while services are designed to perform a specific job. Linux Integration services will allow you to use features such as live migration, VLAN Tagging and Trunking, Symmetric multiprocessing (SMP), Static IP Injection. You will also enjoy Live Virtual Machine Backup and the ability to perform hot removal/adding of memory using Dynamic Memory.
Microsoft supports the following Linux distributions running as a VM: Red Hat Enterprise Linux 5.2-5.11, 6.0-6.10, 7.0-7.6 64-bit, CentOS 5.2-5.11, 6.0-6.10, 7.0-7.6 64-bit, and Oracle Linux 6.4-6.10, 7.0-7.6. The Hyper-V project is under constant development, and Microsoft is adding more features to improve overall efficiency, performance, and reliability. You can also use Hyper-V with management tools such as Hyper-V Manager, Failover Cluster Manager, System Center Virtual Machine Manager (SCVMM), and System Center Operations Manager (SCOM). Moreover, you can use Powershell to give you greater control and are easier to use.
4. Xen Project
性能最佳
The Xen Project is open-source virtualization software for Linux. It was founded by the Linux Foundation in 2003 and also got support from Intel. Xen is powered by the Xen hypervisor adapted for modified and unmodified guests on Linux and Windows platforms. It is a bare-metal hypervisor using a microkernel design to provide services that allow multiple OS to execute on single computer hardware concurrently.
The Xen hypervisor has been around for some time and is one of the best performing virtualization software in the Linux community. It has been used as the basis for many open source and commercial applications like server virtualization, desktop virtualization, Infrastructure as a Service (IaaS), security apps, embedded and hardware appliances, and automotive projects.
Top features
Its customizable and flexible architecture supports various cloud platforms and guest operating systems.
It supports virtualization of x86 IA64, ARM architectures.
It features enhanced workload balancing that captures CPU, memory, disk I/O, and network I/O data to optimize performance.
It features real-time performance monitoring for enhanced performance in Linux and Windows.
It supports Citrix Storage Link- a unique storage integration feature.
It has enhanced security features such as Linux kernel config/build system and virtual machine introspection.
It supports multicore processor support, centralized multiserver management.
It supports live migration, (V2V) virtual-to-virtual conversion, and (P2V) physical-server-to-virtual-machine conversion tools.
The Xen project is the default standard in Linux hypervisors and ensures a secure, efficient, and reliable virtualization platform. It enables and supports some of the largest cloud enterprises like Amazon Web Services, Verizon Cloud, Public Cloud, Rackspace, and many more. The Xen Hypervisor is ideal for users or organizations to increase server utilization, reduce the complexity of managing server farms, and decrease initial infrastructure costs. However, one caveat is that Xen relies on third-party solutions for hardware drivers, backup and recovery, fault tolerance, and storage.
5. oVirt
The oVirt (Open Virtual Datacenter) project is a free, open-source virtualization management platform founded by Red Hat as a community project. The project is designed for the Linux OS and is the best option for supporting Linux distros. It features an easy-to-use, user-friendly web interface to enable centralized management of VMs, storage, compute, and networking resources. Its main components include oVirt-engine, oVirt-engine-GUI, SDK, CLI, VDSM, oVirt-DWH, and oVirt-guest-agent.
Top features
It supports KVM on x86-64 and PowerPC64 architectures.
It features advanced network management enabled via IP addresses to configure interfaces, gateways, and subnet masks.
The oVirt engine provides a centralized enterprise-grade virtualization management engine with programming interfaces and a graphical administration console.
It features high availability and teleportation that includes live migration, live snapshots capability, and cloning VMs from snapshots.
Its advanced disaster recovery capabilities enable you to restore your system in instances of system failure.
Its self-hosted engine and GlusterFS storage domains allow seamless expansion of resources that simplifies and optimizes deployment.
It features enhanced network performance for desktop virtualization to manage higher latency, lower bandwidth WAN environments.
It supports other storage backends such as NFS, FC, SCSI, and POSIX-compliant FS.
oVirt supports (rsyslog) remote logging and (remote kdump) remote crash analysis.
It features enhanced security features through SELinux and sVirt.
The project is under constant development with the promise of developing support for the ARM architecture. The project also provides the oVirt Node that is a dedicated lightweight OS based on CentOS. oVirt Node is designed as a hypervisor that provides an advanced management interface for API support.
6. Red Hat Virtualization (RHV)
性能彪悍
Redhat Virtualization is a VM with enhanced KVM (Kernel Virtual Machine) and advanced features suitable for Enterprise Server. It does not require a host OS to start and can be deployed on a bare-metal environment to create many individual VMs as per your requirements.
Top features
- It features advanced management tools to manage hundreds of VMS.
- It scales very well, and host scalability supports up to 288 logical CPUs and 12TB per host, whereas guest scalability supports up to 6TB vRAM and 240 vCPU per VM guest.
- Red Hat Virtualization Manager (RHVM) provides centralized management of physical and logical resources in the virtualized environment.
- It integrates seamlessly with other Linux and open source projects.
- RHV has enhanced security features such as Red Hat Secure Virtualization (sVirt) and other SELinux that provide isolation.
- It features KSM memory overcommitment that allows you to define more RAM in the virtual machines than is available on a physical host.
- It supports Red Hat Enterprise Linux Atomic Host as a guest OS that enables containers to run on Atomic Host VMs.
- RHV is compatible with cloud software stacks such as Red Hat Cloud Infrastructure, Red Hat CloudForms for multi-cloud management, Red Hat Satellite for infrastructure management, Red Hat OpenStack for the cloud stack, and Red Hat Insights for predictive analytics.
- It features enhanced VM and hypervisor security through SELinux, sVirt, and mandatory access control (MAC).
- It supports (NUMA) Non-uniform memory access that allows users to deploy large guest workloads while minimizing physical memory access overhead.
- One caveat is that Redhat virtualization also provides a paid VM suitable for enterprise-level environments. The price depends on the support plan you choose.
7. GNOME Boxes
GNOME Boxes comes as the default VM with your Fedora installation. GNOME Boxes is easy to use and can make complex virtualization operations very simple on Linux. Generally, Gnome Boxes is less well-known but is a front end for Qemu, KVM, and libvirt. GNOME Boxes is one of the most efficient VM solutions for Linux, Windows, or BSD. It features a quick setup wizard making it very easy to use even for newbie Linux users. Its basic appearance might not be the best. However, it can still handle competitive functions and is at par with the majority of VMs.
Top features
It can load an OS (operating system) image directly from a URL.
It detects the OS and allocates a sufficient amount of RAM and disk space.
It features a robust command-line interface (CLI) that comes in handy for advanced VM users.
It has a clone feature that lets users create copies of existing VMs instantly.
GNOME Boxes is one the best option for Linux users who need complex tasks done quickly. It is my go-to choice for quick and straightforward deployments. However, sometimes Gnome Boxes can take a long to access a disk image or even become slow to release the mouse back to the host OS. I tend to overlook these shortcomings because of the simple setup. Moreover, its VMs generally run as quickly as the host system, and you might not detect any difference in performance.
Gnome Boxes has perfected virtualization by providing software freedom and is worth installing even if Gnome is not your usual desktop environment.
8. ProxMox
ProxMox is a Debian-based, open-source server-virtualization management solution to run different VMs. The virtualization platform can manage KVM (Kernel-based Virtual Machine) for virtual machines and LXC for containers. It features a straightforward installation process that launches a web interface for easy management and configuration.
Top features
It features Linux OpenVZ and KVM technologies to manage Virtual Private Servers in an isolated server environment of one physical server.
The project supports the latest Intel & AMD chipsets.
It features a central web interface based on the ExtJS JavaScript framework and can be accessed from any modern browser.
It features (pmxcfs) Proxmox Cluster File System – a database-driven file system that enables you to synchronize configuration files across your cluster.
It features live/online migration that allows you to move running VMs from one cluster node to another without downtime.
It features a command-line interface to manage components of your virtual environment with intelligent tab completion.
It features a flexible storage model where VM images can be stored on one or many local storage devices or shared storage like SA and NFS.
It uses a RESTful API and JSON as the primary data format to enable fast and easy integration of third-party management tools and custom hosting environments.
It features a built-in firewall that is completely customizable, allowing complex configurations via the GUI or CLI. You can set up firewall rules for single VMs, containers, or all hosts inside a cluster through features like firewall macros, security groups, IP sets, and aliases.
Why you should virtualize your infrastructure
Virtualization can increase scalability, agility, and flexibility while creating significant cost savings. You will also enjoy greater workload mobility, improved performance, availability of resources, and automation of operations. In essence, it makes it simpler to manage your computing resources and less costly to own and operate.
Reduce initial capital costs and operating costs: Virtualized environments are more cost-effective. You will be able to consume fewer physical customers, helping you to reduce initial investments in hardware significantly. A non-virtualized environment can be inefficient because compute resources can sit idle and can’t be used for other applications on the server.
Minimize or eliminate downtime: In case of downtime, a physical server requires someone present to replace or fix it, which could take hours, significantly reducing productivity. In contrast, a virtualized environment is easy to provision and deploy. In addition, it allows system admins to replicate and recover the affected virtual machine, which significantly enhances the resiliency.
Increase efficiency and productivity: Virtualized environments allow you to spend less time maintaining the physical hardware or infrastructure. You can easily install, update, and maintain the environment across all the VMs in the virtual environment on the server instead of managing it server-by-server.
It provides security and fault isolation at the hardware level.
You can save the entire state of your virtual machine to a file.
You can migrate or provision any virtual machine to any physical server.
Virtualization preserves overall performance through advanced resource controls.
Developers can easily manage and control development, test, or production environments through a virtual machine.
Become more green-friendly: Virtualized environments allow you to cut down on the number of physical servers that reduce power consumption. In essence, it cuts down power-related costs and generally reduces the carbon footprint of your infrastructure. We all deserve a green-friendly environment.
Wrapping up
The article discusses some of the best open-source virtualization software such as XenProject, VirtualBox, Microsoft Hyper-V, Linux KVM, and oVirt. Virtualization of your architecture can increase scalability, agility, and flexibility while creating significant cost savings. Developers can also enjoy greater workload mobility (可移植性) and control their development, test, or production environments. Moreover, it allows you to cut down on the number of physical servers, reducing power consumption (一个普通X86一天需要30度电这还不包括空调费) and making your organization a green-friendly enterprise. In essence, virtualization makes it simpler to manage your computing resources and is less costly.
更多推荐
所有评论(0)