SPICE在ubuntu上的实现。

SPICE安装与使用指南
本文档详细介绍了SPICE协议的安装步骤及依赖项配置,适用于64位Ubuntu 10.04系统。SPICE为虚拟机提供高质量的远程访问体验,包括服务器端和客户端的编译安装流程,以及如何启动和连接SPICE会话。

SPICE的安装过程,参照:http://docs.cslabs.clarkson.edu/wiki/SPICE的介绍,依赖包中。应该另外安装libjpeg-dev包。

 

Overview

SPICE is a protocol that allows for high-quality virtual machine access using VDI over a network. It could be used as a communication layer between thin clients and their associated virtualized operating systems, or it could be used as it is in the COSI lab for normal machines to have quick access to a variety of different operating systems, or in any other configuration where it is better for a virtual machine to be running remotely.

SPICE on Ubuntu

As SPICE is under development by Red Hat, binary packages are rpm-based. However, it is possible to run both the SPICE server and client on 64-bit Ubuntu machines, if they are compiled from source. There are several dependencies that must be installed before SPICE can be compiled; dependencies not already available in the standard Ubuntu repositories must also be compiled from source. Please follow the instructions below to compile the SPICE server and client.

These instructions are for installing SPICE 0.6 on 64-bit Ubuntu 10.04. It is not possible to install a SPICE server on any 32-bit system due to its reliance on 64-bit atomic operations, and the process for installing just the client on 32-bit systems no longer appears to be supported.

Please direct comments or questions about this guide to Mark Platek.

Initial set-up

Some standard tools are required:

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

Also, install some dependencies from the repositories:

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

Finally, create a directory to compile from and descend into it:

mkdir spice-sources
cd spice-sources

Installing Dependencies

Spice protocol headers

The first dependency to install is the spice protocol headers.

wget http://spice-space.org/download/releases/spice-protocol-0.6.0.tar.gz
tar xvf spice-protocol-0.6.0.tar.gz
cd spice-protocol-0.6.0/
./configure
make
sudo make install
cd ..

qpixman and pixman

SPICE requires a special version of pixman unavailable in the Ubuntu repositories. It is available from the SPICE homepage.

wget http://spice-space.org/download/stable/qpixman-0.13.3-git20090127.tar.bz2
tar xvf qpixman-0.13.3-git20090127.tar.bz2
cd qpixman-0.13.3-git20090127/
./autogen.sh -includedir=/usr/include --libdir=/usr/lib64
make
sudo make install
cd ..

We must also install a newer version of the normal pixman library, available from the SPICE project's git repository.

git clone git://anongit.freedesktop.org/pixman
cd pixman/
./autogen.sh --includedir=/usr/include --libdir=/usr/lib64
make
sudo make install
cd ..

celt

SPICE requires a specific version of the celt audio codec (0.5.1.3). Since it is unavailable in the Ubuntu repositories, it must also be compiled.

wget http://downloads.us.xiph.org/releases/celt/celt-0.5.1.3.tar.gz
tar xvf celt-0.5.1.3.tar.gz
cd celt-0.5.1.3/
./configure --includedir=/usr/include --libdir=/usr/lib64
make
sudo make install
cd ..

qcairo

SPICE requires a modified version of the cairo graphics library, named qcairo. Sources are available on the spice homepage.

wget http://spice-space.org/download/stable/qcairo-1.8.7.1-git74d6b5.tar.bz2
tar xvf qcairo-1.8.7.1-git74d6b5.tar.bz2
cd qcairo-1.8.7.1-git74d6b5/
./autogen.sh --disable-xlib --disable-ps --disable-pdf --disable-svg --includedir=/usr/include --libdir=/usr/lib64
make
sudo make install
cd ..


错误:configure: error: mandatory image surface backend feature could not be enabled

sudo apt-get install libpixman-1-dev

$ pwd
/usr/lib/pkgconfig
$ sudo ln -s /usr/lib64/pkgconfig/qpixman-1.pc qpixman-1.pc
就好了。


Installing SPICE

libspice and the SPICE client

Finally, all of the dependencies are satisfied and we can install the SPICE server. It comes in two parts: one part is libspice (we will later compile a new version of qemu with spice support to use it), and the other is the spice client. They are both installed at the same time.

