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

 

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