DD-WRT 自动翻墙、自动分流

前天家里的 ADSL modem 坏了,一个杂牌用了五年,嗯,还算不错。趁着记忆还没被别的内容取代,记下配置 DD-WRT 通过 OpenVPN 自动翻墙、(墙)内外分流的过程。当然,你也可以用 PPTP、L2TP/IPSec,但我只喜欢 OpenVPN。

第一步,确保你的无线路由器刷了有 openvpn 和 jffs 功能的 DD-WRT 固件包(参考:如何选择适合你的无线路由器的 DD-WRT 固件包)。注意,并非越新的版本就越好,比如最近 eko 编译的两个新版 svn17990(2011年12月8日) 和 svn18946(2012年4月7日) 的 jffs 都存在问题,所以我还是在使用2011年5月18日发布的 svn17084 版本。

第二步,做好 DD-WRT 的基本配置,包括 PPPoE、Router Name、NTP、wireless 等。

第三步,启用 jffs

第四步,配置自动翻墙、(墙)内外分流,即,只有被墙了的地址才走 VPN,其他仍走 ISP 原线路。

第五步,启用 DNSMasq

Setup -> Basic Setup:
DD-WRT DHCP Configuration

Services -> Services:
DD-WRT DNSMasq Configuration

在 Additional DNSMasq Options 中的信息是那些被污染了的域名,添加在此处强行使用 Google 或 OpenDNS 的域名服务器进行解析。以下是我的内容,供参考:

server=/google.com/208.67.222.222
server=/facebook.com/8.8.8.8
server=/fbcdn.net/8.8.8.8
server=/twitter.com/8.8.8.8
server=/youtube.com/8.8.8.8
server=/ytimg.com/8.8.8.8
server=/imageshack.us/8.8.8.8
server=/friendfeed.com/8.8.8.8
server=/j.mp/8.8.8.8
server=/t.co/208.67.222.222
server=/img.ly/208.67.222.222
server=/dw-world.de/208.67.222.222
server=/dw.de/208.67.222.222
server=/dwnews.com/208.67.222.222
server=/twitpic.com/208.67.222.222
server=/appspot.com/208.67.222.222
server=/blogspot.com/208.67.222.222
server=/foursquare.com/208.67.222.222
server=/bbc.co.uk/208.67.222.222
server=/bbc.in/208.67.222.222
server=/rpmfind.net/208.67.222.222
server=/twimg.com/208.67.222.222
server=/delicious.com/208.67.222.222
server=/amazonaws.com/208.67.222.222
server=/udn.com/208.67.222.222
server=/launchpad.net/208.67.222.222
server=/boxun.com/208.67.222.222
server=/yfrog.com/208.67.222.222
server=/peacehall.com/208.67.222.222
server=/identi.ca/208.67.222.222
server=/wikipedia.org/208.67.222.222

如果你在使用 Linux 桌面,推荐不要在你的本机上启用本地 dnsmasq,比如,如果是 GNOME Network Manager,在 /etc/NetworkManager/NetworkManager.conf 文件中注销 dns=dnsmasq 行。

Enjoy the Unlimited Internet! :-)

Posted in Uncategorized | Tagged , , | 2 Comments

Build and Install SPICE-GTK on Ubuntu

SPICE-GTK 0.11 on Ubuntu 12.04 64bit.

1. Prepare environment

$ sudo apt-get install build-essential libspice-server1 libspice-protocol-dev libavcodec-dev libasound-dev libpng12-dev libfreetype6-dev libxrandr-dev libsdl-dev libnss3-dev libxfixes-dev intltool libssl-dev libgtk2.0-dev python-gtk-vnc python-gtk2 python-gtk2-dev libssl-dev libpulse-dev libpixman-1-dev libjpeg-turbo8-dev libsasl2-dev libusb-1.0-0 libusb-1.0-0-dev libgudev-1.0-dev gobject-introspection python-dev

