lost and found ( for me ? )

Linux Mint 12 : use KVM SPICE


Here’s an explanation of how to use SPICE on Linux Mint.

# uname -ri
3.0.0-14-generic x86_64

# tail -1 /etc/lsb-release
DISTRIB_DESCRIPTION="Linux Mint 12 Lisa"

at first , install KVM from the default repository
# apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils virt-manager -y

# kvm --version
QEMU emulator version 0.14.1 (qemu-kvm-0.14.1), Copyright (c) 2003-2008 Fabrice Bellard

# libvirtd --version
libvirtd (libvirt) 0.9.2

# LANG=C apt-cache policy qemu-kvm
qemu-kvm:
 Installed: 0.14.1+noroms-0ubuntu6
 Candidate: 0.14.1+noroms-0ubuntu6
 Version table:
*** 0.14.1+noroms-0ubuntu6 0
       500 http://archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages
       100 /var/lib/dpkg/status

# LANG=C apt-cache policy libvirt-bin
libvirt-bin:
 Installed: 0.9.2-4ubuntu15.1
 Candidate: 0.9.2-4ubuntu15.1
 Version table:
*** 0.9.2-4ubuntu15.1 0
       500 http://archive.ubuntu.com/ubuntu/ oneiric-updates/main amd64 Packages
       100 /var/lib/dpkg/status
    0.9.2-4ubuntu15 0
       500 http://archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages

add the repository for SPICE support
# add-apt-repository ppa:bderzhavets/qemu-git
You are about to add the following PPA to your system:
Qemu-kvm 0.15.0 and Spice on Ubuntu 11.10
Installed and tested to work on Ubuntu Oneiric Alpha 3 and daily build 08/14/11


upgrade KVM related packages.
# apt-get update ;apt-get upgrade –y
以下のパッケージは保留されます:
 qemu-kvm
以下のパッケージはアップグレードされます:
 libvirt-bin libvirt0 python-libvirt qemu-common


install SPICE packages and upgrade qemu-kvm
# LANG=C apt-get install qemu-kvm qemu qemu-common libspice-client libs
pice-client-dev libspicegtk3-client libspicegtk3-client-dev spice libspice-proto
col-dev spicegtk3-client
Reading package lists... Done
Building dependency tree
Reading state information... Done
qemu-common is already the newest version.
qemu-common set to manually installed.
The following extra packages will be installed:
 libcegui-mk2-1 libcelt051 libdevil1c2 libfreeimage3 libspice-server
 libxerces-c28
The following NEW packages will be installed:
 libcegui-mk2-1 libcelt051 libdevil1c2 libfreeimage3 libspice-client
 libspice-client-dev libspice-protocol-dev libspice-server
 libspicegtk3-client libspicegtk3-client-dev libxerces-c28 qemu spice
 spicegtk3-client
The following packages will be upgraded:
 qemu-kvm

# LANG=C apt-cache policy qemu-kvm
qemu-kvm:
 Installed: 081011-2ubuntu9
 Candidate: 081011-2ubuntu9
 Version table:
*** 081011-2ubuntu9 0
       500 http://ppa.launchpad.net/bderzhavets/qemu-git/ubuntu/ oneiric/main amd64 Packages
       100 /var/lib/dpkg/status
    0.14.1+noroms-0ubuntu6 0
       500 http://archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages

# LANG=C apt-cache policy libvirt-bin
libvirt-bin:
 Installed: 0.9.2-5ubuntu15
 Candidate: 0.9.2-5ubuntu15
 Version table:
*** 0.9.2-5ubuntu15 0
       500 http://ppa.launchpad.net/bderzhavets/qemu-git/ubuntu/ oneiric/main amd64 Packages
       100 /var/lib/dpkg/status
    0.9.2-4ubuntu15.1 0
       500 http://archive.ubuntu.com/ubuntu/ oneiric-updates/main amd64 Packages
    0.9.2-4ubuntu15 0
       500 http://archive.ubuntu.com/ubuntu/ oneiric/main amd64 Packages


reboot the OS
# reboot


check the installed version
# kvm --version
QEMU emulator version 0.15.0 (qemu-kvm-devel), Copyright (c) 2003-2008 Fabrice Bellard

# libvirtd --version
libvirtd (libvirt) 0.9.2

Now you can use SPICE.
virt-manger -> change Display setting from VNC to SPICE


You can change the display from VNC to SPICE by editing *.xml file.

add the following lines.
   <channel type='spicevmc'>
     <target type='virtio' name='com.redhat.spice.0'/>
     <address type='virtio-serial' controller='0' bus='0' port='1'/>
   </channel>


change the following line:

from
<graphics type='vnc' port='-1' autoport='yes'/>

to
<graphics type='spice' autoport='yes' keymap='ja'/>

