Компиляция libvirt под Ubuntu 16.04

Компиляция libvirt

Установка необходимых пакетов

sudo apt update
sudo apt install git build-essential libtool autoconf pkg-config
sudo apt install libapparmor-dev libnl-3-dev libnl-route-3-dev libxml2-dev libcurl3-dev libudev-dev libyajl-dev xsltproc libdevmapper-dev libgnutls-dev libssh2-1-dev libfuse-dev libsasl2-dev libnuma-dev -y

Компиляция Libvirt

Создаем папки

mkdir -p ~/src
mkdir -p ~/src/build
cd ~/src

Компилируем libvirt

wget https://libvirt.org/sources/libvirt-3.10.0.tar.xz
tar xvf libvirt-3.10.0.tar.xz
cd libvirt-3.10.0
mkdir compile
cd compile
../configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu/libexec --with-qemu --with-lxc --with-vbox --with-dbus  --with-curl  --with-libxml --with-udev -with-storage-dir  --with-storage-fs --with-gnutls --with-ssh2 --with-fuse --with-polkit --with-numad --with-numactl --with-init-script=systemd --without-firewalld --with-apparmor --with-apparmor-profiles --with-sasl --without-selinux --disable-nls
make

Собираем deb пакет libvirt

mkdir -p ~/src/libvirt-install
fakeroot make install DESTDIR=~/src/libvirt-install
cd ~/src
fakeroot dpkg-deb --build ~/src/libvirt-install ~/src/build/libvirt-3.10.0-5ubuntu10.deb
md5sum -b ~/src/build/libvirt-3.10.0-5ubuntu10.deb > ~/src/build/libvirt-3.10.0-5ubuntu10.deb.md5

Устанавливаем libvirt

sudo aptitude install iptables ebtables numad apparmor-utils
sudo dpkg -i ~/src/build/libvirt-3.10.0-5ubuntu10.deb
sudo systemctl enable virtlogd.service
sudo systemctl enable virtlockd.service
sudo systemctl enable libvirtd.service
sudo systemctl start libvirtd.service

Проверим статус

sudo systemctl status libvirtd.service

Компиляция Libvirt glib 0.2.2

mkdir -p ~/src
cd ~/src
wget https://libvirt.org/sources/glib/libvirt-glib-0.2.2.tar.gz
tar xfv libvirt-glib-0.2.2.tar.gz
cd libvirt-glib-0.2.2
mkdir compile
cd compile
../configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu/libexecdir --with-python
make

Собираем deb пакет libvirt

mkdir -p ~/src/libvirt-glib-install
fakeroot make install DESTDIR=~/src/libvirt-glib-install
cd ~/src
fakeroot dpkg-deb --build ~/src/libvirt-glib-install ~/src/build/libvirt-glib-1.0-0_0.2.2-4ubuntu1.deb

Устанавливаем только что скомпилированный deb пакет:

sudo dpkg -i ~/src/build/libvirt-glib-1.0-0_0.2.2-4ubuntu1.deb

Сборка пакета python libvirt 3.10.0

wget https://pypi.python.org/packages/20/b3/d7e226a07efa1432a4dcf92b3baa0cf554241a7eecd8a654c23c2119b190/libvirt-python-3.10.0.tar.gz#md5=b75efebfa51ce268665298cce9aa0857 -O libvirt-python-3.10.0.tar.gz
tar xvf libvirt-python-3.10.0.tar.gz
cd libvirt-python-3.10.0
python setup.py bdist --format=gztar

Сборка DEB пакета

mkdir -p ~/src/libvirt-python-install
cd ~/src/libvirt-python-install
tar xvf ~/src/libvirt-python-3.10.0/dist/libvirt-python-3.10.0.linux-x86_64.tar.gz
fakeroot dpkg-deb --build ~/src/libvirt-python-install ~/src/build/python-libvirt_3.10.0-4ubuntu1.deb

Устанавливаем только что скомпилированный deb пакет: 

sudo dpkg -i ~/src/build/python-libvirt_3.10.0-4ubuntu1.deb