What is the use of linux virtualization?

青灯夜游
Release: 2023-04-13 16:33:49
Original
926 people have browsed it

In Linux, virtualization can expand the capacity of hardware and simplify the reconfiguration process of software. Advantages of Linux virtualization: 1. Super resource allocation; 2. Reduce capital costs and operation and maintenance costs; 3. Minimize or eliminate downtime; 4. Improve the efficiency, effectiveness, agility and responsiveness of the IT department; 5. Speed ​​up the deployment of applications and resources; 6. Improve business continuity and disaster recovery capabilities; 7. Simplify data center management; 8. Reduce port conflicts.

What is the use of linux virtualization?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is Linux virtualization

Virtualization (Virtualization) is a resource management technology that combines various physical resources of the computer (CPU, memory, disk space , network adapter, etc.), it is abstracted, converted and presented, and can be divided and combined into one or more computer configuration environments, and can be re-divided and re-assembled to maximize the rational use of physical resources.

Virtualization technology is a technology that abstracts and converts physical computer resources into virtual computer resources for use by programs. The computer resources referred to here include computing control resources provided by the CPU, data storage resources provided by the hard disk, network transmission resources provided by the network card, etc.

Virtualization technology can expand the capacity of hardware and simplify the reconfiguration process of software. CPU virtualization technology can simulate multiple CPUs in parallel with a single CPU, allowing one platform to run multiple operating systems at the same time, and applications can run in independent spaces without affecting each other, thereby significantly improving computer work efficiency - Baidu Encyclopedia. Virtualization mainly refers to a special technology that provides users with an abstract, unified, simulated computing environment (called a virtual machine) by hiding the actual physical characteristics of a specific computing platform - IBM definition.

Advantages of Virtualization

(1) The resources are over-sized, such as 128G of physical memory, and 200G of memory can be allocated to the virtual machine. It is generally used in test environments and generally in production environments. Not recommended.

(2) Reduce capital costs and operation and maintenance costs

(3) Minimize or eliminate downtime

(4) Improve the efficiency, effectiveness and agility of the IT department stability and responsiveness

(5) Accelerate the deployment of applications and resources

(6) Improve business continuity and disaster recovery capabilities

(7) Simplify data center management

(8) Availability of true Software-Defined Data Center

(9) Reduce port conflicts

Common virtualization vendors and products

##OracleOracle VM VirtualBoxCitrixXen

Install the virtualization server platform (KVM)

1. Main software package

qemu-kvm https ://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b provides low-level simulation support for kvm

libvirt-daemon https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15blibvirtd daemon, manages virtual machines

libvirt-client https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b client software, providing client management commands

libvirt-daemon-driver gemu https://www.php.cn/link /93ac0c50dd620dc7b88e5fe05c70e15blibvirtd Connect gemu driver

virt-manager https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15bGraphic management tool

2. Preparation work

1) Prepare a device (the blogger here prepares a Centos7 server)

2) Turn off SELinux and firewall (may cause communication within the virtual machine to be impossible)

3) Install KVM related packages, the command is as follows

yum -y install kvm bridge-utils virt-v2v libgesttfs-tools libcanberra-gtk2 qemu-kvm.x86_64 qemu-kvm-tools.86_64 libvirt.x86_64 libvirt-cim.x86_64 libvirt-client.x86_64 lsbvirt-java.noarch libvirt-python.x86_64 libiscsidbus-devel virt-clone tunctl virt-manager python-virtinst virt-vieeer virt-top dejavu-lgc-sans-fonts nfs-utils epel-release
Copy after login

3. Start the libvirtd server

libvirtd provides services for managing virtual machines Interface, providing DNS, DHCP and other functions

1) Command

systemctl restart libvirtd
systemctl restart libvirtd
Copy after login

2) Example

[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b systemctl restart libvirtd

[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b systemctl restart libvirtd
Copy after login

4. Open the management tool

1) Command

virt-manager
Copy after login

2) Instance

[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b virt-manager
Copy after login

5. Click the icon to create a new virtual machine

What is the use of linux virtualization?

6. Choose how to install the operating system

Here select "Local install media (ISO image or CDROM)", click "ForWard"

What is the use of linux virtualization?

Note:

1) Local install media (ISO image or CDROM)

Local installation media (ISO image or CDROM)

2) Network Install(HTTPFTPor NFS)

Network Installation (HTTP, FTP or NFS)

3 ) Network Boot (PXE)

Network Boot (PXE)

4) Import existing disk image

Import existing disk image

7. Find the installation media

Select "Use ISO image", click "Browse..." select the ISO image location and click "ForWard"

What is the use of linux virtualization?

Note:

1) Use CDROM or DVD

Use CD or DVD

2) Use ISO image

Use ISO image

3)Automatically detect operating system based on install media

