取用libvirt的包:http://libvirt.org/sources/
libvirt的参考地址:http://libvirt.org/downloads.html
安装libvirt的参考步骤:http://liuzhijun.iteye.com/blog/1728617
正确安装libvirt的前提是要有如下依赖包:gcc、make、pkg-config、libxml2-dev、libgnutls-dev、libdevmapper-dev、libcurl4-gnutls(xen)、python-dev(可能早期版本还需要libyajl-dev)
./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc
configure附上参数可以完成覆盖原有libvirt
第一阶段:
以下操作都是在root模式下使用
Ubuntu缺省情况下,没有提供C/C++的编译环境,所以还需手动安装如下包
sudo apt-get install build-essential
./configure
error: Could not find libxml2 anywhere
apt-get install libxml2 libxml2-dev
error: You must install the GnuTLS library in order to compile and run libvirt
apt-get install gnutls-bin libgnutls-dev
error: You must install device-mapper-devel/libdevmapper >= 1.0.0 to compile libvirt
apt-get install libdevmapper1.02.1 libdevmapper-dev
error: You must install python-devel to build Python bindings
因为libvirt1.0.0中包含有支持python 的库
apt-get install python-dev
apt-get install libnl-dev
安装完libnl-dev后还是报同样的错误,我们安装pkg-config 修改一下以安装的libnl-devel的版本
apt-get install pkg-config
pkg-config --modversion libnl-1
第二阶段:
有一种可能就是系统第一次在/usr/local下手动编译安装程序,执行ldconfig命令更新动态链接库缓存
又出现不一样的错
error: Failed to reconnect to the hypervisor
error: no valid connection
error: Failed to connect socket to '/usr/local/var/run/libvirt/libvirt-sock': No such file or directory
查看libvirt进程是否启动? ps -le | grep libvirt* 如果没有启动,那么上面的错误就是这个原因
现在启动libvirt进程 libvirtd -d
现在检查是否安装成功 virsh version ,出现版本 1.0.0 安装成功。
第三阶段:
error: this function is not supported by the connection driver: NUMA memory information not available on this platform
安装
apt-get install libnuma1 libnuma-dev
加上配置的启动:/usr/local/sbin/libvirtd -d --listen --config /usr/local/etc/libvirt/libvirtd.conf