2. usbredir

$ wget http://spice-space.org/download/usbredir/usbredir-0.4.3.tar.bz2
$ tar jxvf usbredir-0.4.3.tar.bz2
$ cd usbredir-0.4.3
$ ./configure --prefix=/usr
$ make
$ sudo make install

3. celt051

$ wget http://downloads.us.xiph.org/releases/celt/celt-0.5.1.3.tar.gz
$ tar zxvf celt-0.5.1.3.tar.gz
$ cd celt-0.5.1.3
$ ./configure --prefix=/usr/local
$ make
$ sudo make install

注:因为 libspice-server1 带了 celt051 的 lib,位于 /usr/lib,所以推荐把这个自己编译的 celt051 安装到一个不同的地方,以免冲突。

4. libcacard

$ wget http://spice-space.org/download/libcacard/libcacard-0.1.2.tar.bz2
$ tar jxvf libcacard-0.1.2.tar.bz2
$ cd libcacard-0.1.2
$ ./configure --prefix=/usr
$ make
$ sudo make install

5. spice-gtk

$ wget http://spice-space.org/download/gtk/spice-gtk-0.11.tar.bz2
$ tar jxvf spice-gtk-0.11.tar.bz2
$ cd spice-gtk-0.11
$ ./configure --with-gtk=2.0 --enable-usbredir=yes --enable-smartcard=yes --with-python=yes
$ make
$ sudo make install

OK. You can run spicy to open the GTK Spice client.

Posted in Uncategorized | Tagged | 6 Comments

Publish Packages on PPA

如果你希望把你制作的 deb 包分享给社区,你需要自己设立一个 repository,对大多数人来说,这有点太麻烦了。Ubuntu 提供了一项免费服务 PPA,你可以把自己的包上传至 PPA 上,分享给别人。

1. 注册一个 LaunchPad 帐号,比如帐号为 lpfoobar

2. 注册完毕、登录后,在你的 LaunchPad 页面上注册你的 GPG Key 和 SSH 公钥。

3. 点击 Create a new PPA,创建一个 PPA,比如名称为 myppa

4. 编译 deb 包,不能生成 binary 包,因为 PPA 只接受源码包,所以使用以下指令编译制作:
$ dpkg-buildpackage -rfakeroot -S -k6961BA0D
用你的 GPG Key ID 替换上面命令中的 6961BA0D

5. 上传至 PPA
$ dput ppa:lpfoobar/myppa package_version_source.changes
用你制作的包替换上面命令中文件名,比如 usbredir_0.4.3-0ubuntu1_source.changes

6. 等待 PPA 帮你编译成 binary,通常需要一到两个小时。

Posted in Linux | Tagged | Leave a comment

Customize CyanogenMod ROM

不知道还有多少人在坚持使用早期的 Android 设备,比如 HTC Dream (G1)、Magic (G2) 等。上个月某天午饭时,一个同事说她最近入手了 Sensation (G14),因为原先的那台 Hero (G3) 实在太慢了。嗯,想起了 Richard Jones 说的——Android is the new Windows. 多数情况下,用户不会去管操作系统,于是太多的硬件资源被不必要地占用了,而且还带来不稳定性。但 Android 的开放性使得用户可以对其进行裁减/定制,最原始的做法是直接从源码开始,不过这太麻烦了,另一种做法是修改已经存在的 ROM 安装包。

我依然在使用 G2,已经两年半了,机器里跑的是基于 CM 6.1.0 裁减之后的版本,速度和稳定性都是能接受的。下表(Table 1)列出了修改细节:

Table 1. CyanogenMod ROM

