openstack利用spice播放高清视频的一些资料

来源:互联网 发布:数据通信与网络 pdf 编辑:程序博客网 时间:2024/05/01 13:37

http://dachary.org/?p=1348

http://blog.csdn.net/gaoxingnengjisuan/article/details/9985535

http://www.cnblogs.com/chinacloud/archive/2011/02/23/1962317.html

https://github.com/JiYou/openstack/blob/master/chap02/win7.qxl.spice

到http://spice-space.org/yum_repo_data/f12/x86_64/上下载依赖包和安装包,安装即可。

或者yum install spice-protocol spice-client spice-server,依赖包也会同时安装。

然后启动虚拟机,我用的是qemu-kvm命令:/usr/bin/qemu-kvm -hda /software/winxp_new.img -m 1024 -vga qxl -spice port=5924,disable-ticketing

然后在客户端就可以远程登录了:spicec -h ip_address -p port

windows的优化可以看这个网址:http://www.linux-kvm.net/content/rhev-spice-guest-drivers-released-windows

试了一下,没感觉出效果来。

在f14上用源码编译还有问题,下一步解决之。

f12上的rpm安装:http://www.linux-kvm.com/content/getting-started-spice-fedora-12

ubuntu上的安装参考:http://docs.cslabs.clarkson.edu/wiki/SPICE,已通过。

利用此文档在fedora上安装,基本正常,缺少的包为:alsa-lib,alsa-lib-devel;libjpeg-turbo-devel,libjpeg-turbo-static,libjpeg-turbo-utils,libpng,libpng-devel。

编译qcairo的一个错误是:configure: error: Cairo requires at least one native font backend.  Please install FreeType and fontconfig and try again.

安装cairo-devel就可以了。

编译spice提示:

configure: error: Package requirements (openssl) were not met

安装openssl-devel

configure: error: Package requirements (xrandr) were not met

安装libXrandr-devel

configure: error: Package requirements (xfixes) were not met

安装libXfixes-devel

configure: error: libjpeg not found

安装libjpeg-devel

加入--enable-gui后提示:

configure: error: Package requirements (CEGUI >= 0.6.0 CEGUI < 0.7.0) were not met(未解决)

安装spice-gtk时提示:

configure: error: Your intltool is too old.  You need intltool 0.40.0 or later.

安装intltool

configure: error: Package requirements (gtk+-2.0 >= 2.18.0) were not met(未解决)

在spice make时提示:exec: g++: not found

安装gcc-c++

libtool: link: unsupported hardcode properties
libtool: link: See the libtool documentation for more information.
libtool: link: Fatal configuration error.

重新configure一下即可。

具体过程如下:

SPICE

From CSLabsWiki

Jump to: navigation, search

Contents

[hide]
  • 1 Overview
  • 2 SPICE on Ubuntu
    • 2.1 Initial set-up
    • 2.2 Installing Dependencies
      • 2.2.1 Spice protocol headers
      • 2.2.2 qpixman and pixman
      • 2.2.3 celt
      • 2.2.4 qcairo
    • 2.3 Installing SPICE
      • 2.3.1 libspice and the SPICE client
      • 2.3.2 "Spiced" QEMU
    • 2.4 Appendix: Ubuntu SPICE PPA
  • 3 SPICE on Fedora
  • 4 How To Use SPICE
    • 4.1 Client
    • 4.2 Server
    • 4.3 Special instructions for using a Windows guest
  • 5 SPICE in COSI
    • 5.1 External Resources

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-sourcescd 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.gztar xvf spice-protocol-0.6.0.tar.gzcd spice-protocol-0.6.0/./configuremakesudo make installcd ..

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.bz2tar xvf qpixman-0.13.3-git20090127.tar.bz2cd qpixman-0.13.3-git20090127/./autogen.sh --includedir=/usr/include --libdir=/usr/lib64makesudo make installcd ..

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/pixmancd pixman/./autogen.sh --includedir=/usr/include --libdir=/usr/lib64makesudo make installcd ..

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.gztar xvf celt-0.5.1.3.tar.gzcd celt-0.5.1.3/./configure --includedir=/usr/include --libdir=/usr/lib64makesudo make installcd ..

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.bz2tar xvf qcairo-1.8.7.1-git74d6b5.tar.bz2cd qcairo-1.8.7.1-git74d6b5/./autogen.sh --disable-xlib --disable-ps --disable-pdf --disable-svg --includedir=/usr/include --libdir=/usr/lib64makesudo make installcd ..

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.gztar xf spice-0.6.0.tar.gzcd spice-0.6.0/./configure --includedir=/usr/include --libdir=/usr/lib64makesudo make installcd ..

