VDI Web Publishing - Ubuntu Desktop 22.04
Publishing a Ubuntu Desktop over HTTPS using KasmVNC. Unlike vdi-web-publishing-windows, there is no need to run VNC and noVNC separately, KasmVNC directly publishes the Ubuntu Desktop over HTTP/S.
This document shows how to publish the Ubuntu 22.04 Gnome Desktop Environment using KasmVNC over HTTP.
Steps
- Install/configure Ubuntu Desktop VM in Proxmox.
- Create a default
ubuntuuser and setup the Gnome Desktop as required, this user's desktop will be published via KasmVNC. - Install KasmVNC deb package from GitHub Releases.
- Customise KasmVNC yaml config files.
- Disable auto start of GDM, KasmVNC starts its own Xvnc server with Gnome DE so there is no need to start two graphical environments.
- Auto start KasmVNC on the CLI (
/dev/tty1) as the ubuntu user by customisingagetty. KasmVNC is not compatible withsystemd.
Step 1: Proxmox Setup
root@pve:~# qm config 301
agent: 1,fstrim_cloned_disks=1
balloon: 1024
bios: ovmf
boot: order=virtio0
cores: 4
cpu: host
efidisk0: local-zfs:vm-301-disk-0,efitype=4m,pre-enrolled-keys=1,size=1M
machine: q35
memory: 8192
meta: creation-qemu=8.1.5,ctime=1707259270
name: ubuntu-desktop-vdi
net0: virtio=BC:24:11:A8:43:5F,bridge=vmbr0,firewall=1
numa: 0
ostype: l26
parent: vanilla
scsihw: virtio-scsi-single
smbios1: uuid=fc685526-ce95-41de-a0d5-7927e70f2d6e
sockets: 1
vga: virtio,memory=512
virtio0: local-zfs:vm-301-disk-1,cache=unsafe,discard=on,iothread=1,size=25G
vmgenid: d333344d-a0ed-479a-af0e-4bfcccbeca12Step 2: Create the ubuntu User
Create a default ubuntu desktop user and install all packages and customise the desktop environment as required. The desktop for this user will be published via KasmVNC.
Step 3: Installing KasmVNC in Ubuntu Desktop
Download and install the latest KasmVNC deb package from the KasmVNC GitHub Releases page.
Step 4: Customize KasmVNC Configuration
Global KasmVNC Config
# Filename: /etc/kasmvnc/kasmvnc.yaml
# If running under Proxmox, ensure Display type is set to VirtIO-GPU
desktop:
gpu:
hw3d: true
network:
protocol: http
interface: 0.0.0.0
websocket_port: 8844
use_ipv4: true
ssl:
pem_certificate: /dev/null
pem_key: /dev/null
require_ssl: falseUser Specific KasmVNC Config
# Filename: ~ubuntu/.vnc/kasmvnc.yaml
logging:
log_writer_name: all
log_dest: logfile
level: 100#!/bin/sh
# Filename: ~ubuntu/.vnc/xstartup
# Run chmod 755 ~ubuntu/.vnc/xstartup
XDG_CURRENT_DESKTOP=GNOME exec dbus-launch --exit-with-session /usr/bin/gnome-sessiontouch ~ubuntu/.vnc/.de-was-selectedManual KasmVNC Startup Test
/usr/bin/vncserver -fg -disableBasicAuth -alwaysshared
# Verify access to the Ubuntu Desktop http://$IP:8844Step 5: Disable Graphics Auto Start
KasmVNC starts a new instance of Xvnc with Gnome DE. The X11 instance running on the console can be disabled as the VM will only be accessed via KasmVNC over the network.
systemctl set-default multi-user.targetRefer: ubuntu-desktop-disable-graphics
Step 6: Auto Start KasmVNC from the CLI
kasmvnc-autostart.sh
#!/bin/bash
# Filename: /usr/local/sbin/kasmvnc-autostart.sh
# Auto start KasmVNC
# User to start KasmVNC
X_USER=ubuntu
while sleep 5; do
echo Starting KasmVNC server
su - ${X_USER} -c '/usr/bin/vncserver -fg -disableBasicAuth -alwaysshared'
doneSystemd Override to Auto Start KasmVNC on tty1
# Filename: /etc/systemd/system/getty@tty1.service.d/override.conf
# Systemd override to autologin ubuntu user and start KasmVNC on tty1
# After modifying this file, run "systemctl daemon-reload; systemctl restart getty@tty1.service"
[Service]
ExecStart=
ExecStart=-/sbin/agetty -a ubuntu -l /usr/local/sbin/kasmvnc-autostart.sh %I $TERM