程序包 用途 改变
AccountAndSyncSettings.apk 账户同步设置 保留
ADWLauncher.apk ADW 桌面起动器 保留
AndroidTerm.apk 终端模拟器 删除
ApplicationsProvider.apk 应用程序信息存储器 保留
Bluetooth.apk 蓝牙服务 保留
Browser.apk 浏览器 保留
Calculator.apk 计算器 删除
Calendar.apk 日历 保留
CalendarProvider.apk 日历存储器 保留
Camera.apk 照相机 保留
CertInstaller.apk 证书安装器 保留
CMParts.apk CM 高级设置 保留
CMPartsHelper.apk CM 提示 保留
CMStats.apk CM 统计 删除
CMWallpapers.apk CM 壁纸 删除
Contacts.apk 联系人 保留
ContactsProvider.apk 联系人存储器 保留
DefaultContainerService.apk 默认通讯录服务 保留
DeskClock.apk 闹钟时钟 保留
Development.apk 开发者调试工具 删除
DownloadProvider.apk 下载支持服务 保留
DrmProvider.apk DRM受保护数据存储服务 保留
DSPManager.apk DSP音频特效管理器 删除
Email.apk 电子邮箱 删除
FileManager.apk 文件管理器 保留
Gallery3D.apk 3D 图库 删除
HTMLViewer.apk HTML查看器 保留
LatinIME.apk 拉丁输入法 保留
LiveWallpapersPicker.apk 动态壁纸查看器 删除
MediaProvider.apk 媒体支持 保留
Mms.apk 短信彩信 保留
Music.apk 音乐播放器 删除
PackageInstaller.apk 应用安装程序 保留
Phone.apk 电话 保留
PicoTts.apk 语音朗读引擎 删除
Protips.apk 桌面帮助提示小插件 删除
Provision.apk 设置向导 保留
QuickSearchBox.apk 快速搜索框 删除
RomManager.apk ROM 管理器 删除
RootExplorer.apk ROOT 文件管理器 新增
Settings.apk 系统设置 保留
SettingsProvider.apk 系统设置存储器 保留
SoundRecorder.apk 录音机 删除
SpareParts.apk 附加选项 保留
Stk.apk SIM卡工具包 保留
Superuser.apk 超级用户 保留
TelephonyProvider.apk 拨号器储存 保留
TtsService.apk 语音服务 删除
UserDictionaryProvider.apk 用户字典存储服务 保留
VoicDialer.apk 语音拨号 删除
VpnServices.apk VPN 服务 保留

你可以下载以上裁减之后的包:update-cm-6.1.0-DS-lite-signed.zip (48M)
如果你的手机是 G1 或者 G2 32B,直接刷这个包就行了。如果你的手机是 G2 32A (EBL1),还需要刷一个 port 包

(OPTIONAL)注意,以上 ROM 是不包含 Google Addons 的,如果你需要 Google 提供的一些功能,比如 Gtalk、电子市场等的,需要刷 gapps 包。当然,我们也可以做一些裁减。以下表格(Table 2)所列是对 gapps-mdpi-20110501 的修改:

Table 2. gapps

程序包 用途 改变
CarHomeGoogle.apk 车载模式主程序 删除
CarHomeLauncher.apk 车载模式主屏幕 删除
Facebook.apk Facebook 删除
GenieWidget.apk 天气和资讯挂件 删除
Gmail.apk Gmail 删除
GoogleBackupTransport.apk Google 备份传输 删除
GoogleCalendarSyncAdapter.apk Google 日历同步 保留
GoogleContactsSyncAdapter.apk Google 联系人同步 保留
GoogleFeedback.apk Google 反馈 删除
GooglePartnerSetup.apk Google 伙伴设置 保留
GoogleQuickSearchBox.apk Google 快速搜索框 删除
GoogleServicesFramework.apk Google 服务框架 保留
googlevoice.apk Google 语音 删除
HtcCopyright.apk HTC 版权 删除
HtcEmailPolicy.apk HTC 电邮政策 删除
HtcSettings.apk HTC 设置 删除
kickback.apk 操作振动回馈 删除
LatinImeTutorial.apk 拉丁输入法教程 删除
Maps.apk Google 地图 删除
MarketUpdater.apk 电子市场升级程序 保留
MediaUploader.apk 媒体上载 保留
NetworkLocation.apk 网络位置 保留
OneTimeInitializer.apk 首次初始化工具 保留
PassionQuickOffice.apk 办公工具 删除
SetupWizard.apk 设置向导 保留
soundback.apk 操作声音回馈 删除
Street.apk 街景 删除
Talk.apk Gtalk 保留
talkback.apk 辅助功能 删除
Twitter.apk Twitter 删除
Vending.apk 电子市场 保留
VoiceSearch.apk 语音搜索 删除
YouTube.apk YouTube 删除