自动检测操作系统上的基础安装介质

8、设置内存大小和CPU数量,设置完毕后点击“ForWard”

What is the use of linux virtualization?

9、创建虚拟磁盘

勾选“Enable storage for this virtual machine”,创建并设置磁盘容量,点击“ForWard”

What is the use of linux virtualization?

注:

1)Enable storage for this virtual machine

为虚拟机启用存储

2)Create a disk image for the virtual machine

为虚拟机创建磁盘映像

3)Select or create custom storage

选择或创建自定义存储

10、准备开始安装,设置好虚拟机名称,点击“Finish”

What is the use of linux virtualization?

注:

1)Name:虚拟机名称

2)OS:系统名称

3)Install:安装操作系统方式

4)Memory:内存大小

5)CPUs:处理器数量

6)Storage:存储容量与位置

7)Customize configuration before install:安装前自定义配置

8)Network selection:网络设置

四、操作虚拟机

1、使用virsh命令工具

virsh命令工具提供管理各虚拟机的命令接口,支持交互模式,包括查看、创建、停止、关闭等功能。

1)常用格式

virsh 控制指令 虚拟机名称 参数

2)命令

virsh

3)实例

[root@wangwu~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15bvirsh https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b启动virsh命令工具

欢迎使用virsh,虚拟化的交互式终端

输入:'help'来获得命令的帮助信息

'quit'退出

virsh https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b
Copy after login

2、查看虚拟化信息

查看KVM节点(服务器)信息

1)命令

virsh nodeinfo
Copy after login

2)实例

[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b virsh nodeinfo https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b查看KVM节点(服务器)信息

CPU 型号: x86_64

CPU: 1

CPU 频率: 2600 MHz

CPU socket: 1

每个 socket 的内核数: 1

每个内核的线程数: 1

NUMA 单元: 1

内存大小: 1,048,576 KiB
Copy after login

列出虚拟机状态

1)命令

virsh list --all

2)实例

[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b virsh list --all https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b列出所有虚拟机的状态

Id Name  State

6 centos7.0 shut off
Copy after login

查看指定虚拟机的信息

1)命令

virsh dominfo 虚拟机名称

2)实例

[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b virsh dominfo centos7.0        https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b查看centos7.0虚拟机的信息

Id: 6

名称: centos7.0

UUID: 78fa5915-c060-4731-b4c5-bd4aaaea8fee

OS 类型: hvm

状态: running

CPU: 1

CPU 时间: 28.7s

最大内存: 1048576 KiB

使用的内存: 1048576 KiB

持久: 是

自动启动: 禁用

管理的保存: 否

安全性模式: none

安全性 DOI: 0
Copy after login

3、虚拟机开关机操作

启动|重启|关闭 指定的虚拟机

1)命令

virsh start 虚拟机名称
virsh reboot 虚拟机名称
virsh shutdown 虚拟机名称
Copy after login

2)实例

[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b virsh start centos7.0  https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b启动centos7.0虚拟机

Domain centos7.0 started

[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b virsh list https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b验证

Id Name    State

6  centos7.0  running
Copy after login
[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b virsh shutdown centos7.0  https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b关闭centos7.0虚拟机

Domain centos7.0 is being shutdown

[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b virsh list --all  https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b验证

Id Name    State

- centos7.0  shut off
Copy after login

强制关闭指定的虚拟机

1)命令

virsh destroy 虚拟机名称
Copy after login

2)实例

[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b virsh destroy centos7.0 https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b强制关闭centos7.0虚拟机

Domain centos7.0 destroyed

[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b virsh list --all  https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b验证

Id Name    State

- centos7.0  shut off
Copy after login

将指定的虚拟机设为|取消开机自动运行

1)命令

virsh autostart 虚拟机名称
virsh autostart --disable 虚拟机名称
Copy after login

2)实例

[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b virsh autostart centos7.0 https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b 设置centos7.0虚拟机自启动           

 Domain centos7.0 marked as autostarted

[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b virsh dominfo centos7.0 https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b验证

Id:

Name: centos7.0

... ... ...

Autostart: enable

... ... ...
Copy after login
[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b virsh autostart --disable centos7.0 https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b 取消centos7.0虚拟机自启动  

Domain centos7.0 unmarked as autostarted

[root@wangwu ~]https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b virsh dominfo centos7.0 https://www.php.cn/link/93ac0c50dd620dc7b88e5fe05c70e15b验证

Id:

Name: centos7.0     

... ... ...

Autostart: disable

... ... ...
Copy after login

相关推荐:《Linux视频教程

Series

##Common PC/Server Version

VMware

VMware Workstation, vSphere

Microsoft

VirtualPC, Hyper-V

RedHat

KVM, RHEV

The above is the detailed content of What is the use of linux virtualization?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template