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:
-
Centos 7.6 下编译安装 Libvirt 7.5
https://blog.frytea.com/archives/546/
-
libvirt安装_toronto2016的博客-CSDN博客_libvirt 安装
https://blog.csdn.net/toronto2016/article/details/49113909/
-
meson+ninja环境搭建
https://blog.csdn.net/rikeyone/article/details/108706974
-
Linux上启用kvm嵌套虚拟化功能
https://blog.csdn.net/qq_36885515/article/details/123137091
-
手动编译安装 KVM 就是找虐,万幸我还活着!
https://zhuanlan.zhihu.com/p/474084892
-
centos7手动编译安装Libvirt常见问题
http://blog.chinaunix.net/uid-31410005-id-5771894.html
-
华为鲲鹏BoostKit虚拟化使能套件升级文档
https://support.huaweicloud.com/instg-kunpengcpfs/kunpengkvm_03_0006.html
-
国内yum源的安装(163,阿里云,epel)
http://t.zoukankan.com/f66666-p-9834835.html
-
Libvirt官方下载
https://libvirt.org/sources/
-
Failed to connect socket to '/var/run/libvirt/libvirt-sock’的问题解决
http://www.javashuo.com/article/p-wfpilssg-nw.html