你可以下载以上裁减之后的 Google Addons 包:gapps-mdpi-20110501-lite-signed.zip (3M)

注:如果你自行修改了 ROM,一定要对新包进行签名,否则无法刷。android.com 上有指南:Signing Your Applications,就是使用 keytool、jarsigner 两个工具。

如此精简之后,你的“老旧”安卓手机应该也不会表现的太差,have fune ^o^

Posted in Android | 2 Comments

Installing Debian from USB Stick

This post describes how to install Debian Testing (current Testing is Wheezy). The procedure for installing Debian Stable (current Stable is Squeeze) is same, only the download links are different.

1. Install the necessary tools on your computer which runs a Linux as operating system. My ThinkPad runs Ubuntu 10.10:
$ sudo apt-get install mtools syslinux

2. Insert a USB stick into your computer, in most cases, your Linux should mount the USB disk automatically. If so, umount if firstly:
$ sudo umount /path/to/mount/point

3. Check the partitions information of the USB disk (assume the device is /dev/sdb):
$ sudo fdisk -l /dev/sdb

If the USB disk is never initialized and has no partition table, you need to create at least one partition on it.

4. Format (one partition is enough):
$ sudo mkdosfs /dev/sdb1

5. Install syslinux:
$ sudo syslinux /dev/sdb1

6. Mount the USB disk, and put necessary files into it:
$ sudo mount /dev/sdb1 /mnt
$ cd /mnt
$ sudo wget http://d-i.debian.org/daily-images/amd64/daily/hd-media/vmlinuz
$ sudo wget http://d-i.debian.org/daily-images/amd64/daily/hd-media/initrd.gz
$ sudo wget http://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/amd64/iso-cd/debian-testing-amd64-netinst.iso

Notes: Of course, since downloading images is time-consuming, you can download them separately and copy into the USB disk.

7. Create configuration file syslinux.cfg
$ cd /mnt
$ sudo vi syslinux.cfg

default vmlinuz
append initrd=initrd.gz

Umount the USB disk, it’s ready for use then.

No CD/DVD, more green :-) Have fun!

Posted in Linux | Tagged | Leave a comment

Create a Xen Virtual Machine

This tutorial shows how to create a VM (virtual machine) on Xen and install CentOS 6.0.

1. Prepare Virtual Disk Image

Xen supports to run VM on physical device or virtual disk image. Here I am going to use virtual disk image in raw format. The below creates a 8G virtual disk for root partition, and a 512M virtual disk for swap:

# dd if=/dev/zero of=centos6.img bs=4K count=0 seek=2048K
# dd if=/dev/zero of=centos6.swp bs=4K count=0 seek=128K

Or, you can use qemu-img utility to replace dd:

# qemu-img create -f raw centos6.img 8G
# qemu-img create -f raw centos6.swp 512M

2. Prepare Configuration for Xen VM installation

Xen needs three files to install a VM: kernel, ramdisk, and a configuration file.

You can always find appropriate kernel and ramdisk from your Linux distribution’s website, for example, CentOS 6.0:

# wget http://mirror.centos.org/centos/6.0/os/x86_64/isolinux/vmlinuz
# wget http://mirror.centos.org/centos/6.0/os/x86_64/isolinux/initrd.img

