spice客户端编译安装
spice的主要结构分为4部分:spice协议、客户端、服务端和客户机端。
- spice协议部分是其他三个组件的通信规范;
- 客户端负责从虚拟机中发送数据和传输数据,例如remoter-viewer。
- 服务端作为一个库,被虚拟机底层管理器使用,用于在spice协议下共享虚拟机;
- 客户机端是运行在虚拟机内的软件,保证spice的功能能够正常使用,例如QXL驱动和spice VD代理。
本文主要记录spice客户端的编译安装相关问题。
spice客户端安装准备
为了能够在普通的PC机上正常使用,以下的一些安装包是必须的:
Windows下
Windows的安装就不赘述了,没什么难度,双击安装就搞定了。
- virt-viewer Windows版:Win x64 MSI、Win x86 MSI
- UsbDK(用于USB重定向的工具包):UsbDK_1.0.21_x64.msi、UsbDK_1.0.21_x86.msi
linux下
- spice-protocol spice-protocol-0.12.15
- libusbredir usbredir-0.7.1
- spice-gtk spice-gtk-0.36
- virt-viewer virt-viewer-8.0
本文的安装环境为CentOS7虚拟机,本文记录从一个全新的CentOS开始。
安装流程
系统基本更新及查看
要保证spice的正常安装,要保证该客户端已经进行更新,并且已安装libvirt。
[root@test-spice ~]# yum update //系统内核更新
[root@test-spice ~]# yum install libvirt //安装libvirt
卸载原有的spice相关包
先查看系统中之前安装过哪些跟spice有关的包
[root@test-spice ~]# rpm -qa | grep spice
spice-glib-0.34-3.el7.x86_64
spice-vdagent-0.14.0-15.el7.x86_64
spice-server-0.14.0-2.el7.x86_64
spice-gtk3-0.34-3.el7.x86_64
把这4个包都卸载掉
[root@test-spice ~]# rpm -e --nodeps spice-gtk3
[root@test-spice ~]# rpm -e --nodeps spice-glib
[root@test-spice ~]# rpm -e --nodeps spice-server
[root@test-spice ~]# rpm -e --nodeps spice-vdagent
spice-protocol编译安装
三部曲(configure、make、make install)安装
[root@test-spice ~]# wget https://www.spice-space.org/download/releases/spice-protocol-0.12.15.tar.bz2
[root@test-spice ~]# tar -xvf spice-protocol-0.12.14.tar.bz2
[root@test-spice ~]# cd spice-protocol-0.12.14/
[root@test-spice spice-protocol-0.12.14]# ./configure --prefix=/usr/local //指定安装目录到/usr/local
[root@test-spice spice-protocol-0.12.14]# make
[root@test-spice spice-protocol-0.12.14]# make install
装好之后记得要把spice-protocol的环境变量引用添加到系统的环境变量中,安装其他东西的时候才能调用到。
[root@test-spice spice-protocol-0.12.14]# cp spice-protocol.pc /usr/lib64/pkgconfig
libusbredir编译安装
同上,下载编译安装
【划重点】装好之后把.pc文件拷入/usr/lib64/pkgconfig中。
spice-gtk编译安装
同上,方法不赘述,但是安装过程中遇到很多问题,在下一章进行记录。编译安装时的最终命令如下:
[root@test-spice spice-gtk-0.35]# ./configure --prefix=/usr/local --disable-opus --disable-shared
- 编译成功的汇总信息
configure:
Spice-Gtk 0.35
==============
prefix: /usr/local
c compiler: gcc -std=gnu99
Target: Unix
Gtk: 3.0
Coroutine: ucontext
PulseAudio: no
GStreamer Audio: no
GStreamer Video: no
SASL support: no
Smartcard support: no
USB redirection support: yes
DBus: yes
WebDAV support: no
LZ4 support: no
Now type 'make' to build spice-gtk
【划重点】装好之后把.pc文件拷入/usr/lib64/pkgconfig中
virt-viewer编译安装
安装完成spice-gtk之后,千万别忘了装virt-viewer,因为spice-gtk只提供一个远程桌面的访问功能,具体窗口显示还是由virt-viewer来提供。
[root@test-spice ~]# wget https://virt-manager.org/download/sources/virt-viewer/virt-viewer-8.0.tar.gz
[root@test-spice ~]# tar -xzf virt-viewer-8.0.tar.gz
[root@test-spice ~]# cd virt-viewer-8.0/
[root@test-spice ~]# ./configure --prefix=/usr/local
[root@test-spice ~]# make
[root@test-spice ~]# make install
安装完成就可以使用virt-viewer的命令来打开访问虚拟机了。
[root@test-spice ~]# remote-viewer
出现的问题及解决
- 在各个安装包安装过程中,配置时提示出现“***安装包not found”或者要求“**安装包要求版本 > 1.0等”,为系统yum安装此安装包或更高版本的安装包。下述举例提示"gtk3 >= 3.0.0"的解决方法。
[root@test-spice ~]# yum search gtk3 //有时候安装包的名称和提示的并不完全相同,先查找一下可安装的,安装对应需要的包
[root@test-spice ~]# yum install gtk3-devel.x86_64 //尽量都安装-devel的工具包
安装完成后,再次编译spice即可,如果出现别的缺少和依赖再继续yum instlal即可。
- spice-gtk配置报错:
checking for OPUS... no
configure: error: Opus could not be detected, explicitly use --disable-opus if that's intentional
configure: error: ./configure failed for spice-common
[解决方法]
[root@test-spice spice-gtk-0.35]# ./configure --prefix=/usr/local --disable-opus
- spice编译报错:
出现很多条relocation R_x86_64_32 against的提示。
/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/libcrypto.a(bio_asn1.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
[解决方法]
配置时禁用共享,再编译即可。
[root@test-spice spice-gtk-0.35]# ./configure --prefix=/usr/local --disable-opus --disable-shared
[root@test-spice spice-gtk-0.35]# make
- 关于报了其他ld的错误,可以尝试重新安装升级相关包。
本文出现了一条ld的问题,具体描述ssl相关函数undefined,通常出现undefined的问题主要是找不到相关工具文件。
[解决方法]
ssl的相关包主要是openssl,spice的传输调用openssl的相关传输加密。因此,仅安装openssl包无法满足spice的调用,需要安装open-devel包。
[root@test-spice spice-gtk-0.35]# yum install openssl-devel.x86_64
[root@test-spice spice-gtk-0.35]# make clean //清理之前编译生成的文件
openssl-devel安装成功后再重新编译安装即可。
本文详细记录了在CentOS7上编译安装spice客户端的过程,包括spice-protocol、libusbredir、spice-gtk和virt-viewer的安装步骤。在安装前需进行系统更新并确保libvirt已安装。安装过程中可能出现的依赖问题,如gtk3版本不足,可通过yum安装相应版本解决。此外,解决openssl相关函数undefined错误需要安装openssl-devel。所有组件安装完成后,可以通过virt-viewer访问虚拟机。

1567

被折叠的 条评论
为什么被折叠?



