CentOS 8-libvirt 7 编译安装

基于CentOS 8 x86_64编译安装libvirt 7.2

1
2
3
4
5
6
7
8
#dnf --enablerepo=PowerTools install gcc cmake libxslt-devel
#dnf --enablerepo=PowerTools install meson rpcgen
#wget https://libvirt.org/sources/libvirt-7.2.0.tar.xz
#tar xvf libvirt-7.2.0.tar.xz
#cd libvirt-7.2.0
#meson build --prefix=/usr
#ninja -C build
#ninja -C build install
1
#libvirtd --version

启动测试

1
/usr/sbin/libvirtd --listen

报错

1
2
3
4
5
2021-09-28 04:27:03.665+0000: 41728: info : libvirt version: 7.2.0
2021-09-28 04:27:03.665+0000: 41728: info : hostname: openstack160.********
2021-09-28 04:27:03.665+0000: 41728: error : virNetTLSContextCheckCertFile:110 : Cannot read CA certificate '/etc/pki/CA/cacert.pem': No such file or directory

先临时修改了/etc/libvirt/libvirtd.conf 关闭tls
1
2
3
4
5
error: Failed to start domain 'instance-00000018'
error: can't connect to virtlogd: Failed to connect socket to '/var/run/libvirt/virtlogd-sock': No such file or directory

解决 :virtlogd &

Troubleshooting

  1. ERROR: Program ‘rpcgen portable-rpcgen’ not found
1
yum install rpcgen
  1. ERROR: Dependency “gnutls” not found, tried pkgconfig
1
yum install gnutls-devel
  1. ERROR: Dependency “libxml-2.0” not found, tried pkgconfig
1
yum install libxml2-devel
  1. ERROR: Problem encountered: XDR is required for remote driver
1
yum install libtirpc-devel
  1. meson.build:918:2: ERROR: Program ‘rst2html5 rst2html5.py rst2html5-3’ not found
    1
    pip3 install rst2html5
  2. ERROR: Dependency “libapparmor” not found, tried pkgconfig and cmake
    1
    2
    3
    wget https://rpmfind.net/linux/opensuse/distribution/leap/15.3/repo/oss/x86_64/libapparmor1-2.13.6-1.24.x86_64.rpm
    wget https://ftp.lysator.liu.se/pub/opensuse/distribution/leap/15.3/repo/oss/x86_64/libapparmor-devel-2.13.6-1.24.x86_64.rpm

  3. ERROR: C shared or static library ‘attr’ not found
    1
    dnf --enablerepo=powertools install libattr-devel
  4. ERROR: C shared or static library ‘audit’ not found
    1
    dnf --enablerepo=powertools install audit-libs audit-libs-devel
  5. ERROR: Dependency “bash-completion” not found, tried pkgconfig and cmake
    1
    dnf --enablerepo=powertools install bash-completion
  6. ERROR: C shared or static library ‘cap-ng’ not found
    1
    dnf --enablerepo=powertools install libcap-ng-devel
  7. ERROR: Dependency “libcurl” not found, tried pkgconfig and cmake
    1
    dnf --enablerepo=powertools install libcurl-devel
  8. ERROR: Dependency “libfuse glusterfs-api libiscsi libnl pcap-config libssh libssh2 netcf numa openwsman pciaccess readline libsasl2 libudev wireshark yajl” not found, tried pkgconfig and cmake
    1
    dnf --enablerepo=powertools install fuse-devel glusterfs-api-devel libiscsi-devel libnl3-devel libssh-devel libssh2-devel netcf-devel numactl-devel libwsman-devel libpciaccess-devel readline-devel cyrus-sasl-devel systemd-devel wireshark-devel yajl-devel