Chinaunix首页 | 论坛 | 博客
  • 博客访问: 193807
  • 博文数量: 22
  • 博客积分: 1696
  • 博客等级: 上尉
  • 技术积分: 336
  • 用 户 组: 普通用户
  • 注册时间: 2010-09-06 21:22
文章分类

全部博文(22)

文章存档

2011年(4)

2010年(18)

分类: 虚拟化

2011-02-24 16:27:42

    好久好久没写东西了,人果然是会变得很懒很懒的...
    最近一直在跟虚拟化打交道,特别是装虚拟机这个。于是就强迫自己写了这么个东西!也是给自己留个纪念什么的~
一:检查机器虚拟化支持
    对于Kvm来说,必须要求CPU支持硬件虚拟化。二种方法查看:
  1. $ cat /proc/cpuinfo
  2. processor : 0
  3. vendor_id : GenuineIntel
  4. cpu family : 6
  5. model : 23
  6. model name : Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz
  7. stepping : 10
  8. cpu MHz : 2660.405
  9. cache size : 3072 KB
  10. physical id : 0
  11. siblings : 4
  12. core id : 0
  13. cpu cores : 4
  14. apicid : 0
  15. initial apicid : 0
  16. fdiv_bug : no
  17. hlt_bug : no
  18. f00f_bug : no
  19. coma_bug : no
  20. fpu : yes
  21. fpu_exception : yes
  22. cpuid level : 13
  23. wp : yes
  24. flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts aperfmperf pni dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority
  25. bogomips : 5320.81
  26. clflush size : 64
  27. cache_alignment : 64
  28. address sizes : 36 bits physical, 48 bits virtual
  29. power management:
    看到/proc/cpuinfo里面有vmx说明CPU支持硬件虚拟化,如果没有,那么...考虑换个CPU?毕竟现在SNB的都全线支持VT-x了~
    另外一种就更加Human了~
  1. $ lscpu
  2. Architecture: i686
  3. CPU op-mode(s): 32-bit, 64-bit
  4. CPU(s): 4
  5. Thread(s) per core: 1
  6. Core(s) per socket: 4
  7. CPU socket(s): 1
  8. Vendor ID: GenuineIntel
  9. CPU family: 6
  10. Model: 23
  11. Stepping: 10
  12. CPU MHz: 2660.405
  13. Virtualization: VT-x
  14. L1d cache: 32K
  15. L1i cache: 32K
  16. L2 cache: 3072K
    要是你没这个lscpu的话,自行Google吧,我是Fedora14...

二:安装Kvm包
    推荐使用Yum groupinstall:
  1. $ yum groupinfo 虚拟化
  2. 已加载插件:langpacks, presto, refresh-packagekit
  3. Adding zh_CN to language list
  4. 设置组进程

  5. 组:虚拟化
  6.  描述:这些软件包提供了一个虚拟化环境。
  7.  必要的软件包:
  8.    python-virtinst
  9.  默认的软件包:
  10.    libvirt
  11.    qemu-kvm
  12.    virt-manager
  13.    virt-viewer
  14.  可选的软件包:
  15.    virt-top
  16. # yum groupinstall -y 虚拟化
    装完一堆东西以后需要启动libvirtd这个服务:
  1. # service libvirtd start
  2. Starting libvirtd daemon:                                  [  OK  ]
三:安装Kvm虚拟机
    本来想自己写这一步的,觉得还是不够详细,还是贴上Man吧!原谅我偷懒...
  1.        Install a KVM guest (assuming proper host support), creating a
  2.        new storage file, virtual networking, booting from the host
  3.        CDROM, using VNC server/viewer.

  4.          # virt-install \
  5.               --connect qemu:///system \
  6.               --name demo \
  7.               --ram 500 \
  8.               --disk path=/var/lib/libvirt/images/demo.img,size=5 \
  9.               --network network=default,model=virtio \
  10.               --vnc \
  11.               --cdrom /dev/cdrom

  12.        Install a Fedora 9 plain QEMU guest, using LVM partition,
  13.        virtual networking, booting from PXE, using VNC server/viewer

  14.          # virt-install \
  15.               --connect qemu:///system \
  16.               --name demo \
  17.               --ram 500 \
  18.               --disk path=/dev/HostVG/DemoVM \
  19.               --network network=default \
  20.               --virt-type qemu
  21.               --vnc \
  22.               --os-variant fedora9

  23.        Install a guest with a real partition, with the default QEMU
  24.        hypervisor for a different architecture using SDL graphics,
  25.        using a remote kernel and initrd pair:

  26.          # virt-install \
  27.               --connect qemu:///system \
  28.               --name demo \
  29.               --ram 500 \
  30.               --disk path=/dev/hdc \
  31.               --network bridge=eth1 \
  32.               --arch ppc64 \
  33.               --sdl \
  34.               --location

  35.        Run a Live CD image under Xen fullyvirt, in diskless
  36.        environment

  37.          # virt-install \
  38.               --hvm \
  39.               --name demo \
  40.               --ram 500 \
  41.               --nodisks \
  42.               --livecd \
  43.               --vnc \
  44.               --cdrom /root/fedora7live.iso
  45.        Install a paravirtualized Xen guest, 500 MB of RAM, a 5 GB of
  46.        disk, and Fedora Core 6 from a web server, in text-only mode,
  47.        with old style --file options:

  48.          # virt-install \
  49.               --paravirt \
  50.               --name demo \
  51.               --ram 500 \
  52.               --file /var/lib/xen/images/demo.img \
  53.               --file-size 6 \
  54.               --nographics \
  55.               --location

  56.        Create a guest from an existing disk image ’mydisk.img’ using
  57.        defaults for the rest of the options.

  58.          # virt-install \
  59.               --name demo
  60.               --ram 512
  61.               --disk /home/user/VMs/mydisk.img
  62.               --import
    Linux的Man真是强悍...

阅读(4099) | 评论(0) | 转发(0) |
0

上一篇:Force core dump of a process

下一篇:没有了

给主人留下些什么吧!~~