Skip to content

Centos7部署操作使用KVM虚拟机。

虚拟化技术是将少个的物理资源划分成多个逻辑资源。


安装虚拟化服务平台:

KVM/QEMU/LIBVIRTD

KVM是linux内核的模块,他需要CPU的支持,采用硬件辅助虚拟化技术Intel-VT,AMD-V,内存的相关如Intel的EPT和AMD的RVI技术。

QEMU是虚拟化的仿真工具,通过ioctl与内核kvm交互完成对硬件的虚拟化支持。(例如,仿真鼠标键盘)

Libvirt是一个对虚拟化管理的接口和工具,提供用户端程序virsh,virt-install,virt-manager,virt-view与用户交互。

必备软件:

qemu-kvm

为kvm提供底层仿真支持

libvirt-daemon

libvirt守护进程,管理虚拟机。

libvirt-client

用户端软件,提供客户端管理命令。

libvirt-daemon-driver-qemu

libvirtd连接qemu的驱动。

可选:

virt-install        系统安装工具

virt-manager    图形管理工具

virt-v2v        虚拟机迁移工具

virt-p2v        物理机迁移工具

虚拟机配置声明文件(XML)位置:

/etc/libvirt/qemu/

虚拟机磁盘镜像文件(虚拟机的硬盘)位置:

/var/lib/libvirt/images/

安装虚拟机:

yum -y install qemu-kvm libvirt-daemon libvirt-client libvirt-daemon-driver-qemu
systemctl start libvirtd

管理虚拟机:(在此操作界面下支持tab,并且可以在开头少打virsh命令)

[root@7 ~]# virsh
欢迎使用 virsh,虚拟化的交互式终端。

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

virsh #

查看所有虚拟机:

[root@7 ~]# virsh list --all

查看虚拟网卡:

[root@7 ~]# virsh net-list --all

查看指定虚拟机信息:

[root@7 ~]# virsh dominfo [虚拟机名称]

查看指定虚拟机上插入了多少虚拟网卡:

[root@7 ~]# virsh domiflist [虚拟机名称]

开关机操作:

[root@7 ~]# virsh start [虚拟机名称]           //开机
[root@7 ~]# virsh reboot [虚拟机名称]           //重启
[root@7 ~]# virsh shutdown [虚拟机名称]           //关机
[root@7 ~]# virsh destroy [虚拟机名称]           //强制关机(关闭电源)
[root@7 ~]# virsh autostart [虚拟机名称]        //标记为真机开机自启动
[root@7 ~]# virsh autostart --disable [虚拟机名称]        //取消开机自启动
[root@7 ~]# virsh undefine [虚拟机名称] //删除虚拟机

连接控制远程主机上的虚拟机:

virsh -c qemu+ssh://root@172.0.0.0:22/system

14 Comments

  1. I love reading through an article that can make men and women think.
    Also, thank you for permitting me to comment!

  2. Wow, this article is good, my sister is analyzing these things,
    so I am going to tell her.

  3. Good day very nice site!! Guy .. Beautiful .. Wonderful ..

    I will bookmark your web site and take the feeds also?
    I am satisfied to search out a lot of helpful info right here within the post, we’d like work out more techniques in this regard, thank you for sharing.
    . . . . .

  4. Nice post. I was checking continuously this blog and I am impressed!
    Very helpful information specially the last part 🙂 I care for such info a lot.
    I was seeking this particular info for a very long time.
    Thank you and good luck.

  5. Thank you for any other wonderful article. The place else could anyone get that type
    of info in such a perfect approach of writing? I have a
    presentation next week, and I’m on the search for such information.

  6. Hello i am kavin, its my first time to commenting anywhere, when i read this post i thought i
    could also create comment due to this sensible paragraph.

  7. I have been browsing online more than 2 hours today, yet I never found any interesting article like yours.
    It is pretty worth enough for me. Personally, if all website owners and bloggers made good content as you did, the net will be a lot more useful than ever before.

  8. It’s an amazing article for all the internet visitors; they will
    obtain benefit from it I am sure.

  9. mkb mkb

    I always spent my half an hour to read this web site’s
    articles daily along with a cup of coffee.

  10. I’m extremely impressed with your writing skills as
    well as with the layout on your weblog. Is this a paid theme or did you customize it yourself?
    Anyway keep up the excellent quality writing, it is rare to see a nice blog like this
    one these days.

  11. Its like you read my mind! You seem to know so much about this, like you wrote
    the book in it or something. I think that you could do with some pics to drive
    the message home a little bit, but other than that, this is
    excellent blog. An excellent read. I’ll certainly be back.

发表评论

电子邮件地址不会被公开。