centos libvirtd升级的两种方法

linux系统突然宕机,找不到原因。于是查看/var/log/messages里面记录的系统log发现以下错误,虽然可能不是宕机的原因但是还是需要解决的:

Failed to start Virtualization daemon.
localhost systemd: Unit libvirtd.service entered failed state.
localhost systemd: libvirtd.service failed.

在网上查找解决方法大部分都是用以下方法进行更新库:

yum update libvirtd
systemctl restart libvirtd 

但是我发现yum update显示的是no package to update。于是只能手工进行更新了:

yum install gcc libnl-devel libxml2-devel yajl-devel device-mapper-devel libpciaccess-devel libnl3-devel netcf-devel numactl-devel
wget https://libvirt.org/sources/libvirt-4.0.0.tar.xz
xz -d libvirt-4.0.0.tar.xz
tar -xvf libvirt-4.0.0.tar
cd libvirt-4.0.0
./configure --prefix=/usr --localstatedir=/var  --sysconfdir=/etc --with-numactl
make
make install
ldconfig
systemctl restart libvirtd.service

然后通过virsh version查看版本是否更新成功:

Compiled against library: libvirt 4.0.0
Using library: libvirt 4.0.0
Using API: QEMU 4.0.0
error: failed to get the hypervisor version
error: internal error: Cannot find suitable emulator for x86_64

下面两行报错很有可能是因为qemu没有安装好,所以进行安装:

yum -y install gcc gcc-c++ automake libtool zlib-devel glib2-devel bzip2-devel libuuid-devel spice-protocol spice-server-devel usbredir-devel libaio-devel ceph-devel pixman-devel
yum install libaio-devel 

#spice相关
wget https://www.spice-space.org/download/releases/spice-protocol-0.12.13.tar.bz2
tar -jxvf spice-protocol-0.12.13.tar.bz2
cd spice-protocol-0.12.13
./configure --prefix=/usr --sysconfdir=/etc  --localstatedir=/var --libdir=/usr/lib64
make -j30
make install
yum install celt051-devel
wget https://www.spice-space.org/download/releases/spice-0.14.0.tar.bz2
tar -jxvf spice-0.14.0.tar.bz2
cd spice-0.14.0
mkdir build && cd build
./configure --prefix=/usr --sysconfdir=/etc  --localstatedir=/var --libdir=/usr/lib64
make -j30
make install
yum install qemu\*
systemctl restart libvirtd.service
virsh version

显示如下内容则表示成功:

Compiled against library: libvirt 4.0.0
Using library: libvirt 4.0.0
Using API: QEMU 4.0.0
Running hypervisor: QEMU 2.0.0

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章