Skip to content

Commit 377de76

Browse files
authored
Merge pull request #1901 from afbjorklund/vnc-example
Add vnc example with xorg desktop environment
2 parents 2f581c7 + a3e6631 commit 377de76

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

examples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Optional feature enablers:
5353
- [`experimental/riscv64`](./experimental/riscv64.yaml): [experimental] RISC-V
5454
- [`experimental/net-user-v2`](./experimental/net-user-v2.yaml): [experimental] user-v2 network
5555
to enable VM-to-VM communication without root privilege
56+
- [`experimental/vnc`](./experimental/vnc.yaml): [experimental] use vnc display and xorg server
5657

5758
Lost+found:
5859
- ~`centos`~: Removed in Lima v0.8.0, as CentOS 8 reached [EOL](https://www.centos.org/centos-linux-eol/).

examples/experimental/vnc.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# A template to run ubuntu using display: vnc
2+
# This template requires Lima v0.15.0 or later.
3+
images:
4+
# Try to use release-yyyyMMdd image if available. Note that release-yyyyMMdd will be removed after several months.
5+
- location: "https://cloud-images.ubuntu.com/releases/23.04/release-20230926/ubuntu-23.04-server-cloudimg-amd64.img"
6+
arch: "x86_64"
7+
digest: "sha256:1e35473cea5e1b827b91ad6ebb43b605a00d506c11f66c75076c424ae5372440"
8+
- location: "https://cloud-images.ubuntu.com/releases/23.04/release-20230926/ubuntu-23.04-server-cloudimg-arm64.img"
9+
arch: "aarch64"
10+
digest: "sha256:46d4f3874831fc28e0edcf24b86b6b8017e0492fa848d951cfa3c7b520b2d2fa"
11+
# Fallback to the latest release image.
12+
# Hint: run `limactl prune` to invalidate the cache
13+
- location: "https://cloud-images.ubuntu.com/releases/23.04/release/ubuntu-23.04-server-cloudimg-amd64.img"
14+
arch: "x86_64"
15+
- location: "https://cloud-images.ubuntu.com/releases/23.04/release/ubuntu-23.04-server-cloudimg-arm64.img"
16+
arch: "aarch64"
17+
18+
mounts:
19+
- location: "~"
20+
- location: "/tmp/lima"
21+
writable: true
22+
23+
vmType: "qemu"
24+
video:
25+
display: "vnc"
26+
27+
provision:
28+
- mode: system
29+
script: |
30+
#!/bin/bash
31+
set -eux -o pipefail
32+
command -v Xorg >/dev/null 2>&1 && exit 0
33+
export DEBIAN_FRONTEND=noninteractive
34+
# x-terminal-emulator x-session-manager x-window-manager
35+
apt-get install -y xorg xterm openbox hsetroot tint2 slim
36+
printf "auto_login yes\ndefault_user ${LIMA_CIDATA_USER}\n" >>/etc/slim.conf
37+
# configure some nice lima green, set up panel and apps
38+
printf "hsetroot -solid \"#32CD32\" &\ntint2 &\n" >>/etc/xdg/openbox/autostart
39+
sed -i 's/Clearlooks/Clearlooks-Olive/' /etc/xdg/openbox/rc.xml # go for green
40+
apt-get install -y --no-install-recommends dillo xfe # x-www-browser +explorer
41+
- mode: system
42+
script: |
43+
#!/bin/bash
44+
set -eux -o pipefail
45+
systemctl set-default graphical.target
46+
systemctl isolate graphical.target
47+
probes:
48+
- description: "Xorg to be installed"
49+
script: |
50+
#!/bin/bash
51+
set -eux -o pipefail
52+
if ! timeout 30s bash -c "until command -v Xorg >/dev/null 2>&1; do sleep 3; done"; then
53+
echo >&2 "Xorg is not installed yet"
54+
exit 1
55+
fi
56+
hint: See "/var/log/cloud-init-output.log". in the guest
57+
message: |
58+
Use a VNC viewer or noVNC, to connect to the display:
59+
60+
* VNC Display: see <file://{{.Dir}}/vncdisplay>
61+
* VNC Password: see <file://{{.Dir}}/vncpassword>

0 commit comments

Comments
 (0)