And create a Xen configuration file:

# vi centos6-x64-domu

kernel = "/data/vm/vmlinuz"
ramdisk = "/data/vm/initrd.img"
name = "xc6"
memory = "512"
disk = [ "file:/data/vm/centos6.img,xvda,w","file:/data/vm/centos6.swp,xvdb,w" ]
vif = [ "bridge=br0" ]
vcpus = 1
on_reboot = "destroy"
on_crash = "destroy"

Notes:

file: uses dom0 kernel page cache, and thus might give better performance than phy: or tap:aio:, but it’s also more insecure because of caching. tap:aio: uses direct IO, so it bypasses dom0 kernel cache, and works like phy: in that sense. Refer to blktap on Xen’s wiki to understand more.

Please be aware:
1, your dom0 must have loaded blktap modules before you can use tap:aio:. Not every Linux distribution has built everything in.
2, if your blktap is version 2 (i.e., blktap2), for example, Debian Wheezy, you need to use tap2:tapdisk:aio: etc.

3. Start Installing

Now it’s time to create the VM and start installing CentOS 6.0 in it:

# xm create centos6-x64-domu

Then you can connect to the virtual console, and do regular OS installation:

# xm console xc6

4. Change Configuration for Xen VM Normal Operation

After the OS is installed, the VM is destroyed. You need to edit the configuration from Xen VM installation to normal operation.

# vi centos6-x64-domu

name = "xc6"
memory = "512"
disk = [ "file:/data/vm/centos6.img,xvda,w","file:/data/vm/centos6.swp,xvdb,w" ]
vif = [ "bridge=br0" ]
bootloader = "/usr/lib/xen-4.1/bin/pygrub"
vcpus = 1
on_reboot = "restart"
on_crash = "destroy"

The new configuration uses pygrub as a bootloader that acts grub and uses grub.conf from inside the VM. Of course, you can continue using the separated kernel and ramdisk, but this means you need to maitain them by yourselves.

Then you can start your VM by typing:

# xm create centos6-x64-domu

Have fun!

Posted in Cloud Computing | Tagged , | 1 Comment

QEMU-KVM with SPICE Support on Ubuntu 11.10 64-bit

SPICE server requires 64-bit system. Make sure you are running Oneiric x86_64.

1. Remove AppArmor

$ sudo invoke-rc.d apparmor stop
$ sudo update-rc.d -f apparmor remove
$ sudo apt-get autoremove --purge apparmor
$ sudo reboot

After the machine is rebooted, you can check if there are configurations or data folders not deleted automatically, if yes, you can delete them safely, for example:

$ cd /etc
$ sudo rm -fr apparmor*

2. Configure Bridge (optional)

This step is only required when you want to provide ethernet bridging for VMs.

First of all, bridging tool needs to be installed:

$ sudo apt-get install bridge-utils

By default, Ubuntu uses NetworkManager to configure network devices automatically. But here we need to edit the configuration file manually to add bridging settings:

$ sudo vi /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet manual

auto br0
iface br0 inet static
address 192.168.96.88
netmask 255.255.255.0
network 192.168.96.0
broadcast 192.168.96.255
gateway 192.168.96.1
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0

If your machine is using DHCP for IP configuration, change the third section (device br0) to:

auto br0
iface br0 inet dhcp
bridge_ports eth0
bridge_stp off
bridge_fd 0
bridge_maxwait 0

Save your configuration file, and restart network to take effect:

$ sudo invoke-rc.d networking stop
$ sudo invoke-rc.d networking start

Or, if you are working remotely, stopping network will disconnect you to the machine, just do reboot machine alternatively.

After restarted network or rebooted machine, use ifconfig and brctl show to check if ethernet briding works as expected.

$ brctl show
bridge name	bridge id		STP enabled	interfaces
br0		8000.5c63bf86e499	no		eth0

