一、KVM的编译安装

1、安装基本系统和开发工具

1.1 编译内核

mkdir /root/kvm

cd /root/kvm

wget http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.5.tar.gz

tar -zvxf linux-3.5.tar.gz -C /usr/src

cd /usr/src/linux-2.6.34.4

make menuconfig

vi .config

增加

CONFIG_SYSFS_DEPRECATED_V2=y

CONFIG_STP=m

CONFIG_BRIDGE=m

修改

CONFIG_STP=y

CONFIG_BRIDGE=y

make -j30 all

make modules_install

make install

1.2 安装kvm_mod

wget http://nchc.dl.sourceforge.net/project/kvm/kvm-kmod/3.5/kvm-kmod-3.5.tar.bz2

tar -jvxf kvm-kmod-3.5.tar.bz2

cd kvm-kmod-3.5

./configure

make && make install

reboot

1.3 确认kvm_kmod安装成功

lsmod | grep kvm

kvm_intel              40286  0

kvm                   266256  1 kvm_intel

如果你的系统是64位可以直接进行这一步,因为64位的ubuntu是自带kvm模块的

1.4 安装qemu-kvm

apt-get install -y libglib2.0-dev

cd /root/kvm

wget https://launchpad.net/ubuntu/+archive/primary/+files/qemu-kvm_1.0%2Bnoroms.orig.tar.gz

tar -zxf qemu-kvm-0.12.5.tar.gz

cd qemu-kvm-0.12.5

./configure –prefix=/usr/local/kvm  –disable-vnc-tls  –disable-vnc-sasl  –disable-curl   –enable-system  –static

make && make install

ln -s /usr/local/kvm/bin/qemu-img /usr/bin/qemu-img

ln -s /usr/local/kvm/bin/qemu-io /usr/bin/qemu-io

ln -s /usr/local/kvm/bin/qemu-nbd /usr/bin/qemu-nbd

ln -s /usr/local/kvm/bin/qemu-system-x86_64 /usr/bin/qemu

ln -s /usr/local/kvm/bin/qemu-system-x86_64 /usr/bin/kvm

ln -s /usr/local/kvm/bin/qemu-system-x86_64 /usr/bin/qemu-kvm

二、libvirt的编译安装

apt-get install -y libdevmapper libdevmapper-dev libgnutls-dev libxml2-dev libpciaccess-dev libudev-dev libnl-dev gnutls-bin

cd /root/kvm

wget https://launchpad.net/ubuntu/+archive/primary/+files/libvirt_1.0.2.orig.tar.gz

tar -zxf libvirt_1.0.2.orig.tar.gz

cd libvirt-1.0.2

./configure –prefix=/usr/local/libvirt –enable-debug=no –with-storage-lvm=no

make && make install

ln -s /usr/local/libvirt/bin/virsh /usr/bin/virsh

三、virtinst的编译安装

四、常见错误问题

问题一:configure: error: You must install the GnuTLS library in order to compile and run libvirt

解决方法:

Ubuntu:apt-get  install -y libgnutls-dev

问题二:

/usr/local/libvirt/sbin/libvirtd

19:49:56.942: error : virRunWithHook:857 : internal error 'brctl setfd virbr0 0' exited with non-zero status 1 and signal 0: libvir: error : cannot execute binary brctl: No such file or directory

19:49:56.982: warning : qemudStartup:1832 : Unable to create cgroup for driver: No such device or address

解决方法:

Ubuntu:apt-get install -y bridge-utils

问题三:

19:51:11.368: error : virRunWithHook:857 : internal error '/sbin/iptables –table filter –insert FORWARD –destination 192.168.122.0/255.255.255.0 –out-interface virbr0 –match state –state ESTABLISHED,RELATED –jump ACCEPT' exited with non-zero status 1 and signal 0: iptables: Unknown error 18446744073709551615

19:51:11.368: error : networkAddMasqueradingIptablesRules:637 : failed to add iptables rule to allow forwarding to 'virbr0': Invalid argument

19:51:11.420: warning : qemudStartup:1832 : Unable to create cgroup for driver: No such device or address

如果使用桥接网络独立IP可以忽略

问题四:

checking libxml2 xml2-config >= 2.6.0 … configure: error: Could not find libxml2 anywhere (see config.log for details).

解决方法:

Ubuntu: apt-get install -y libxml2-dev

问题五:

configure: error: You must install the GnuTLS library in order to compile and run libvirt

解决方法:

Ubunut: apt-get install -y gnutls-bin(可省)

apt-get install -y libgnutls-dev

问题六:

configure: error: You must install device-mapper-devel/libdevmapper >= 1.0.0 to compile libvirt

解决方法:

Ubunut:apt-get install -y libdevmapper-dev libdevmapper

问题七:

configure: error: libnl-devel >= 1.1 is required for macvtap support

解决方法:

Ubunut:apt-get install -y libnl-dev

问题八:

# ./configure –prefix=/usr –libdir=/usr/lib64 –localstatedir=/var –sysconfdir=/etc –with-hal=yes –with-udev=yes

checking for UDEV… no

configure: error: You must install libudev-devel >= 145 to compile libvirt

解决方法:

Ubunut: apt-get install -y libudev-dev

