Configure SPICE Server

Install Desktop Virtualization "SPICE ( Simple Protocol for Independent Computing Environment )". It's possible to connect to virtual machines from remote client computer.

[1] Install SPICE Server.

[[email protected] ~]# dnf install spice-server -y

[2] Edit existing virtual machine's xml-file and start virtual machine with SPICE like follows. This example on this site shows to create a virtual machine without graphics, so it's OK to change settings like follows, but if you created virtual machine with a graphics, Remove "***" and "***" sections in xml file because qxl is used for graphics.

# edit the configration of [future-1-x64]
[[email protected] ~]# virsh --connect qemu:///system edit future-1-x64

<domain type='kvm'>
  <name>future-1-x64</name>
  <uuid>ef920cb6-72e4-4c89-bb92-71e501593e81</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu>
...
    # add follows
    # set any password for [passwd=***] section
    # specify a uniq number for [slot='0x**']
    <graphics type='spice' port='5900' autoport='no' listen='0.0.0.0' passwd='password'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <sound model='ac97'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </sound>
    <video>
      <model type='qxl' ram='65536' vram='32768' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
    </video>
...
  </devices>
</domain>

Domain future-1-x64 XML configuration edited.

[[email protected] ~]# virsh --connect qemu:///system start future-1-x64
Domain future-1-x64 started

[3] That's OK all. Refer to the next section to connect to SPICE server from SPICE client.

[4] By the way, if you'd like to enable SPICE on initial creating of virtual machine, specify like follows. Then, it's possible to install Systems with SPICE which requires GUI like Windows without installing Desktop Environment on KVM Host computer.

[[email protected] ~]# virt-install \
    --disk path=/var/kvm/images/Future-workstation-1.qcow2,size=30,bus=virtio \
    --graphics spice,listen=0.0.0.0,password=password,keymap=us \
    --cdrom /tmp/Future-Workstation-1-x86_64.iso \
    --network network=default,model=virtio \
    --console pty,target_type=virtio \
    --name future-workstation-1 \
    --connect qemu:///system \
    --os-variant generic \
    --virt-type kvm \
    --os-type linux \
    --video virtio \
    --boot cdrom \
    --ram 4096 \
    --vcpus 4