Fedora 35
Sponsored Link

KVM : Configure SPICE Server2021/11/10

Configure 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 if it's not installed yet. (generally it's already installed with KVM for dependency)
[root@dlp ~]#
dnf -y install spice-server

[2] Edit existing virtual machine's configuration and start virtual machine with SPICE like follows.
The 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 graphics, Remove [<graphics>***] and [<video>***] sections in configuration file.
By the way, if you'd like to use VNC instead of SPICE, replace [graphics type='spice' ***] to [graphics type='vnc' ***].
# edit the configuration of [fedora35]

[root@dlp ~]#
virsh edit fedora35
<domain type='kvm'>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://fedoraproject.org/fedora/31"/>
    # add like follows
    # set any password for [passwd=***] section
    # specify a uniq number for [slot='0x**']
    <graphics type='spice' port='5900' autoport='no' listen='' passwd='password'>
      <listen type='address' address=''/>
    <sound model='ac97'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
      <model type='qxl' ram='65536' vram='32768' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    <rng model='virtio'>
      <backend model='random'>/dev/urandom</backend>
      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>

Domain fedora35 XML configuration edited.

[root@dlp ~]#
virsh start fedora35

Domain fedora35 started
[3] If Firewalld is running, allow ports you use for SPICE.
[root@dlp ~]#
firewall-cmd --add-port=5900-5910/tcp

[root@dlp ~]#
firewall-cmd --runtime-to-permanent

[5] 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 that requires GUI Installation like Windows without installing Desktop Environment on KVM Host computer.
By the way, if you'd like to use VNC, replace the [spice] word to [vnc].
[root@dlp ~]#
virt-install \
--name Win2k22 \
--ram 6144 \
--disk path=/var/kvm/images/Win2k22.img,size=100 \
--vcpus=4 \
--os-variant=win2k22 \
--network bridge=br0 \
--graphics spice,listen=,password=password \
--video qxl \
--cdrom /home/Win2022_EN-US_20348.169.210806-2348.fe.iso \
--boot uefi
Matched Content