3. Install KVM and SPICE packages

The qemu-kvm version in Oneiric is 0.14, but Ubuntu’s compilation does not include SPICE support. We have to use another repository which has compiled qemu-kvm with SPICE support.

$ sudo apt-add-repository ppa:bderzhavets/qemu-git
$ sudo apt-get update

I don’t know if there are the other repositories better than the above found in Ubuntu wiki. But at least it works.

Install:

$ sudo apt-get install qemu-kvm virt-manager spice libspice-server

After installed the packages, your Oneiric is ready to run VM with SPICE support. Refer to another post to learn how to install guest with SPICE support.

Posted in Cloud Computing | Tagged , , | 7 Comments

iptables in Ubuntu

Since 7.10, Ubuntu uses UFW to manage firewall. Well, UFW is easier than iptables, but I prefer to use iptables directly. Keep it less layers.

Stop and remove UFW:

$ sudo invoke-rc.d ufw remove
$ sudo update-rc.d -f ufw remove
$ sudo apt-get autoremove --purge ufw

Then install a utility for loading iptables rules at boot-time:

$ sudo apt-get install iptables-persistent

By default the iptables rules are stored in /etc/iptables/rules.v4.

Sample 1: configure a dual-NIC Linux box as a NAT gateway. Let’s assume eth0 be connected with external network, eth1 be connected with internal network, and the internal network is 192.168.96.0/24.

Use editor to open the above file, and add the following line under POSTROUTING ACCEPT chain of nat table:

-A POSTROUTING -s 192.168.96.0/24 ! -d 192.168.96.0/24 -o eth0 -j MASQUERADE

Sample 2: Open ports. Assume needs to open TCP ports 22, 53, 80, and 5900-5920.

Adding the below line under INPUT ACCEPT chain of filter table:

-A INPUT -p tcp -m multiport ‐-dports 5900:5920 -j ACCEPT
-A INPUT -p tcp -m multiport ‐-dports 22,53,80 -j ACCEPT

<EOF>

Posted in Linux | Tagged , | Leave a comment

Install a Windows Guest with SPICE

There are many choices for desktop virtualization (sometimes called desktop cloud):

  • ICA – Citrix XenDesktop supports it
  • PCoIP – VMWare View supports it
  • RDP – Microsoft supports it
  • SPICE – Red Hat (RHEV) supports it
  • … …

The last one, SPICE, really rocks, especially in multimedia and WAN! The user experience is really great.

SPICE (Simple Protocol for Independent Computing Environments) is an open standard. Red Hat got SPICE and KVM when it acquired Qumranet in 2008, and opened them. SPICE support was added to upstream Qemu in April 2010, that means, if your Qemu is released after April 2010, you can play with SPICE easily with the following steps.

This experiment uses Fedora 15 x86_64 as the host machine OS, SPICE server doesn’t support 32-bit system due to its reliance to 64-bit atomic operation, and uses Windows XP as the guest machine OS, because Windows still dominates the personal desktop area.

1. Create a VM and install Windows XP:

Prepare a virtual disk:

$ sudo qemu-img create -f raw winxp.img 10G

Install VM:

$ sudo virt-install --connect=qemu:///system \
                    --name=richdesk --ram=1024 --vcpus=1 \
                    --os-type=windows --os-variant=winxp \
                    --hvm --virt-type kvm \
                    --cdrom=/path/to/winxp_install.iso \
                    --disk path=/path/to/winxp.img \
                    -w network=default \
                    --graphics spice,port=5901,listen=0.0.0.0 \
                    --video qxl --channel spicevmc \
                    --soundhw default \
                    --accelerate

Notes:

  • The above command uses NAT for network, if you prefer bridge mode, change network option to --network bridge=br0. Of course, you need to configure a bridge device br0 firstly.
  • The above command uses 5901 as SPICE server port, you can change it to any valid port. Please make sure the port is opened on the host machine if it has firewall enabled.

