客户端通过spice-gtk实现USB重定向

时间:2021-12-17 08:30:42

1.安装必要的工具:

sudo apt-get install build-essential autoconf git-core intltool

2.安装必要的依赖包:

sudo apt-get install libtool liblog4cpp5-dev libavcodec-dev libssl-dev xlibmesa-glu-dev libasound-dev libpng12-dev libfreetype6-dev libfontconfig1-dev libogg-dev libxrandr-dev kvm libgcrypt-dev libsdl-dev libnss3-dev libpixman-1-dev libxfixes-dev libjpeg8-dev libsasl2-dev python-pyparsing gtk+-3.0 libusb-1.0-0 libusb-1.0-0-dev libgudev-1.0-dev libspice-client-gtk-3.0-dev python-gtk2-dev

3.安装smart card readers库:

git clone git://people.freedesktop.org/~alon/libcacard
cd libcacard
./autogen.sh
make
sudo make install
cd ..

4.安装celt(0.5.1.3):不要安装最新版本的,最新版本的不支持,已经试过了。

wget http://downloads.us.xiph.org/releases/celt/celt-0.5.1.3.tar.gz
tar xvzf celt-0.5.1.3.tar.gz
cd celt-0.5.1.3/
./configure
make
sudo make install
cd ..

5.安装usbredir(最新版本):

wget http://spice-space.org/download/usbredir/usbredir-0.6.tar.bz2
tar xjvf usbredir-0.6.tar.bz2
cd usbredir-0.6
sudo ./configure
sudo make
sudo make install

6.编译spice-gtk(最新版本):

wget -c http://spice-space.org/download/gtk/spice-gtk-0.25.tar.bz2
tar xjvf spice-gtk-0.25.tar.bz2
cd spice-gtk-0.25
sudo ./configure --with-gtl=3.0 --enable-usbdir=yes --enable-usbredir=yes --enable-smartcard=yes --with-python=yes
sudo make  
sudo make install

7.编译virt viewer

wget -c http://virt-manager.org/download/sources/virt-viewer/virt-viewer-0.6.0.tar.gz
tar xzvf virt-viewer-0.6.0.tar.gz 
cd virt-viewer-0.6.0
sudo ./configure --with-gtk=3.0 --with-spice-gtk
sudo make
sudo make install

sudo ./remote-viewer, 使用sudo执行remote-viewer,因为要操作USB,需要超级用户权限。

如果顺利,执行remote-viewer后,可在file菜单下看到 “USB device selection” 选项。