设为首页 收藏本站
查看: 908|回复: 0

[经验分享] xen 和kvm

[复制链接]
YunVN网友  发表于 2015-4-10 16:23:20 |阅读模式
XEN 只安装了部分,后来夭折了,kvm安装成功!
[iyunv@localhost ~]# wget http://bits.xensource.com/oss-xen/release/4.1.3/xen-4.1.3.tar.gz

[iyunv@localhost ~]# tar xvf xen-4.1.3.tar.gz
[iyunv@localhost ~]# cd xen-4.1.3
[iyunv@localhost xen-4.1.3]# make xen tools stubdom
Error: zlib check failed
Make sure to have the zlib libs and headers installed.
make[1]: *** [ioemu-dir-find] Error 1
make[1]: Leaving directory `/root/xen-4.1.3/tools'
make: *** [tools/ioemu-dir] Error 2
[iyunv@localhost ~]# yum groupinstall "Development Tools"
[iyunv@localhost ~]# yum install hmaccalc ncurses-devel zlib-devel openssl-devel python-devel
[iyunv@localhost ~]# yum install bridge-utils  libtool-ltdl xorg-x11-drv-evdev xorg-x11-drv-fbdev
[iyunv@localhost ~]# yum install xorg-x11-drv-i810-devel xorg-x11-drv-via-devel xorg-x11-proto-devel
[iyunv@localhost ~]# yum install xorg-x11-server-sdk xorg-x11-xtrans-devel libuuid-devel
[iyunv@localhost ~]# yum install readline-devel gcc gcc-gfortran gcc-c++ flex pcre-devel
[iyunv@localhost ~]# yum install blas-devel lapack-devel curl-devel bison gperf gnuplot
[iyunv@localhost ~]# yum install texinfo-tex tetex-dvips
[iyunv@localhost xen-4.1.3]# yum install iasl
[iyunv@localhost xen-4.1.3]# yum install dev86.x86_64
桥接
[iyunv@localhost ~]# yum  install libvirt
[iyunv@localhost xen-4.1.3]# make xen tools stubdom
[iyunv@localhost xen-4.1.3]# make install-xen install-tools install-stubdom
[iyunv@localhost xen-4.1.3]# chkconfig --add xend
[iyunv@localhost xen-4.1.3]# chkconfig --add xencommons
[iyunv@localhost xen-4.1.3]# chkconfig --add xendomains
[iyunv@localhost xen-4.1.3]# chkconfig xend on
[iyunv@localhost xen-4.1.3]# chkconfig xendomains on
[iyunv@localhost xen-4.1.3]# chkconfig xencommons on
[iyunv@localhost ~]# tar jxvf linux-3.1.2.tar.bz2
[iyunv@localhost ~]# cd linux-3.1.2
[iyunv@localhost linux-3.1.2]# make menuconfig
Processor type and features  --->
] Paravirtualized guest support  --->      
Device Drivers  --->   
Xen driver support  --->   
  • Xen memory balloon driver  
  •    Scrub pages before returning them to system   
    Xen /dev/xen/evtchn device   
  • Backend driver support (NEW)  
    Xen filesystem   
  •    Create compatibility mount point /proc/xen   
  • Create xen entries under /sys/hypervisor  
    userspace grant access device driver   


    [iyunv@localhost linux-3.1.2]# make -j6
    [iyunv@localhost linux-3.1.2]# make -j6 modules
    [iyunv@localhost linux-3.1.2]# make -j6 modules_install
    [iyunv@localhost linux-3.1.2]# make -j6 install
    [iyunv@localhost ~]# more /boot/grub/grub.conf
    # grub.conf generated by anaconda
    #
    # Note that you do not have to rerun grub after making changes to this file
    # NOTICE:  You do not have a /boot partition.  This means that
    #          all kernel and initrd paths are relative to /, eg.
    #          root (hd0,0)
    #          kernel /boot/vmlinuz-version ro root=/dev/sda1
    #          initrd /boot/initrd-[generic-]version.img
    #boot=/dev/sda
    default=0
    timeout=5
    splashimage=(hd0,0)/boot/grub/splash.xpm.gz
    hiddenmenu
    title CentOS (3.1.2)
    root (hd0,0)
    kernel /boot/xen.gz
    module /boot/vmlinuz-3.1.2 ro root=UUID=403a6c34-e2a0-4a57-9e75-83bc0e0453b7 rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us LANG=en
    _US.UTF-8 nomodeset crashkernel=auto rhgb quiet rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_DM rhgb quiet
    module /boot/initramfs-3.1.2.img
    title CentOS (2.6.32-279.el6.x86_64)
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.32-279.el6.x86_64 ro root=UUID=403a6c34-e2a0-4a57-9e75-83bc0e0453b7 rd_NO_LUKS  KEYBOARDTYPE=pc KEY
    TABLE=us LANG=en_US.UTF-8 nomodeset crashkernel=auto rhgb quiet rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_
    DM rhgb quiet
    initrd /boot/initramfs-2.6.32-279.el6.x86_64.img
    [iyunv@localhost ~]# xm list
    Name                                        ID   Mem VCPUs      State   Time(s)
    Domain-0                                     0 31687    12     r-----     45.2
    [iyunv@localhost ~]# xm info
    host                   : localhost.localdomain
    release                : 3.1.2
    version                : #1 SMP Thu Jul 17 18:30:44 CST 2014
    machine                : x86_64
    nr_cpus                : 12
    nr_nodes               : 1
    cores_per_socket       : 6
    threads_per_core       : 2
    cpu_mhz                : 2000
    hw_caps                : bfebfbff:2c100800:00000000:00003f40:13bee3ff:00000000:00000001:00000000
    virt_caps              : hvm hvm_directio
    total_memory           : 32722
    free_memory            : 1088
    free_cpus              : 0
    xen_major              : 4
    xen_minor              : 1
    xen_extra              : .3
    xen_caps               : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
    xen_scheduler          : credit
    xen_pagesize           : 4096
    platform_params        : virt_start=0xffff800000000000
    xen_changeset          : unavailable
    xen_commandline        :
    cc_compiler            : gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
    cc_compile_by          : root
    cc_compile_domain      :
    cc_compile_date        : Thu Jul 17 18:10:12 CST 2014
    xend_config_format     : 4
    [iyunv@localhost ~]# yum install httpd
    [iyunv@localhost ~]# service httpd start
    [iyunv@localhost ~]# mount -o loop CentOS-6.3-x86_64-bin-DVD1.iso /var/www/html/iso/
    [iyunv@localhost ~]# yum install virt-viewer
    virt-install --name=node001 --ram=2048 --vcpus=2 --file=/data/xuni1/xuni.img --vnc --os-type=linux --file-size=30 --location=http://192.168.1.219/CentOS-6.3-x86_64-bin-DVD1.iso

    grep -E '(vmx|svm)' /proc/cpuinfo
    [iyunv@localhost ~]# yum install bridge-utils


    [iyunv@localhost ~]# grep -E -o 'vmx|svm' /proc/cpuinfo
    vmx
    vmx
    vmx
    vmx
    vmx
    vmx
    vmx
    vmx
    vmx
    vmx
    vmx
    vmx
    KVM安装
    [iyunv@localhost ~]# yum install kvm kmod-kvm qemu kvm-qemu-img virt-viewer
    [iyunv@localhost ~]# lsmod | grep kvm
    kvm_intel              52570  0
    kvm                   314739  1 kvm_intel
    [iyunv@localhost ~]# virsh -c qemu:///system list
    error: internal error Unable to locate libvirtd daemon in /usr/sbin (to override, set $LIBVIRTD_PATH to the name of the libvirtd binary)
    error: failed to connect to the hypervisor
    [iyunv@localhost ~]# yum install libvirt
    [iyunv@localhost ~]# virsh -c qemu:///system list
    error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory
    error: failed to connect to the hypervisor
    [iyunv@localhost ~]# /etc/init.d/libvirtd start
    Starting libvirtd daemon: [  OK  ]
    [iyunv@localhost ~]# virsh -c qemu:///system list
    Id    Name                           State
    ----------------------------------------------------
    [iyunv@localhost ~]# chkconfig libvirtd on
    安装桥接管理工具
    [iyunv@localhost ~]# yum install bridge-utils tunctl
    [iyunv@localhost data]# mkdir -p /data/xuni001
    [iyunv@localhost data]# cd /data/xuni001/
    #[iyunv@localhost ~]# virt-install --connect qemu:///system --name centos6.3 --ram 1024 --vcpus=2 --disk path=/data/xuni001/xuni.img,cache=writeback,size=10 --cdrom=/root/CentOS-6.3-x86_64-bin-DVD1.iso --os-type=linux --accelerate --network bridge=virbr0 --hvm --os-variant=rhel6
    命令行中安装虚拟机没有安装成功,后来是在图形界面操作下安装上的,没有截图


    virsh -c qemu:///system list

    virsh start centos6.3
    virsh shutdown centos6.3
    virsh autostart centos6.3

    [iyunv@localhost ~]# brctl addbr br0
    [iyunv@localhost ~]# brctl addif br0  em1
    ifconfig br0 192.168.1.220
    [iyunv@localhost ~]# yum install virt-manager

    开机自启动
    [iyunv@localhost ~]#  virsh autostart xuni001
    strace -p

    virsh list 列出当前虚拟机列表,不包括未启动的
    virsh list --all 列出所有虚拟机,包括所有已经定义的虚拟机
    virsh start domain-name 启动指定虚拟机
    virsh shutdown domain-name 停止指定虚拟机
    virsh reboot domain-name 重新启动指定虚拟机
    virsh autostart domain-name 指定虚拟机开机自动启动
      

  • 运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
    2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
    3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
    4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
    5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
    6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
    7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
    8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

    所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-55763-1-1.html 上篇帖子: [转] KVM I/O slowness on RHEL 6 下篇帖子: [zz]kvm-libvirt的使用:创建虚拟机与快照
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    扫码加入运维网微信交流群X

    扫码加入运维网微信交流群

    扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

    扫描微信二维码查看详情

    客服E-mail:kefu@iyunv.com 客服QQ:1061981298


    QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


    提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


    本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



    合作伙伴: 青云cloud

    快速回复 返回顶部 返回列表