编译libvirt和qemu并打包
想在centos7上尝试高版本的libvirt和qemu,并打成RPM包安装。
步骤如下:
- 编译并打包libvirt
1.1 从源码编译,但是不打包
yum install gcc libnl-devel libxml2-devel yajl-devel device-mapper-devel libpciaccess-devel libnl3-devel netcf-devel numactl-devel
wget https://libvirt.org/sources/libvirt-4.0.0.tar.xz
xz -d libvirt-4.0.0.tar.xz
tar -xvf libvirt-4.0.0.tar
cd libvirt-4.0.0
./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --with-numactl
make
make install
ldconfig
systemctl restart libvirtd.service
除此以外,还可以制作rpm包使用yum工具安装。如下:
1.2 制作RPM包安装
将libvirt-4.0.0.tar.xz
放到/root/rpmbuild/SOURCES/libvirt-4.0.0.tar.xz
安装依赖:
yum install `rpmbuild -bb libvirt.spec 2>&1 | grep "needed" | awk '{print $1}'` -y
开始打包:
rpmbuild -bb libvirt.spec
然后在/root/rpmbuild/RPMS/x86_64
找到rpm包并安装。