NOTE: This section can only be performed on a 64-bit system! Client-only installation on a 32-bit system no longer appears to be supported.

wget http://spice-space.org/download/releases/spice-0.6.0.tar.gz
tar xf spice-0.6.0.tar.gz
cd spice-0.6.0/
./configure --includedir=/usr/include --libdir=/usr/lib64
make
sudo make install
cd ..

"Spiced" QEMU

Support for SPICE 0.6 is currently included in a late 0.13 release of QEMU, we will install that version now. We will be installing this "spiced" QEMU alongside the system QEMU, so make sure you perform the installation in some permanent location. I chose /opt/qemu-spice, but you can do it wherever you want.

Note that we must switch to a branch of the qemu git tree - v19 is the latest branch at time of writing (2010-09-23). According to theSPICE documentation the branch number is in flux and is subject to change.

This whole subsection should be done as root, to avoid exposing /opt to ordinary users. If you don't want to work as root, prepend each command with sudo.

cd /opt
mkdir qemu-spice
cd qemu-spice/
git clone git://git.freedesktop.org/git/spice/qemu
cd qemu/
git checkout -b spice.v19 origin/spice.v19

Now we have to change the configure script to not set the -Werror CFLAG. This is dangerous, but I couldn't get qemu to compile without forcing the configure script to not set it. Open the configure script in your favorite editor and find the part that looks like:

if test "$werror" = "yes" ; then
    QEMU_CFLAGS="-Werror $QEMU_CFLAGS"
fi

Change it to remove the -Werror, like so:

if test "$werror" = "yes" ; then
    QEMU_CFLAGS="$QEMU_CFLAGS"
fi

Now, run the configure script and make QEMU. Please note that compiling QEMU in this way will enable it to emulate only a 64-bit host; add extra targets if you need other architectures.

./configure --target-list=x86_64-softmmu --enable-spice --enable-io-thread
make

QEMU needs certain BIOS files to be able to start SPICE VMs, so we have to copy them to a location QEMU expects to find them.

cp pc-bios/vgabios-qxl.bin /usr/share/qemu/
cp pc-bios/pxe-e1000.bin /usr/share/qemu/

Spiced QEMU is now available, the executable is located at /opt/qemu-spice/qemu/x86_64-softmmu/qemu-system-x86_64. Make a symlink for convenient invocation:

ln -s /opt/qemu-spice/qemu/x86_64-softmmu/qemu-system-x86_64 /usr/sbin/qemu-spice

And that's it! You can invoke qemu-spice with the argument "-spice" to start a SPICE server. As soon as QEMU 0.14 is released, however, you can use the QEMU package available in the Ubuntu repositories instead, since it will include SPICE support by default.

Appendix: Ubuntu SPICE PPA

In past revisions of this page, Adam J. Lincoln's PPA containing debian packages for qcairo, qpixman, etc. and the spice client was mentioned. It no longer appears to be actively maintained, and almost certainly carries an old, incompatible version of SPICE (0.4). If you wish to use SPICE, please compile it from source using the method described above

How To Use SPICE

Client

To invoke the spice client, use the command

spicec -h <server hostname> -p <port number>

Server

Invoking the spice server is rather more complex than the client, since you have to set the parameters of the virtualized guest. For example,

qemu-spice -spice port=5930,disable-ticketing -drive file=/path/to/image -vga qxl -device AC97 -usbdevice tablet -m 1024 -enable-kvm -net nic -net user

will start a SPICE server VM on port 5930 from the image at the supplied path, with:

  • qxl graphics (you need this for spice to be of any use)
  • an AC97 sound device
  • a tablet input device (using a virtualized tablet generally gives better results than a virtualized mouse)
  • 1024M of memory available
  • KVM support enabled (you really want this, as the guest is quite slow otherwise)
  • a user-controllable virtualized nic

It is also possible to use virtio if your system supports it; doing so will lead to significant performance gains for the guest. Modify the-drive argument like so:

-drive file=/path/to/image,if=virtio

And, modify the -net argument like so:

-net nic,model=virtio

When a SPICE server is started, its virtual guest boots and at any point until the guest is shut down a client can connect to and interact with the guest.

Special instructions for using a Windows guest

