前言
我们在工作学习的过程中,常常需要使用虚拟机,所以Linux下的虚拟部署九显得比较重要,那么这一节我会对Linux下的虚拟部署进行学习,并且进行实操,安装虚拟机、以及快照的拍摄
一、Linux下的虚拟化部署
1.下载并且安装
下载客户机和工具
[root@westos_student50 yum.repos.d]# dnf group install "Virtualization Client" "virtualization Tools" -y
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Last metadata expiration check: 0:07:03 ago on Fri 29 Jul 2022 11:20:13 PM CST.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing Groups:
Virtualization Client
Virtualization Tools
Transaction Summary
================================================================================
Complete!
完成之后打开客户机,并且进行安装;安装之后会出现配置软件的界面,我们按照自己的需求进行相关配置即可
这个界面会有我们需要的各种相关设置
完成安装
在设置自己的超级用户密码以及自己账户及密码之后就完成了虚拟机的安装、接下来进行reboot重新启动即可
到这就已经成功在Linux中安装了虚拟机,完成了虚拟化部署
二、虚拟机快照
以命令的方式对刚刚创建的虚拟机进行快照的拍摄
[root@westos_student50 yum.repos.d]# qemu-img create -f qcow2 -b /var/lib/libvirt/images/
rhel8.2(1).qcow2 westosa.qcow2 westos.qcow2
[root@westos_student50 yum.repos.d]# qemu-img create -f qcow2 -b /var/lib/libvirt/images/
rhel8.2(1).qcow2 westosa.qcow2 westos.qcow2
[root@westos_student50 yum.repos.d]# qemu-img create -f qcow2 -b /var/lib/libvirt/images/rhel8.2\(1\).qcow2 /var/lib/libvirt/images/the1.qcow2
Formatting '/var/lib/libvirt/images/the1.qcow2', fmt=qcow2 size=10737418240 backing_file=/var/lib/libvirt/images/rhel8.2(1).qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16
[root@westos_student50 yum.repos.d]# file /var/lib/libvirt/images/the1.qcow2
/var/lib/libvirt/images/the1.qcow2: QEMU QCOW Image (v3), has backing file (path /var/lib/libvirt/images/rhel8.2(1).qcow2), 10737418240 bytes
**
截止这里,我们的快照也就完成了
总结
这一节学习了Linux下的虚拟化部署,我们进行了Linux下的虚拟机的下载安装以及相关的设置;然后我们又使用命令对虚拟机进行快照拍摄,这样我们就可以在平时使用的时候在快照中进行操作,这样会避免很多不必要的麻烦、例如我们不小心删错系统的配置文件,我们就可以利用快照进行还原,而不是重新安装虚拟机。