"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 the SPICE 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 /optmkdir qemu-spicecd qemu-spice/git clone git://git.freedesktop.org/git/spice/qemucd 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-threadmake

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.

SPICE on Fedora

It is considerably easier to install SPICE on a Fedora system, since rpms are available. Gerd Hoffman maintains a repository that is kept up to date with the latest in SPICE development, and the version of QEMU with spice support enabled natively will be available in Fedora 14.

To install SPICE on 64-bit Fedora 13, perform the following steps as root:

cd /etc/yum.repos.dwget http://kraxel.fedorapeople.org/spice/spice-unstable.repoyum install spice-client qemu-spice

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.

SPICE in COSI

The VDI/Spice Project is aimed at providing COSI members and students with personalizable virtual machines. The project is still in its early stages, but development is ongoing; we are looking to integrate with OSCKAR and KIOSCKAR.

External Resources

SPICE User Manual

SPICE Homepage

虽然成功了,但运行spicec后没有出现gui界面。后面知道编译时需要加入参数--enable-gui。但加入这个参数后编译,提示缺少cegui库,下载rpm包后安装,又提示缺少libGLU-devel,安装。

刚才查了一下,系统里是有cegui的,但没有cegui-devel,装了以后编译通过。

编译时先看一下./configure --help,会有一些收获的:)

spice wiki上的安装说明:http://www.spice-space.org/page/Building_Instructions

spice-gtk:http://spice-space.org/download/gtk/       http://spice-space.org/page/Spice-Gtk

spice的client界面用了cegui和gtk,看一下能不能该一下。

安装过程:

1. 附件是spice的源代码和protocol的rpm包,先装rpm包,再编译安装spice;这两个你就不用去官网下载了。装好rpm包后,参照步骤2先装依赖包,然后再编译spice。

2. 第二部参考如下内容(参考步骤4):

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.gztar xvf spice-protocol-0.6.0.tar.gzcd spice-protocol-0.6.0/./configuremakesudo make installcd ..

qpixman and pixman

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

wgethttp://spice-space.org/download/stable/qpixman-0.13.3-git20090127.tar.bz2tar xvf qpixman-0.13.3-git20090127.tar.bz2cd qpixman-0.13.3-git20090127/./autogen.sh --includedir=/usr/include --libdir=/usr/lib64makesudo make installcd ..

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/pixmancd pixman/./autogen.sh --includedir=/usr/include --libdir=/usr/lib64makesudo make installcd ..

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.gztar xvf celt-0.5.1.3.tar.gzcd celt-0.5.1.3/./configure --includedir=/usr/include --libdir=/usr/lib64makesudo make installcd ..

qcairo

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

wgethttp://spice-space.org/download/stable/qcairo-1.8.7.1-git74d6b5.tar.bz2tar xvf qcairo-1.8.7.1-git74d6b5.tar.bz2cd qcairo-1.8.7.1-git74d6b5/./autogen.sh --disable-xlib --disable-ps --disable-pdf --disable-svg--includedir=/usr/include --libdir=/usr/lib64makesudo make installcd ..

3.安装spice
tar xf spice-0.8.0.tar.gzcd spice-0.8.0/./configure --includedir=/usr/include --libdir=/usr/lib64makesudo make installcd ..

4. 这里是我编译spice和依赖包时遇到的一些问题,供参考:

编译qcairo的一个错误是:configure: error: Cairo requires at least one native font backend.  Please install FreeType and fontconfig and try again.

安装cairo-devel就可以了。

编译spice提示:

configure: error: Package requirements (openssl) were not met

安装openssl-devel

configure: error: Package requirements (xrandr) were not met

安装libXrandr-devel

configure: error: Package requirements (xfixes) were not met

安装libXfixes-devel

configure: error: libjpeg not found

安装libjpeg-devel

在spice make时提示:exec: g++: not found

安装gcc-c++

libtool: link: unsupported hardcode properties
libtool: link: See the libtool documentation for more information.
libtool: link: Fatal configuration error.

重新configure一下即可。


5. 都完成后,为kvm做个软链接:ln -s /usr/libexec/qemu-kvm /usr/bin/kvm
spice server端启动命令:
kvm -spiceport=5930,disable-ticketing -drive file=/path/to/image -vga qxl -device AC97-usbdevice tablet -m 1024 -net nic -net user
spice client端访问命令:
spicec -h hostip -p port



0 0
原创粉丝点击