I was looking to create a light weight virtual machine with Graphical user interface for segmenting some of my internet browsing endeavors. I tested a couple of light weight Linux distros but ended up with just using Alpine Linux with XFCE as the Desktop Environment and VNC for remote access.  Once VNC access is configured, it can be used with Apache Guacamole.

You can watch the Video Walk through here :

Note: Other download options are available Here

  • Now Create a Virtual machine and select the ISO as the installation media. Select Linux, other 3.x kernel 64 bit as the options for the Virtual Machine.
  • We are going to perform a persistent installation. Once Alpine boots off the ISO, run setup.
setup-alpine

Note: Make sure to select sys for storage.

  • Follow the wizard and reboot when installation is complete.
  • Optionally, create sudo user, or add your existing user to Sudo group.
apk add sudo

export USER='yourUserName'

adduser -D $USER && echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER && chmod 0440 /etc/sudoers.d/$USER

Install Desktop Environment (XFCE)

  • Uncomment the community repository from the file below:
vi /etc/apk/repositories
  • Install required packages.
apk update
setup-xorg-base xfce4 xfce4-terminal lightdm-gtk-greeter xfce4-screensaver dbus-x11 open-vm-tools-gtk faenza-icon-theme xf86-video-vmware xf86-input-mouse xf86-input-keyboard
  • Configure X-Window System
    Xorg -configure
    cp /root/xorg.conf.new /etc/X11/xorg.conf
  • Ensure Required services start on boot
    rc-service lightdm start
    rc-update add lightdm
    rc-update add open-vm-tools
  • Optional: Install Firefox and or Chrome
apk add firefox-esr
apk add chromium

Install and Configure VNC

  • Install pre-requisite packages and vnc
apk add --no-cache ca-certificates curl openssl sudo xvfb x11vnc xfce4 faenza-icon-theme bash

Ensure VNC starts at Boot

rc-update add local default
vi /etc/local.d/vnc.start
#!/bin/sh
nohup x11vnc -xkb -noxrecord -noxfixes -noxdamage -display :0 -loop -shared -forever -bg -auth /var/run/lightdm/root/:0 -rfbport 5900 -o /var/log/vnc.log > /dev/null 2>&1 &
    chmod +x /etc/local.d/vnc.start

Now you should be able to access Alpine Linux with any VNC Viewer.

Systemd startup script

[Unit]
After=display-manager.service
Description=x11vnc VNC Server for X11
Requires=display-manager.service

[Service]
# For GDM {
# ExecStart=x11vnc -auth /var/lib/gdm/:0.Xauth -bg -display :0 -forever
# or (replace gdm uid)
# ExecStart=x11vnc -auth /run/user/120/gdm/Xauthority -bg -display :0 -forever
# }
# For Lightdm {
# ExecStart=x11vnc -auth /var/run/lightdm/root/:0 -bg -display :0 -forever
# }
# For LXDM {
# ExecStart=x11vnc -auth /var/run/lxdm/lxdm-:0.auth -bg -display :0 -forever
# }
# For SDDM {
ExecStart=x11vnc -auth $SDDMXAUTH -bg -display :0 -forever
ExecStartPre=bash -c "systemctl set-environment SDDMXAUTH=$(find /var/run/sddm -type f)"
# }
# For SLIM {
# ExecStart=x11vnc -auth /var/run/slim.auth -bg -display :0 -forever
# }
ExecStop=pkill x11vnc
Restart=on-failure
RestartSec=2
Type=forking

[Install]
WantedBy=graphical.target