zoukankan      html  css  js  c++  java
  • openstack-KVM安装与使用

     

    一、KVM安装

    1、安装条件 

      VT-x

      BIOS

      Intel9R) Virtualization Tech [Enabled]

      cat /proc/cpuinfo | grep -e vmx -e nx -e svm

      grep vmx /proc/cpuinfo

      grep svm /proc/cpuinfo

      egrep '(vmx|svm)' /proc/cpuinfo

    2、模块

      lsmod | grep kvm_intel    (查看模块)

      modprobe -r kvm_intel    (卸载模块)

      modprobe kvm_intel       (加载模块)

    3、安装系统和软件

      yum install kvm virt-manager libvirt libvirt-python python-virtinst libvirt-client qemu-kvm qemu-img -y

      yum install kvm virt-manager libvirt* -y

      yum install qemu-kvm libvirt virt-install virt-manager -y

      yum install spice-protocol spice-client spice-server -y

           上述命令等同如下命令:

      yum install qemu-kvm* virt-* libvirt* -y

      yum install spice* -y

      启动服务:

      systemctl start libvirtd

      systemctl status libvirtd

      systemctl enable libvirtd

    4、验证安装

      virsh -c qemu:///system list

    5、透传

      KVM on KVM(虚拟机里安装虚拟机)

    Vmware

    2

    物理

    软件

    KVM

    N

    物理

    物理

      modprobe -r kvm_intel    (卸载模块)

      modprobe kvm_intel nested=1      (开启透传)

      echo -e "options kvm_intel nested=1" > /etc/modprobe.d/kvm-nested.conf

      cat /sys/module/kvm_intel/parameters/nested

    二、KVM使用

      1、镜像管理

      qemu-img create -f qcow2 /var/lib/libvirt/images/os.qcow2 10G

      qemu-img resize os.qcow2 +2G

      qemu-img convert os.qcow2 vmware.vmdk

      qemu-img info vmware.vmdk

    2、安装虚拟机

    #创建磁盘,指定大小20G
    qemu-img create -f qcow2 /var/lib/libvirt/images/chen2.qcow2 20G
    #进入字符安装
    virt-install 
    --connect qemu:///system  
    --name chen2 
    --memory 4096 
    #指定CPU信息(选择第2,3条即可)
    --cpu host 
    --cpu host-passthrough 
    --vcpus 2,maxvcpus=2,sockets=2,cores=1,threads=1 
    #指定磁盘信息(选择第2条即可)
    --disk size=8 
    --disk path=/var/lib/libvirt/images/chen2.qcow2 
    --disk /var/lib/libvirt/images/chen2.qcow2,size=2,format=qcow2,bus=virtio,sparse 
    #指定安装系统的镜像文件所在位置(选择第2条即可)
    --cdrom CentOS-7-x86_64-Minimal-1708.iso 
    --location /var/lib/libvirt/images/CentOS-7-x86_64-DVD-1804.iso 
    --location http://example.com/path/to/os 
    #设置操作系统信息
    --os-type linux 
    --os-variant rhel7 
    --accelerate 
    #指定网络方式(选择第2条即可)
    --network bridge=virbr0 
    --network bridge=br0 
    #指定安装系统的类型(字符终端)
    --graphics none 
    --console pty,target_type=serial 
    --extra-args 'console=ttyS0,115200n8 serial'

     

  • 相关阅读:
    VMware Workstation 卸载时卡在“正在卸载网络驱动程序(Virtual Network Editor夯死)”
    Windows 开启 winrm
    【Git】error: RPC failed; HTTP 413 curl 22 The requested URL returned error:413 Request Entity Too Large
    tricks
    MySQL 5.7原生通用二进制格式安装包安装过程
    WebSnapshotsHelper(HTML转换为图片)
    使用两个zTree,调用一个onCheck函数,分别展开不同的节点
    修改Sql Server字段类型
    添加一条公告并标记为已读
    优化部门人员加载缓慢
  • 原文地址:https://www.cnblogs.com/chenli90/p/10347809.html
Copyright © 2011-2022 走看看