# diff spice.centos6-1.xml vnc.centos6-1.xml
60,63d59
<     <channel type='spicevmc'>
<       <target type='virtio' name='com.redhat.spice.0'/>
<       <address type='virtio-serial' controller='0' bus='0' port='1'/>
<     </channel>
66c62
<     <graphics type='spice' autoport='yes' keymap='ja'/>
---
>     <graphics type='vnc' port='-1' autoport='yes'/>


start the VM ( CentOS 6.2 )
# LANG=C virsh start centos6-1
Domain centos6-1 started

# ps aux | grep spice
116       7706 13.4  3.1 1381600 389940 ?      Sl   18:26   0:16 /usr/bin/kvm -S -M pc-0.14 -enable-kvm -m 1024 -smp 1,maxcpus=4,sockets=4,cores=1,threads=1 -name centos6-1 -uuid 4cbf3421-bb8e-0d3c-e71b-d8cb29aa588d -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/centos6-1.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -rtc base=utc -boot order=c,menu=on -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x4 -drive file=/var/disk1/libvirt/images/centos6-1.img,if=none,id=drive-virtio-disk0,boot=on,format=raw -device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0 -drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdev tap,fd=20,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:d2:28:33,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -usb -device usb-tablet,id=input0 -spice port=5900,addr=127.0.0.1,disable-ticketing -k ja -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6


connect to the VM via spice-client
virsh # qemu-monitor-command centos6-1 'info spice'
Server:
    address: 127.0.0.1:5900
       auth: none
Channel:
    address: 127.0.0.1:44959
    session: 719885386
    channel: 1:0
Channel:
    address: 127.0.0.1:44960
    session: 719885386
    channel: 4:0
Channel:
    address: 127.0.0.1:44961
    session: 719885386
    channel: 2:0
Channel:
    address: 127.0.0.1:44962
    session: 719885386
    channel: 3:0


on the KVM machine ( Linux Mint ) , start spice client.
$ spicec –h 127.0.0.1 –p 5900

Linux Mint 12 : Samba basic configuration


Here’s an explanation of how to install Samba and basic set up on Linux Mint 12.

[ install Samba ]

# uname -ri
3.0.0-14-generic x86_64

# tail -1 /etc/lsb-release
DISTRIB_DESCRIPTION="Linux Mint 12 Lisa"


install Samba via apt-get
# apt-get install samba –y

# smbd --version
Version 3.5.11

# nmbd --version
Version 3.5.11

[ Basic configuration ]

create a test user for Samba
# adduser samba-test1

create the samba account for user samba-test1.
# smbpasswd -a samba-test1
New SMB password:
Retype new SMB password:
Added user samba-test1.

create the directory for Samba and change the ownership of its directory.
# mkdir /home/samba-test1/test
# chown samba-test1.samba-test1 /home/samba-test1/test

edit /etc/samba/smb.conf
add the following lines to share user’s home directory.
[homes]
comment = %u's Home Directories
browseable = yes
directory = /home/%u/test
create mask = 0644
directory mask = 0755
valid users = %S
writable = yes

start smbd and nmbd
# /etc/init.d/smbd start
# /etc/init.d/nmbd start

# testparm /etc/samba/smb.conf
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
       dos charset = CP932
       server string = %h server (Samba, LinuxMint)
       map to guest = Bad User
       obey pam restrictions = Yes
       pam password change = Yes
       passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
       unix password sync = Yes
       syslog = 0
       log file = /var/log/samba/log.%m
       max log size = 1000
       dns proxy = No
       usershare allow guests = Yes
       panic action = /usr/share/samba/panic-action %d

[homes]
       comment = %u's Home Directories
       path = /home/%u/test
       valid users = %S
       read only = No
       create mask = 0644

[printers]
       comment = All Printers
       path = /var/spool/samba
       create mask = 0700
       printable = Yes
       browseable = No

[print$]
       comment = Printer Drivers
       path = /var/lib/samba/printers

access to the Samba via Windows

on Windows7
\\Samba’s IP\samba-test1




hello.txt file was created under /home/samba-test1/test directory
# cat /home/samba-test1/test/hello.txt
hello

# ls -l /home/samba-test1/test/hello.txt
-rw-r--r-- 1 samba-test1 samba-test1 7 date /home/samba-test1/test/hello.txt

check the Samba status
# smbstatus

Samba version 3.5.11
PID     Username      Group         Machine
-------------------------------------------------------------------
9387      samba-test1   samba-test1   test         (client IP)

Service      pid     machine       Connected at
-------------------------------------------------------
samba-test1   9387   test         date

Locked files:
Pid          Uid        DenyMode   Access      R/W        Oplock           SharePath   Name   Time
--------------------------------------------------------------------------------------------------
9387         1004       DENY_NONE  0x100081    RDONLY     NONE             /home/samba-test1/test   .  date