这篇文章主要介绍Linux虚拟化技术KVM的示例分析,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

KVM是一种内建于 Linux® 中的开源虚拟化技术。具体而言,KVM 可帮助您将 Linux 转变为虚拟机监控程序,使主机计算机能够运行多个隔离的虚拟环境,即虚拟客户机或虚拟机(VM)。

image-20211203153455759
实验

环境:redhat 7.4 虚拟机关机模式下开启虚拟化引擎后再开机

查看

[root@localhost~]#lscpu|grepvmx

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 rdseed adx smap xsaveopt arat [root@localhost ~]#

安装virt-manager libvirt后,开启libvirtd

[root@localhost~]#mount/dev/sr0/mnt[root@localhost~]#yuminstallvirt-managerlibvirt[root@localhost~]#systemctlenablelibvirtd[root@localhost~]#systemctlstartlibvirtd

查看

[root@localhosttest]#lsmod|grepkvmkvm_intel1700860kvm5663401kvm_intelirqbypass135031kvm

上传镜像到一个目录下,上传到/root/test

[root@localhosttest]#ll总用量3963904-rw-r--r--.1rootroot40590376968月609:49rhel-server-7.4-x86_64-dvd.iso

图形界面创建虚拟机 使用virt-manager在图形界面创建虚拟机(不能在xshell),安装系统

[root@mail~]#virt-manager

选择文件/新建虚拟机/本地安装介质(iso)/使用ISO映像/

系统安装最好安装命令行界面

如果想打开,使用virt-manager进去图形界面后右键打开就ok

2.5命令行界面安装系统

2.5.1添加桥接网络

[root@localhost~]#nmcliconnectionaddtypebridgecon-namebr1ifnamebr11

添加从设备到桥接网络

[root@localhost~]#nmcliconnectionaddtypebridge-slavecon-namebr1-port1ifnameens33masterbr1[root@localhost~]#nmcliconnectionshow12

2.5.2安装必要软件

[root@localhost~]#mount/dev/sr0/mntmount:/dev/sr0写保护,将以只读方式挂载[root@localhost~]#yuminstallvirt-installvirt-viewer123

2.5.3虚拟机关机后手动添加一个磁盘后开机

[root@localhost~]#fdisk/dev/sdb1

N P 回车 回车 W

[root@localhost~]#partprobe[root@localhost~]#fdisk-l/dev/sdb12

2.3.6执行安装命令 注意:镜像名称、镜像目录、磁盘路径

[root@localhost~]#virt-install--namerhel-server-7.4-x86_64-dvd.iso--diskpath=/dev/sdb1--checkpath_

以上是“Linux虚拟化技术KVM的示例分析”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!