After installed the basic Windows XP, shutdown the VM.

2. Install SPICE guest packages for Windows

Download the latest Windows binaries packages from SPICE website:

$ wget http://spice-space.org/download/binaries/qxl-win-0.1010-20110308-d9eb3203bd.zip
$ wget http://spice-space.org/download/binaries/virtio-serial_20110725.zip
$ wget http://spice-space.org/download/binaries/vdagent-win32_20110801.zip

Copy qxl, virtio-serial, vdagent packages into the images:

$ sudo virt-copy-in -a winxp.img *.zip 'win:c:\'

Then start VM, and install the drivers qxl and virtio-serial.

Unzip vdagent package to any place, for example, C:\opt, and register it as a Windows service:

C:\opt\vdagent-win-x86> vdservice install

Reboot this Windows VM.

3. Connect to VM via SPICE protocol

There are several client tools which support SPICE protocol, for example, Vinagre, spicec, virt-manager, etc. My favourite is Vinagre. Also you can buy a thin client hardware whose firmware supports SPICE protocol.

By default the SPICE plugin of Vinagre is disabled, you can enable it through Edit -> Plugins. Then you can connect to host:5901.

Now you have gotten a Windows guest with SPICE support, then enjoy the great quanlity and smooth operation experience brought to you by SPICE! Is it all? Yes if you mean SPICE. But if you want to improve the performance of your virtual desktop more, recommend to use virtio drivers for hard disk and network card. I’m not going to cover virtio in this post.

Have fun ^o^

Posted in Cloud Computing | Tagged , , , | 1 Comment

Compile and Install SPICE Client on Ubuntu

Since 11.10 (Oneiric), Ubuntu includes SPICE client in its official repository. But how can we get SPICE client if we still use the old Ubuntu releases prior to Oneiric?

The following describes how to compile and install a SPICE client from source code on Ubuntu 10.10 (Maverick) 32bit. The procedure for the other Ubuntu releases or Debian distributions should be similar.

1. Install the standard tools for compilation
$ sudo apt-get install build-essential autoconf git-core libtool

2. Install dependencies existing in repository
$ sudo apt-get install libavcodec-dev libssl-dev libasound-dev libpng12-dev libfreetype6-dev libogg-dev libxrandr-dev libgcrypt-dev libsdl-dev libnss3-dev libpixman-1-dev libxfixes-dev libjpeg8-dev libsasl2-dev

3. Install dependencies not existing in repository

3.1. libcacard

This library is what SPICE uses to emulate smart cards and smart card readers.

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

3.2. celt051

There is newer celt packages in Maverick’s repository, the version is 0.7.1. But SPICE client requires a specific version – 0.5.1, so we have to install this required version manually.

Get the below two packages from launchpad then install:

$ sudo dpkg -i libcelt051_0.5.1.3-2_i386.deb
$ sudo dpkg -i libcelt051-dev_0.5.1.3-2_i386.deb

3.3. SPICE protocol

$ wget http://spice-space.org/download/releases/spice-protocol-0.8.1.tar.bz2
$ tar jxvf spice-protocol-0.8.1.tar.bz2
$ cd spice-protocol-0.8.1
$ ./configure --prefix=/usr
$ make
$ sudo make install
$ cd /usr/include
$ sudo ln -s spice-1/spice .

4. Finally we are ready to compile and install SPICE client

$ wget http://spice-space.org/download/releases/spice-0.8.2.tar.bz2
$ tar jxvf spice-0.8.2.tar.bz2
$ cd spice-0.8.2
$ ./configure --enable-smartcard
$ make
$ sudo make install

That’s it. Now you can connect to your VM with spicec, for example:

$ spicec --host SPICE_SERVER --port 5300

Enjoy the speed and performance of SPICE!

<EOF>

Posted in Cloud Computing | Tagged , | 1 Comment