SPICE aims to provide a high-quality interface between the remote client and the guest VM. To this end, a SPICE-specific Windows driver has been written to enable smooth operation of the mouse, eliminating the "choppiness" that has before been a problem when running an XP guest. When you boot the SPICE Windows guest, follow these instructions to enable it. Note that you must start the guest with option -vga qxl in order for the mouse driver to work.

 

<think>好的,我需要帮助用户在Ubuntu上安装和配置Spacedesk。首先,Spacedesk主要用于将设备变成第二显示器,但官方可能主要支持Windows和Android。不过用户想在Ubuntu上使用,可能需要寻找替代方法或者第三方解决方案。 首先,我应该检查Spacedesk官网是否有Linux版本。假设没有,可能需要使用类似功能的软件,比如x11vnc或者一些虚拟显示工具。另外,用户提供的引用中有关于安装包和配置的内容,可能需要用到apt-get安装依赖项,比如引用2提到的python-rosdep等,不过这可能与Spacedesk无关。不过可以提醒用户确保系统已更新,安装必要的编译工具,如build-essential、cmake,如引用2中的命令。 然后,可能涉及到配置网络和显示服务器,比如X11或Wayland。用户可能需要安装VNC服务器,如x11vnc,然后连接到另一台设备。或者使用像spice或RDP的解决方案。另外,引用3提到使用fcitx输入法,虽然和显示无关,但用户可能需要配置输入法,如果Spacedesk需要中文输入的话。 另外,引用5中的launch文件是ROS相关的,可能用户的环境涉及ROS,但Spacedesk本身可能不需要。不过如果用户需要同时运行ROS和Spacedesk,可能需要确保端口不冲突。 可能的步骤包括:添加第三方仓库,安装必要的软件包,配置显示设置,设置网络权限,启动服务。如果官方不支持,可能需要编译源码,如引用5中的catkin_make,但不确定是否适用。 需要提醒用户检查Ubuntu版本,如引用1提到的18.04,但用户可能使用更新的版本。安装完成后可能需要重启服务,如引用4中的重启Nginx,类比可能需要重启显示管理器。 最后,生成相关问题,涉及替代软件、多显示器配置、网络问题等。</think>在Ubuntu上安装Spacedesk需要借助第三方工具实现多屏扩展功能,以下是具体步骤: ### 一、安装准备 1. 更新系统软件包 ```bash sudo apt update && sudo apt upgrade -y sudo apt install build-essential git cmake -y # 引用[2]中的编译工具 ``` 2. 安装X11虚拟显示驱动 ```bash sudo apt install xserver-xorg-video-dummy -y ``` ### 二、配置虚拟显示器 1. 创建配置文件 ```bash sudo nano /usr/share/X11/xorg.conf.d/20-spacedesk.conf ``` 2. 添加以下配置(支持最高1920x1080分辨率): ``` Section "Device" Identifier "DummyDevice" Driver "dummy" VideoRam 256000 EndSection Section "Screen" Identifier "DummyScreen" Device "DummyDevice" Monitor "DummyMonitor" DefaultDepth 24 SubSection "Display" Depth 24 Modes "1920x1080" EndSubSection EndSection Section "Monitor" Identifier "DummyMonitor" HorizSync 30-70 VertRefresh 50-75 EndSection ``` 3. 重启显示服务 ```bash sudo systemctl restart display-manager # 类似引用[4]中的服务重启 ``` ### 三、安装VNC服务 1. 安装x11vnc服务器 ```bash sudo apt install x11vnc -y ``` 2. 设置VNC密码 ```bash x11vnc -storepasswd ``` 3. 创建系统服务 ```bash sudo nano /etc/systemd/system/x11vnc.service ``` 添加: ``` [Unit] Description=Start x11vnc at startup [Service] ExecStart=/usr/bin/x11vnc -forever -usepw -display :0 -shared Restart=always [Install] WantedBy=multi-user.target ``` 4. 启动服务 ```bash sudo systemctl enable x11vnc sudo systemctl start x11vnc # 类似引用[4]中的服务管理 ``` ### 四、客户端连接 在手机/平板安装Spacedesk客户端,输入Ubuntu的IP地址即可连接。建议在路由器设置静态IP绑定。 ### 注意事项 1. 如果遇到输入法问题,可按照引用[3]配置fcitx输入法 2. 需要开放5900端口(防火墙设置) 3. 推荐使用有线网络连接降低延迟
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值