一、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. Solaris用户管理(一):用户与组管理

    Solaris用户管理(一):用户与组管理  2008-07-01 09:19 用户管理是系统管理的基础.Solaris中不但支持传统Unix所支持的用户和组的概念,还从Solaris 8开始引入了基 ...

  2. Windows7添加SSD硬盘后重启卡住正在启动

    楼主办公电脑,原来只配置了一块机械硬盘,用着总很不顺心,于是说服领导给加了块SSD固态硬盘. 操作如下: 1.在PE下分区格式化新固态硬盘,将原来机械硬盘的C盘GHOST备份后还原到新固态硬盘: 2. ...

  3. JavaScript HTML DOM 元素(节点)

    JavaScript HTML DOM 元素(节点) 创建新的 HTML 元素 创建新的 HTML 元素 如需向 HTML DOM 添加新元素,您必须首先创建该元素(元素节点),然后向一个已存在的元素 ...

  4. jquery获取form表单内容以及绑定数据到form表单

    在日常开发的过程中,难免会用到form表单,我们需要获取表单的数据保存到数据库,或者拿到后台的一串json数据,要将数据绑定到form表单上,这里我写了一个基于jquery的,formHelp插件,使 ...

  5. css编译工具Sass中混合宏,继承,占位符分别在什么时候使用

    //SCSS中混合宏使用 @mixin mt($var){ margin-top: $var; } .block { @include mt(5px); span { display:block; @ ...

  6. ng的数据绑定

    ng创建了一个自己的事件循环,当浏览器事件(常用的dom事件,xhr事件等)发生时,对DOM对应的数据进行检查,若更改了,则标记为脏值,并进入更新循环,修改对应的(可能是多个) DOM的参数.这样就实 ...

  7. JavaScript中document.cookie

    “某些 Web 站点在您的硬盘上用很小的文本文件存储了一些信息,这些文件就称为 Cookie.”—— MSIE 帮助.一般来说,Cookies 是 CGI 或类似,比 HTML 高级的文件.程序等创建 ...

  8. Python自动化运维之25、Ajax

    一.概述 对于WEB应用程序:用户浏览器发送请求,服务器接收并处理请求,然后返回结果,往往返回就是字符串(HTML),浏览器将字符串(HTML)渲染并显示浏览器上. 通过在后台与服务器进行少量数据交换 ...

  9. go bufio

    1 bufio 读结构 type Reader struct {    buf          []byte     // 缓冲区    rd           io.Reader // read ...

  10. hibernate 多对一的情况

    <?xml version="1.0" encoding="GBK"?> <!DOCTYPE hibernate-mapping PUBLIC ...