centos7安装部署kvm,照做就行
大家好,今天分享centos7部署kvm
首先,我们要了解一下kvm
KVM 自 Linux 2.6.20 版本后就直接整合到 Linux 内核,它依托 CPU 虚拟化指令集(如
Intel-VT、AMD-V)实现高性能的虚拟化支持。由于与 Linux 内核高度整合,因此在性能、
安全性、兼容性、稳定性上都有很好的表现。
这是它的结构图
也许这个图不太好懂,我简而言之
在我们宿主机上按了一个VMware 虚拟机, 在VMware虚拟机上安装了centos7系统,在centos7上安装kvm虚拟化的软件
就是这个样子
我们来演示一下
- 关闭虚拟机
打开相关选项
打开虚拟机centos7
连接xshell
测试网络,现在就是没问题的,因为我们要使用网络源
[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (180.101.49.11) 56(84) bytes of data.
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=1 ttl=128 time=11.6 ms
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=2 ttl=128 time=11.1 ms
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=3 ttl=128 time=9.69 ms
64 bytes from 180.101.49.11 (180.101.49.11): icmp_seq=4 ttl=128 time=10.3 ms
安装 GNOME 桌面环境
[root@localhost ~]# yum groupinstall -y "GNOME Desktop" //安装 GNOME 桌面环境
安装KVM 模块
[root@localhost ~]# yum -y install qemu-kvm //安装KVM 模块
安装KVM 调试工具
[root@localhost ~]# yum -y install qemu-kvm-tools
构建虚拟机的命令行工具
[root@localhost ~]# yum -y install virt-install
qemu 组件,创建磁盘、启动虚拟机等
yum -y install qemu-img //默认已经有了
yum -y install bridge-utils // 网络支持工具,默认已经有了
yum -y install libvirt //安装虚拟机管理工具
yum -y install virt-manager
输入这条命令,只要有输出,就是支持虚拟化
[root@localhost ~]# cat /proc/cpuinfo | grep vmx
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq vmx
ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec ibpb ibrs stibp arat spec_ctrl intel_stibp arch_capabilities
检查 KVM 模块是否安装:
[root@localhost ~]# lsmod | grep kvm
kvm_intel 174841 0
kvm 578518 1 kvm_intel
irqbypass 13503 1 kvm
将 系 统 的 默 认 运 行 target 更 改 为
graphical.targe。
[root@localhost ~]# ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
开启 libvirtd 服务,以开启相关支持。
[root@localhost ~]# systemctl start libvirtd
[root@localhost ~]# systemctl enable libvirtd
[root@localhost ~]# virt-manager
http://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/CentOS-7-x86_64-Minimal-2009.iso
进入这个目录
[root@localhost images]# pwd
/var/lib/libvirt/images
在这个目录当中上传一个centos7镜像,这个比较小
[root@localhost images]# ll
总用量 996352
-rw-r--r--. 1 root root 1020264448 6月 24 16:52 CentOS-7-x86_64-Minimal-2009.iso
[root@localhost images]#
然后,点击“开始安装”
重启就可以了
我们已经进入到字符界面了
使用管理员用户登录
发现迷你版的镜像没有ifcofig命令
yum -y install net-tools
[root@localhost ~]# virsh -h //查看命令帮助
virsh [options]... [<command_string>]
virsh [options]... <command> [args...]options:-c | --connect=URI hypervisor connection URI-d | --debug=NUM debug level [0-4]-e | --escape <char> set escape sequence for console-h | --help this help-k | --keepalive-interval=NUMkeepalive interval in seconds, 0 for disable-K | --keepalive-count=NUMnumber of possible missed keepalive messages-l | --log=FILE output logging to file-q | --quiet quiet mode-r | --readonly connect readonly-t | --timing print timing information-v short version-V long version--version[=TYPE] version, TYPE is short or long (default short)commands (non interactive mode):Domain Management (help keyword 'domain')attach-device 从一个XML文件附加装置attach-disk 附加磁盘设备attach-interface 获得网络界面autostart 自动开始一个域blkdeviotune 设定或者查询块设备 I/O 调节参数。blkiotune 获取或者数值 blkio 参数blockcommit 启动块提交操作。blockcopy 启动块复制操作。blockjob 管理活跃块操作blockpull 使用其后端映像填充磁盘。blockresize 创新定义域块设备大小change-media 更改 CD 介质或者软盘驱动器console 连接到客户会话cpu-stats 显示域 cpu 统计数据create 从一个 XML 文件创建一个域define 从一个 XML 文件定义(但不开始)一个域desc 显示或者设定域描述或者标题destroy 销毁(停止)域detach-device 从一个 XML 文件分离设备detach-device-alias detach device from an aliasdetach-disk 分离磁盘设备detach-interface 分离网络界面domdisplay 域显示连接 URIdomfsfreeze Freeze domain's mounted filesystems.domfsthaw Thaw domain's mounted filesystems.domfsinfo Get information of domain's mounted filesystems.domfstrim 在域挂载的文件系统中调用 fstrim。domhostname 输出域主机名domid 把一个域名或 UUID 转换为域 iddomif-setlink 设定虚拟接口的链接状态domiftune 获取/设定虚拟接口参数domjobabort 忽略活跃域任务domjobinfo 域任务信息domname 将域 id 或 UUID 转换为域名domrename rename a domaindompmsuspend 使用电源管理功能挂起域dompmwakeup 从 pmsuspended 状态唤醒域domuuid 把一个域名或 id 转换为域 UUIDdomxml-from-native 将原始配置转换为域 XMLdomxml-to-native 将域 XML 转换为原始配置dump 把一个域的内核 dump 到一个文件中以方便分析dumpxml XML 中的域信息edit 编辑某个域的 XML 配置event Domain Eventsinject-nmi 在虚拟机中输入 NMIiothreadinfo view domain IOThreadsiothreadpin control domain IOThread affinityiothreadadd add an IOThread to the guest domainiothreaddel delete an IOThread from the guest domainsend-key 向虚拟机发送序列号send-process-signal 向进程发送信号lxc-enter-namespace LXC 虚拟机进入名称空间managedsave 管理域状态的保存managedsave-remove 删除域的管理保存managedsave-edit edit XML for a domain's managed save state filemanagedsave-dumpxml Domain information of managed save state file in XMLmanagedsave-define redefine the XML for a domain's managed save state filememtune 获取或者数值内存参数perf Get or set perf eventmetadata show or set domain's custom XML metadatamigrate 将域迁移到另一个主机中migrate-setmaxdowntime 设定最大可耐受故障时间migrate-getmaxdowntime get maximum tolerable downtimemigrate-compcache 获取/设定压缩缓存大小migrate-setspeed 设定迁移带宽的最大值migrate-getspeed 获取最长迁移带宽migrate-postcopy Switch running migration from pre-copy to post-copynumatune 获取或者数值 numa 参数qemu-attach QEMU 附加qemu-monitor-command QEMU 监控程序命令qemu-monitor-event QEMU Monitor Eventsqemu-agent-command QEMU 虚拟机代理命令reboot 重新启动一个域reset 重新设定域restore 从一个存在一个文件中的状态恢复一个域resume 重新恢复一个域save 把一个域的状态保存到一个文件save-image-define 为域的保存状态文件重新定义 XMLsave-image-dumpxml 在 XML 中保存状态域信息save-image-edit 为域保存状态文件编辑 XMLschedinfo 显示/设置日程安排变量screenshot 提取当前域控制台快照并保存到文件中set-lifecycle-action change lifecycle actionsset-user-password set the user password inside the domainsetmaxmem 改变最大内存限制值setmem 改变内存的分配setvcpus 改变虚拟 CPU 的号shutdown 关闭一个域start 开始一个(以前定义的)非活跃的域suspend 挂起一个域ttyconsole tty 控制台undefine 取消定义一个域update-device 从 XML 文件中关系设备vcpucount 域 vcpu 计数vcpuinfo 详细的域 vcpu 信息vcpupin 控制或者查询域 vcpu 亲和性emulatorpin 控制火车查询域模拟器亲和性vncdisplay vnc 显示guestvcpus query or modify state of vcpu in the guest (via agent)setvcpu attach/detach vcpu or groups of threadsdomblkthreshold set the threshold for block-threshold event for a given block device or it's backing chain elementDomain Monitoring (help keyword 'monitor')domblkerror 在块设备中显示错误domblkinfo 域块设备大小信息domblklist 列出所有域块domblkstat 获得域设备块状态domcontrol 域控制接口状态domif-getlink 获取虚拟接口链接状态domifaddr Get network interfaces' addresses for a running domaindomiflist 列出所有域虚拟接口domifstat 获得域网络接口状态dominfo 域信息dommemstat 获取域的内存统计domstate 域状态domstats get statistics about one or multiple domainsdomtime domain timelist 列出域Host and Hypervisor (help keyword 'host')allocpages Manipulate pages pool sizecapabilities 性能cpu-baseline 计算基线 CPUcpu-compare 使用 XML 文件中描述的 CPU 与主机 CPU 进行对比cpu-models CPU modelsdomcapabilities domain capabilitiesfreecell NUMA可用内存freepages NUMA free pageshostname 打印管理程序主机名hypervisor-cpu-baseline compute baseline CPU usable by a specific hypervisorhypervisor-cpu-compare compare a CPU with the CPU created by a hypervisor on the hostmaxvcpus 连接 vcpu 最大值node-memory-tune 获取或者设定节点内存参数nodecpumap 节点 cpu 映射nodecpustats 输出节点的 cpu 状统计数据。nodeinfo 节点信息nodememstats 输出节点的内存状统计数据。nodesuspend 在给定时间段挂起主机节点sysinfo 输出 hypervisor sysinfouri 打印管理程序典型的URIversion 显示版本Interface (help keyword 'interface')iface-begin 生成当前接口设置快照,可在今后用于提交 (iface-commit) 或者恢复 (iface-rollback)iface-bridge 生成桥接设备并为其附加一个现有网络设备iface-commit 提交 iface-begin 后的更改并释放恢复点iface-define define an inactive persistent physical host interface or modify an existing persistent one from an XML fileiface-destroy 删除物理主机接口(启用它请执行 "if-down")iface-dumpxml XML 中的接口信息iface-edit 为物理主机界面编辑 XML 配置iface-list 物理主机接口列表iface-mac 将接口名称转换为接口 MAC 地址iface-name 将接口 MAC 地址转换为接口名称iface-rollback 恢复到之前保存的使用 iface-begin 生成的更改iface-start 启动物理主机接口(启用它请执行 "if-up")iface-unbridge 分离其辅助设备后取消定义桥接设备iface-undefine 取消定义物理主机接口(从配置中删除)Network Filter (help keyword 'filter')nwfilter-define 使用 XML 文件定义或者更新网络过滤器nwfilter-dumpxml XML 中的网络过滤器信息nwfilter-edit 为网络过滤器编辑 XML 配置nwfilter-list 列出网络过滤器nwfilter-undefine 取消定义网络过滤器nwfilter-binding-create create a network filter binding from an XML filenwfilter-binding-delete delete a network filter bindingnwfilter-binding-dumpxml XML 中的网络过滤器信息nwfilter-binding-list list network filter bindingsNetworking (help keyword 'network')net-autostart 自动开始网络net-create 从一个 XML 文件创建一个网络net-define define an inactive persistent virtual network or modify an existing persistent one from an XML filenet-destroy 销毁(停止)网络net-dhcp-leases print lease info for a given networknet-dumpxml XML 中的网络信息net-edit 为网络编辑 XML 配置net-event Network Eventsnet-info 网络信息net-list 列出网络net-name 把一个网络UUID 转换为网络名net-start 开始一个(以前定义的)不活跃的网络net-undefine undefine a persistent networknet-update 更新现有网络配置的部分net-uuid 把一个网络名转换为网络UUIDNode Device (help keyword 'nodedev')nodedev-create 根据节点中的 XML 文件定义生成设备nodedev-destroy 销毁(停止)节点中的设备nodedev-detach 将节点设备与其设备驱动程序分离nodedev-dumpxml XML 中的节点设备详情nodedev-list 这台主机中中的枚举设备nodedev-reattach 重新将节点设备附加到他的设备驱动程序中nodedev-reset 重置节点设备nodedev-event Node Device EventsSecret (help keyword 'secret')secret-define 定义或者修改 XML 中的 secretsecret-dumpxml XML 中的 secret 属性secret-event Secret Eventssecret-get-value secret 值输出secret-list 列出 secretsecret-set-value 设定 secret 值secret-undefine 取消定义 secretSnapshot (help keyword 'snapshot')snapshot-create 使用 XML 生成快照snapshot-create-as 使用一组参数生成快照snapshot-current 获取或者设定当前快照snapshot-delete 删除域快照snapshot-dumpxml 为域快照转储 XMLsnapshot-edit 编辑快照 XMLsnapshot-info 快照信息snapshot-list 为域列出快照snapshot-parent 获取快照的上级快照名称snapshot-revert 将域转换为快照Storage Pool (help keyword 'pool')find-storage-pool-sources-as 找到潜在存储池源find-storage-pool-sources 发现潜在存储池源pool-autostart 自动启动某个池pool-build 建立池pool-create-as 从一组变量中创建一个池pool-create 从一个 XML 文件中创建一个池pool-define-as 在一组变量中定义池pool-define define an inactive persistent storage pool or modify an existing persistent one from an XML filepool-delete 删除池pool-destroy 销毁(删除)池pool-dumpxml XML 中的池信息pool-edit 为存储池编辑 XML 配置pool-info 存储池信息pool-list 列出池pool-name 将池 UUID 转换为池名称pool-refresh 刷新池pool-start 启动一个(以前定义的)非活跃的池pool-undefine 取消定义一个不活跃的池pool-uuid 把一个池名称转换为池 UUIDpool-event Storage Pool EventsStorage Volume (help keyword 'volume')vol-clone 克隆卷。vol-create-as 从一组变量中创建卷vol-create 从一个 XML 文件创建一个卷vol-create-from 生成卷,使用另一个卷作为输入。vol-delete 删除卷vol-download 将卷内容下载到文件中vol-dumpxml XML 中的卷信息vol-info 存储卷信息vol-key 为给定密钥或者路径返回卷密钥vol-list 列出卷vol-name 为给定密钥或者路径返回卷名vol-path 为给定密钥或者路径返回卷路径vol-pool 为给定密钥或者路径返回存储池vol-resize 创新定义卷大小vol-upload 将文件内容上传到卷中vol-wipe 擦除卷Virsh itself (help keyword 'virsh')cd 更改当前目录echo echo 参数exit 退出这个非交互式终端help 打印帮助pwd 输出当前目录quit 退出这个非交互式终端connect 连接(重新连接)到 hypervisor(指定 help <group> 获取组中命令的详情)(使用 --help <command> 来获得这个命令的详细信息)
查看 KVM 的配置文件存放目录
[root@localhost ~]# ll /etc/libvirt/qemu/
总用量 8
-rw-------. 1 root root 4631 6月 30 16:11 centos7.0.xml
drwx------. 3 root root 42 4月 28 2021 networks
[root@localhost ~]#
查看虚拟机状态
[root@localhost ~]# virsh list --allId 名称 状态
----------------------------------------------------4 centos7.0 running[root@localhost ~]#
centos7.0 就是我们刚才安装的虚拟机
关闭虚拟机
[root@localhost ~]# virsh shutdown centos7.0
域 centos7.0 被关闭
开启虚拟机
[root@localhost ~]# virsh start centos7.0
域 centos7.0 已开始
强制关闭
[root@localhost ~]# virsh destroy centos7.0
这个时候,我们再看一下状态:
[root@localhost ~]# virsh list --allId 名称 状态
----------------------------------------------------- centos7.0 关闭
通过配置文件启动虚拟机系统
[root@localhost ~]# virsh create /etc/libvirt/qemu/centos7.0.xml
域 centos7.0 被创建(从 /etc/libvirt/qemu/centos7.0.xml)
看状态
[root@localhost ~]# virsh list --allId 名称 状态
----------------------------------------------------6 centos7.0 running
挂起虚拟机
[root@localhost ~]# virsh suspend centos7.0
域 centos7.0 被挂起
看一下状态
[root@localhost ~]# virsh list --allId 名称 状态
----------------------------------------------------6 centos7.0 暂停[root@localhost ~]#
配置虚拟机实例伴随宿主机自动启动
[root@localhost ~]# virsh autostart centos7.0
域 centos7.0标记为自动开始
恢复虚拟机
[root@localhost ~]# virsh resume centos7.0
导出虚拟机配置
把centos7.0 的配置放到centos7.1 里面
[root@localhost ~]# virsh dumpxml centos7.0 > /etc/libvirt/qemu/centos7.1
看现在的配置文件
[root@localhost ~]# ls /etc/libvirt/qemu/
autostart centos7.0.xml centos7.1 networks
删除虚拟机
[root@localhost ~]# virsh undefine centos7.0
域 centos7.0 已经被取消定义
这是的centos7.0 的配置文件已经没有了
[root@localhost ~]# ls /etc/libvirt/qemu/
autostart centos7.1 networks
现在没有运行的虚拟机
[root@localhost ~]# virsh list --allId 名称 状态
----------------------------------------------------[root@localhost ~]#
进入到配置文件目录
[root@localhost ~]# cd /etc/libvirt/qemu/
进行配置文件的重命名
[root@localhost qemu]# mv centos7.1 centos7.0
重新定义
[root@localhost qemu]# virsh define centos7.0
定义域 centos7.0(从 centos7.0)[root@localhost qemu]#
看现在的状态
[root@localhost qemu]# virsh list --allId 名称 状态
----------------------------------------------------- centos7.0 关闭[root@localhost qemu]#
修改虚拟机配置信息(用来修改系统内存大小、磁盘文件等信息)
直接通过 vim 命令修改:
[root@localhost qemu]# vim centos7.0
或者这样也可以
[root@localhost qemu]# virsh edit centos7.0
相当于编辑上面的配置文件
安装一下这个东西
[root@localhost ~]# yum install libguestfs-tools -y
var/lib/libvirt/images/: 这是我们放镜像的地方
大家在做的时候看自己的情况
查看当前磁盘格式
[root@localhost ~]# qemu-img info /var/lib/libvirt/images/centos7.0.qcow2
image: /var/lib/libvirt/images/centos7.0.qcow2
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 5.0G
cluster_size: 65536
Format specific information:compat: 1.1lazy refcounts: true
[root@localhost ~]#
这个也装一下
[root@localhost ~]# yum -y install libguestfs-tools-c
[root@localhost ~]# virt-cat -a /var/lib/libvirt/images/centos7.0.qcow2 /etc/sysconfig/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
在宿主机上查看kvm虚拟机centos7.0 的dns地址
root@localhost ~]# virt-edit -a /var/lib/libvirt/images/centos7.0.qcow2 /etc/resolv.conf # Generated by NetworkManager
查看虚拟机状态
[root@localhost ~]# virt-df -h centos7.0
文件系统 大小 已用空间 可用空间 使用百分比%
centos7.0:/dev/sda1 1014M 105M 909M 11%
centos7.0:/dev/centos/root 3.5G 1.3G 2.2G 39%
[root@localhost ~]#
看状态
[root@localhost ~]# virsh list --allId 名称 状态
----------------------------------------------------- centos7.0 关闭[root@localhost ~]#
克隆一个机器
[root@localhost ~]# virt-clone -o centos7.0 -n centos7.1 -f /var/lib/libvirt/images/centos7.1.qcow2
正在分配 'centos7.1.qcow2' | 5.0 GB 00:00:24 成功克隆 'centos7.1'。
再看一下状态,发现有centos7.1
[root@localhost ~]# virsh list --allId 名称 状态
----------------------------------------------------- centos7.0 关闭- centos7.1 关闭
开启这个图centos7.1
[root@localhost ~]# virsh start centos7.1
域 centos7.1 已开始
生成快照(理解成VMware的快照)
[root@localhost ~]# virsh snapshot-create centos7.0
已生成域快照 1656584049
[root@localhost ~]#
查看虚拟机快照的版本信息
[root@localhost ~]# virsh snapshot-current centos7.0
<domainsnapshot><name>1656584049</name><state>shutoff</state><creationTime>1656584049</creationTime><memory snapshot='no'/><disks><disk name='vda' snapshot='internal'/><disk name='hda' snapshot='no'/></disks><domain type='kvm'><name>centos7.0</name><uuid>8f9cd4d6-a1d1-4296-bf6e-379682af6b05</uuid><memory unit='KiB'>1048576</memory><currentMemory unit='KiB'>1048576</currentMemory><vcpu placement='static'>1</vcpu><resource><partition>/machine</partition></resource><os><type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type></os><features><acpi/><apic/></features><cpu mode='custom' match='exact' check='full'><model fallback='forbid'>Broadwell-IBRS</model><feature policy='disable' name='md-clear'/><feature policy='disable' name='ssbd'/><feature policy='disable' name='hle'/><feature policy='disable' name='rtm'/><feature policy='require' name='spec-ctrl'/><feature policy='require' name='hypervisor'/><feature policy='require' name='xsaveopt'/></cpu><clock offset='utc'><timer name='rtc' tickpolicy='catchup'/><timer name='pit' tickpolicy='delay'/><timer name='hpet' present='no'/></clock><on_poweroff>destroy</on_poweroff><on_reboot>restart</on_reboot><on_crash>destroy</on_crash><pm><suspend-to-mem enabled='no'/><suspend-to-disk enabled='no'/></pm><devices><emulator>/usr/libexec/qemu-kvm</emulator><disk type='file' device='disk'><driver name='qemu' type='qcow2'/><source file='/var/lib/libvirt/images/centos7.0.qcow2'/><target dev='vda' bus='virtio'/><boot order='1'/><address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/></disk><disk type='file' device='cdrom'><driver name='qemu' type='raw'/><target dev='hda' bus='ide'/><readonly/><boot order='2'/><address type='drive' controller='0' bus='0' target='0' unit='0'/></disk><controller type='usb' index='0' model='ich9-ehci1'><address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/></controller><controller type='usb' index='0' model='ich9-uhci1'><master startport='0'/><address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/></controller><controller type='usb' index='0' model='ich9-uhci2'><master startport='2'/><address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/></controller><controller type='usb' index='0' model='ich9-uhci3'><master startport='4'/><address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/></controller><controller type='ide' index='0'><address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/></controller><controller type='virtio-serial' index='0'><address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/></controller><controller type='pci' index='0' model='pci-root'/><interface type='network'><mac address='52:54:00:8d:e0:b0'/><source network='default'/><model type='virtio'/><boot order='3'/><address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/></interface><serial type='pty'><target type='isa-serial' port='0'><model name='isa-serial'/></target></serial><console type='pty'><target type='serial' port='0'/></console><channel type='unix'><target type='virtio' name='org.qemu.guest_agent.0'/><address type='virtio-serial' controller='0' bus='0' port='1'/></channel><channel type='spicevmc'><target type='virtio' name='com.redhat.spice.0'/><address type='virtio-serial' controller='0' bus='0' port='2'/></channel><input type='tablet' bus='usb'><address type='usb' bus='0' port='1'/></input><input type='mouse' bus='ps2'/><input type='keyboard' bus='ps2'/><graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'><listen type='address' address='127.0.0.1'/></graphics><sound model='ich6'><address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/></sound><video><model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/><address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/></video><redirdev bus='usb' type='spicevmc'><address type='usb' bus='0' port='2'/></redirdev><redirdev bus='usb' type='spicevmc'><address type='usb' bus='0' port='3'/></redirdev><memballoon model='virtio'><address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/></memballoon></devices><seclabel type='dynamic' model='selinux' relabel='yes'/><seclabel type='dynamic' model='dac' relabel='yes'/></domain>
</domainsnapshot>
查看快照时间
[root@localhost ~]# virsh snapshot-list centos7.0名称 生成时间 状态
------------------------------------------------------------1656584049 2022-06-30 18:14:09 +0800 shutoff[root@localhost ~]#
创建新的快照
[root@localhost ~]# virsh snapshot-create centos7.0
已生成域快照 1656584521
查看快照时间
[root@localhost ~]# virsh snapshot-list centos7.0名称 生成时间 状态
------------------------------------------------------------1656584049 2022-06-30 18:14:09 +0800 shutoff1656584521 2022-06-30 18:22:01 +0800 shutoff
切换原先的状态
[root@localhost ~]# virsh snapshot-revert centos7.0 1656584049
看信息
[root@localhost ~]# virsh snapshot-current centos7.0
<domainsnapshot><name>1656584049</name><state>shutoff</state><creationTime>1656584049</creationTime><memory snapshot='no'/><disks>
[root@localhost ~]# virsh snapshot-delete centos7.0 1656584049
已删除域快照 1656584049
好了,有关于centos7安装部署kvm 以及kvm的基本操作就到这里了,谢谢大家
centos7安装部署kvm,照做就行相关推荐
- Centos7安装部署免费confluence wiki
Confluence是一个专业的企业知识管理与协同软件, 也可以用于构建企业wiki.使用简单, 但它强大的编辑和站点管理特征能够帮助团队成员之间共享信息. 文档协作.集体讨论,信息推送. Cento ...
- Centos7安装部署免费confluence wiki(知识库)详细操作步骤
Centos7安装部署免费confluence wiki(知识库)详细操作步骤 前言:confluence是团队协作软件,改变团队工作方式,作为现代化办公不可缺少的工具 wiki所需的安装包: 链接: ...
- Centos7安装部署BookStack
Centos7安装部署BookStack 参考文章链接: 1.安装epel-release 2.安装nginx 3.下载php-fpm以及所需依赖组件 4.配置PHP 5.更改php-fpm配置文件 ...
- 记一次 Centos7 安装部署 gogs-v0.12.1
一.基本信息 Gogs 的目标是打造一个最简单.最快速和最轻松的方式搭建自助 Git 服务.使用 Go 语言开发使得 Gogs 能够通过独立的二进制分发,并且支持 Go 语言支持的 所有平台,包括 L ...
- Elasticsearch系列之:Centos7安装部署Elasticsearch详细步骤
Elasticsearch系列之:Centos7安装部署Elasticsearch详细步骤 一.下载ElasticSearch安装包 二.创建ES数据存储目录 三.创建ES所属用户 四.配置用户的打开 ...
- 运维之道 | CentOS7.6 安装部署KVM虚拟机(GUI图形化安装)
前言 KVM虚拟技术是完全的虚拟化,VPS之间不共用母机CPU和内存,VPS之间资源使用是独立的,互不影响.由于是完全的虚拟化,KVM虚拟技术的VPS理论上支持安装linux和windows任何版本, ...
- Centos7.2上安装部署oracle11gR2数据库(命令行静默安装)
目录 文章目录 目录 1. 机器准备 2. 系统环境 3. Oracle安前部署的准备工作(需要在Root用户下执行) 3.1 软件安装约定 3.2 配置yum源并安装oracle数据库所需依赖包 3 ...
- CentOS7 安装管理KVM虚拟机
为什么80%的码农都做不了架构师?>>> 系统:CentOS7 64位 [root@e3 ~]# cat /etc/redhat-release CentOS Linux re ...
- Centos7 安装部署Kubernetes(k8s)集群过程
1.系统环境 服务器版本 docker软件版本 CPU架构 CentOS Linux release 7.9 Docker version 20.10.12 x86_64 2.前言 如下图描述了软件部 ...
- centos7安装部署gitlab
参考文章:centos7部署gitlab - 星尘yuan - 博客园 一.Gitlab介 1.1 gitlab信息 GitLab是利用Ruby on Rails一个开源的版本管理系统,实现一个自托管 ...
最新文章
- 基于注意力机制的图卷积网络预测药物-疾病关联
- 更优雅地判断iOS设备类型
- cocos2dx build_native.sh clean 命令报错的解决
- NOIP模拟测试25「字符串·乌鸦喝水·所陀门王的宝藏(陀螺王)」
- 大数据技术周报第 004 期
- Android显示PDF文件之PDFviewer
- FlashBuilder环境下使用Starling出现的问题收集整理
- JPA的cannot simultaneously fetch multiple bags异常的解决
- 文字转语音合成器哪个好?这些文字转语音软件值得收藏
- 圆锥曲线万能弦长公式_圆锥曲线的弦长公式及其推导过程
- Camera2闪光灯相关
- 【产业互联网】阿里曾鸣:下一个风口是产业互联网
- python 拼音相似度_多种相似度计算的python实现
- Wi-Fi显示“无Internet,安全”是怎么回事?
- 爬虫-Python编程入门
- mysql查询数据库结构_mysql查询数据库下的表结构
- java/php/net/python智能手机参数分析平台设计
- 【runloop】performSelector方法探究
- ORBSLAM2实验记录(1)——稠密建图
- c语言char什么意思 新闻,关于C ++:char *是什么意思