centos8编译安装libvirt 7.6

本文档详细介绍了如何在CentOS7上编译并安装Libvirt 7.6.0。首先,从官方源获取源码,然后以root用户身份安装必要的依赖项,如libtirpc-devel、meson等。在编译过程中,可能遇到找不到rpc/rpc.h的问题,需要指定meson配置的include目录。通过yum安装缺失的软件包,例如rpcgen、python3-docutils、glib2-devel等。完成编译和安装后,确认libvirtd和virsh的版本是否更新。若出现问题,如缺少依赖,需按照提示安装相应的开发库。最后,可能需要重启终端使libvirtd版本生效。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

官方编译教程:https://libvirt.org/compiling.html
源码下载:<https://libvirt.org/sources/>

先进root用户(用sudo好像会出问题?)

sudo -s

安装依赖

yum install libtirpc-devel
meson configure --includedir /usr/include/tirpc/rpc/

libtirpc的rpc.h在/usr/include/tirpc/rpc/rpc.h,必须要手动告诉meson其目录位置,不然后面ninja -C build的时候会报错:rpc/rpc.h:没有那个文件或目录。

编译

yum install meson
meson build
ninja -C build
ninja -C build install

然后查看一下版本是不是更新了

virsh --version
libvirtd --version
7.6.0
libvirtd (libvirt) 7.6.0

我这里要重启一下终端libvirtd的版本才会变成最新的。

常见报错的处理

Program ‘rpcgen portable-rpcgen’ not found

yum install rpcgen

Program ‘rst2html5 rst2html5.py rst2html5-3’ not found

yum install python3-docutils

用pip3安装的rst2html5好像不行。

参考:https://www.mail-archive.com/libvirt-users@redhat.com/msg12432.html

Dependency “glib-2.0” not found

yum install glib2-devel

我这里如果是用普通用户跑的meson build就仍然报这个错,换成root用户就好了。

Dependency “gnutls” not found

yum install gnutls-devel

Dependency “libxml-2.0” not found

yum install libxml2-devel

Problem encountered: You must install the pciaccess module to build with udev

yum install libpciaccess-devel

rpc/rpc.h:没有那个文件或目录

yum install libtirpc-devel
meson configure --includedir /usr/include/tirpc/rpc/

好像要把源码目录删掉重新编译才行。

参考文献

Centos7.6 下编译安装 Libvirt 7.5
https://mesonbuild.com/Commands.html

评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值