问题九:

configure: error: You must install libpciaccess-devel >= 0.10.0 to compile libvirt

解决方法:

Ubuntu: apt-get install -y libpciaccess-dev

问题十:

configure: error: You must install python-devel to build Python bindings

解决方法:

Ubuntu:apt-get install -y python-dev

sudo apt-get install python-dev

注:有时依然不能用virsh nodedev-dumpxml pci_0000_00_19_0

#./configure –prefix=/usr –libdir=/usr/lib64 –localstatedir=/var –sysconfdir=/etc –with-hal=yes –with-udev=yes –with-polkit=yes

….

checking for POLKIT… no

configure: error: You must install PolicyKit >= 0.6 to compile libvirt

# apt-get install libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 libpolkit-gtk-1-0

kvm编译安装及常见问题解决的更多相关文章

  1. git编译安装与常见问题解决

    1. 先去官网下载一个安装包 ,假设目录/APP/ido   2. cd /APP/ido   3. tar -zxvf git-2.7.2.tar.gz   4. 安装依赖 yum -y insta ...

  2. PHP编译安装时常见错误解决办法,php编译常见错误

    PHP编译安装时常见错误解决办法,php编译常见错误 1.configure: error: xslt-config not found. Please reinstall the libxslt & ...

  3. 编译安装Heartbeat常见错误

    -----------那些需要升级包还有少包的错误就不写了---------- <b>1</b>. Reusable-Cluster-Components-glue-glue- ...

  4. Lnmp 源码编译安装、常见错误整理

    简介: Lnmp 环境的搭建还是非常简单的,之前由于博客迁移等原因,导致丢失了好多博文,这次重新整理记录一下. Lnmp 即:Linux .Nginx .Mysql .PHP Lnmp 是一套 Web ...

  5. KVM简介,安装及常见使用详解

    KVM简介 KVM(名称来自英语:Kernel-basedVirtual Machine的缩写,即基于内核的虚拟机),是一种用于Linux内核中的虚拟化基础设施,可以将Linux内核转化为一个hype ...

  6. 7.2.*PHP编译安装时常见错误解决办法,php编译常见错误

    configure: error: Cannot find ldap.h   检查下面是不是已经安装,如果没有安装之:检查:yum list openldapyum list openldap-dev ...

  7. 【转】ubuntu源码编译安装php常见错误解决办法

    ./configure -prefix=/usr/local/php -with-config-file-path=/etc -with-mysql=mysqlnd -with-mysqli=mysq ...

  8. SVN安装及常见问题解决

    一.SVN简介 SVN作为以一种崛起的版本管理工具,是CVS的接班人.对于概念性的介绍我这里就不多赘述,网上很多介绍. 工作流程如下图: 二.安装 SVN的重要性就不再赘述,这里以Versionsv1 ...

  9. Linux下安装 TestLink常见问题解决方法

    Read/write permissions For security reason we suggest that directories tagged with [S] on following ...

随机推荐

  1. 前端过滤XSS攻击

    日常开发过程中,对于存在用户交互的一些门户网站等,过滤xss攻击是必不可少的. 此处主要记录下我在工作过程中的简单处理方法. 前端过滤XSS攻击, 我这里用的是开源工程 js-xss,官网地址:htt ...

  2. Android TV 模拟器启动

    模拟器启动错误 使用IntelCPU的模拟器 http://software.intel.com/en-us/android/articles/intel-hardware-accelerated-e ...

  3. IDEA SVN1.8 问题解决

    转自 http://blog.jetbrains.com/idea/2013/12/subversion-1-8-and-intellij-idea-13/

  4. iOS-NSSDate的使用

    取当前时间的秒数 NSTimeInterval time = [[NSDate date] timeIntervalSince1970];long long int date = (long long ...

  5. iOS打包ipa安装包的流程

    应用的发布也分两种 一种是.打包成ipa上传到国内第3方软件市场,当用户的手机已经JailBreak时,双击下载的ipa文件就可以安装软件 (ipa同android的apk包一样,实质是一个压缩包) ...

  6. iOS socket编程

    // // ViewController.m // socket // // Created by emerys on 16/3/2. // Copyright © 2016年 Emerys. All ...

  7. servlet的doPost 和doGet和web文件结构

    doPost和doGet分别由 tomcat自己来决定调用post 还是get 方式查询 get:url有少量的参数信息,一般用到查询那里 (像百度.. post一般用来提交大文件数据(二进制数据 d ...

  8. js登录页面的 回车事件

    js登录页面的 回车事件 js登录页面的 回车事件(2012-12-26 10:37:03)转载▼标签: jseventkey回车事件登录 分类: js.jquery  //回车事件 第一种docum ...

  9. php之购物车类思路及代码

    <?php /* 购物车类 1.整站范围内,购物车--全局有效 解决:把购物车的信息,放在session里 2.既然全局有效,购物车的实例只有一个 解决:单例模式 技术选型:session+单例 ...

  10. 干掉Google字体,WordPress速度暴涨

    2014年7月7日23:40:31 因为Google被墙,WordPress引用的Google字体总会加载很长时间,严重影响打开速度. 安装WordPress插件 Disable Google Fon ...