Centos7-Libvirt7.0安装

Centos7 - Libvirt7.0 安装

最新版的 Libvirt 7.0 不能够通过 yum 安装,并且还需要使用较新的 meson & ninja 工具。因此过程十分繁琐,网上其他帖子中递归解决了各种各样的问题。经过我的不断尝试总结,在此发布一篇“最简单”、“最快捷”的Libvirt 7.0 安装教程!

请注意安装过程中一定保证各个组件严格符合以下版本号:

QEMU    : 4.0.0
Python  : 3.6.8
meson   : 0.61.5
ninja   : 1.10.2
libvirt : 7.0.0 

一、为 yum 添加阿里源

sudo curl -o /etc/yum.repos.d/CentOS-ali.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache

二、升级 QEMU 到 4.0.0

# download and unzip
yum -y install glib2-devel zlib-devel pixman-devel libaio-devel
curl -o /usr/local/src/libvirt/qemu-4.0.0.tar.xz https://download.qemu.org/qemu-4.0.0.tar.xz
tar -xvf /usr/local/src/libvirt/qemu-4.0.0.tar.xz -C /usr/local/src/libvirt/

# configure
(cd /usr/local/src/libvirt/qemu-4.0.0; ./configure --target-list=x86_64-softmmu --enable-linux-aio)

# make & install
(cd /usr/local/src/libvirt/qemu-4.0.0; make && make install)

# add lib path
echo -e "
include /usr/local/lib" | tee -a /etc/ld.so.conf

# enable lib path config
ldconfig

# 检查版本
qemu-img --version

三、为 yum 添加 epel 源

yum -y install epel-release

四、使用 yum 安装 Python3.6

yum -y install python3
python3 --version

五、安装 edk2

curl -o /etc/yum.repos.d/firmware.repo https://www.kraxel.org/repos/firmware.repo
yum -y install edk2.git-aarch64

六、使用 yum 安装大量依赖

yum -y install libxml2-devel readline-devel ncurses-devel libtasn1-devel gnutls-devel libattr-devel libblkid-devel augeas systemd-devel libpciaccess-devel yajl-devel sanlock-devel libpcap-devel libnl3-devel libselinux-devel dnsmasq radvd cyrus-sasl-devel libacl-devel parted-devel device-mapper-devel xfsprogs-devel librados2-devel librbd1-devel glusterfs-api-devel glusterfs-devel numactl-devel libcap-ng-devel fuse-devel netcf-devel libcurl-devel audit-libs-devel systemtap-sdt-devel libtirpc-devel nfs-utils dbus-devel scrub numad

yum -y install libvirt-client

七、安装 meson & ninja

pip3 install meson
ln -s /usr/local/bin/meson /usr/bin/meson
meson --version
yum -y install ninja-build
ninja --version

八、下载 Libvirt 7.0

curl -o /usr/local/src/libvirt/libvirt-7.0.0.tar.xz https://libvirt.org/sources/libvirt-7.0.0.tar.xz

tar -xvf /usr/local/src/libvirt/libvirt-7.0.0.tar.xz -C /usr/local/src/libvirt/

九、安装

需要先安装 rst2html5 使用 meson build 一次后再卸载,重新 wipe and build。来达到“欺骗”meson 的目的,不然转换时会出现大量的生成错误,需要手动修改,十分繁琐。

pip3 install rst2html5
(cd /usr/local/kubeiaas/libvirt/libvirt-7.0.0; meson build --prefix=/usr)

pip3 uninstall -y rst2html5
(cd /usr/local/kubeiaas/libvirt/libvirt-7.0.0; meson build --wipe --prefix=/usr)

(cd /usr/local/kubeiaas/libvirt/libvirt-7.0.0; ninja -C build)
(cd /usr/local/kubeiaas/libvirt/libvirt-7.0.0; ninja -C build install)

systemctl daemon-reload
systemctl restart libvirtd

十、检查安装是否成功

virsh --version
virsh version

References:

  1. Centos 7.6 下编译安装 Libvirt 7.5

    https://blog.frytea.com/archives/546/

  2. libvirt安装_toronto2016的博客-CSDN博客_libvirt 安装

    https://blog.csdn.net/toronto2016/article/details/49113909/

  3. meson+ninja环境搭建

    https://blog.csdn.net/rikeyone/article/details/108706974

  4. Linux上启用kvm嵌套虚拟化功能

    https://blog.csdn.net/qq_36885515/article/details/123137091

  5. 手动编译安装 KVM 就是找虐,万幸我还活着!

    https://zhuanlan.zhihu.com/p/474084892

  6. centos7手动编译安装Libvirt常见问题

    http://blog.chinaunix.net/uid-31410005-id-5771894.html

  7. 华为鲲鹏BoostKit虚拟化使能套件升级文档

    https://support.huaweicloud.com/instg-kunpengcpfs/kunpengkvm_03_0006.html

  8. 国内yum源的安装(163,阿里云,epel)

    http://t.zoukankan.com/f66666-p-9834835.html

  9. Libvirt官方下载

    https://libvirt.org/sources/

  10. Failed to connect socket to '/var/run/libvirt/libvirt-sock’的问题解决

    http://www.javashuo.com/article/p-wfpilssg-nw.html

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值