Table of Contents
What is Linux virtualization
Install the virtualization server platform (KVM)
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
1) Command
2) Example
2) Instance
四、操作虚拟机
1)常用格式
1)命令
2)实例
查看KVM节点(服务器)信息
列出虚拟机状态
查看指定虚拟机的信息
启动|重启|关闭 指定的虚拟机
强制关闭指定的虚拟机
将指定的虚拟机设为|取消开机自动运行
Home Operation and Maintenance Linux Operation and Maintenance What is the use of linux virtualization?

What is the use of linux virtualization?

Apr 13, 2023 pm 04:33 PM
linux

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)

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What computer configuration is required for vscode What computer configuration is required for vscode Apr 15, 2025 pm 09:48 PM

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

How to run java code in notepad How to run java code in notepad Apr 16, 2025 pm 07:39 PM

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

vscode cannot install extension vscode cannot install extension Apr 15, 2025 pm 07:18 PM

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

vscode terminal usage tutorial vscode terminal usage tutorial Apr 15, 2025 pm 10:09 PM

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

Where to write code in vscode Where to write code in vscode Apr 15, 2025 pm 09:54 PM

Writing code in Visual Studio Code (VSCode) is simple and easy to use. Just install VSCode, create a project, select a language, create a file, write code, save and run it. The advantages of VSCode include cross-platform, free and open source, powerful features, rich extensions, and lightweight and fast.

Can vscode be used for mac Can vscode be used for mac Apr 15, 2025 pm 07:36 PM

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

See all articles