Skip to content

Instantly share code, notes, and snippets.

@rma92
Last active November 9, 2025 13:57
Show Gist options
  • Select an option

  • Save rma92/16a2390c03033ff90d422af6b5299f5c to your computer and use it in GitHub Desktop.

Select an option

Save rma92/16a2390c03033ff90d422af6b5299f5c to your computer and use it in GitHub Desktop.
Some configurations to set up Alpine as an RDP server, can be used with diskless or read-only file system, to make lightweight immutable images.

Alpine Xrdp Desktops

Some xrdp terminal server configurations

General useful things

You may want to add a tmpfs for user's .cache files to /etc/fstab. vi /etc/fstab:

tmpfs /home/*/.cache    tmpfs   size=512M,nodev,nosuid  0   0

You may want to add the user home directories to lbu:

lbu add /home

Or at least add the xinitrc and config for the user if you edit them:

lbu add /home/user/.config
lbu add /home/user/.xinitrc

Remember to run lbu ci when you're done if you're running in diskless mode.

Remember to purge empty space before taking compressed images (or compacting disk):

dd if=/dev/zero of=/EMPTY bs=1M
rm /EMPTY

Add ublock origin system-wide

(do as root)

mkdir -p /usr/lib/firefox/distribution
wget -O /usr/lib/firefox/ublock_origin.xpi https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/addon-607454-latest.xpi
cat << 'EOF' > /usr/lib/firefox/distribution/policies.json
{
  "policies": {
    "Extensions": {
      "Install": ["file:///usr/lib/firefox/ublock_origin.xpi"]
    }
  }
}
EOF
lbu add /usr/lib/firefox/distribution/policies.json
lbu add /usr/lib/firefox/ublock_origin.xpi

(do lbu ci when done, lbu add isn't needed for a flat system)

LxQt on Xrdp

#enable community repo by editing /etc/apk/repositories
apk update
apk add xorg-server xinit xterm dbus dbus-x11 xrdp xorgxrdp font-terminus font-dejavu xfce4 xfce4-terminal
rc-update add dbus default
rc-service dbus start
rc-update add xrdp default
rc-update add xrdp-sesman default
rc-service xrdp-sesman start
rc-service xrdp start
apk add obconf-qt pavucontrol-qt adwaita-qt oxygen 

as normal user:

echo "exec dbus-launch --exit-with-session startlxqt" >> ~/.xinitrc

OpenBox on LxQt

#enable community repo by editing /etc/apk/repositories
apk update
apk add xorg-server openbox xinit xterm dbus dbus-x11 xrdp xorgxrdp font-terminus
rc-update add dbus default
rc-service dbus start
rc-update add xrdp default
rc-update add xrdp-sesman default
rc-service xrdp-sesman start
rc-service xrdp start

It tries to run the user's xinitrc. As the normal user

mkdir -p ~/.config
cp -r /etc/xdg/openbox ~/.config
echo "exec dbus-launch --exit-with-session openbox-session" >> ~/.xinitrc

It tries to run /etc/X11/xinit/xinitrc if it's present. That tries to run ~/.xinitrc. Then it tries /etc/X11/xinit/xinitrc.d/?*

XFCE on LxQt

#enable community repo by editing /etc/apk/repositories
apk update
apk add xorg-server xinit xterm dbus dbus-x11 xrdp xorgxrdp font-terminus font-dejavu xfce4 xfce4-terminal
rc-update add dbus default
rc-service dbus start
rc-update add xrdp default
rc-update add xrdp-sesman default
rc-service xrdp-sesman start
rc-service xrdp start

(No further config is required as Xfce4 sets itself up correctly)

Add a Console / Local Desktop

With only startx

Add xorg-server and set up your user to be in appropriate groups.

apk add xorg-server xinit xterm
sudo adduser $USER video
sudo adduser $USER input
sudo adduser $USER tty

Now you can run startx.

With graphical logon

apk add elogind lightdm lightdm-gtk-greeter polkit-elogind gvfs mesa-dri-gallium udev dbus-glib xf86-input-libinput 
# xfce4-screensaver

rc-update add dbus
rc-service dbus start

rc-update add elogind boot
rc-service elogind start

rc-update add lightdm default
rc-service lightdm start

rc-update add udev default
rc-service udev start

setup-devd udev

Default Set up xfce

setup-xorg-base xfce4 elogind ${BROWSER:-firefox} gvfs lightdm lightdm-gtk-greeter polkit-elogind xfce4-terminal font-dejavu

Old Set up lxqt

Normal:

setup-xorg-base lxqt-desktop lximage-qt obconf-qt pavucontrol-qt openbox arandr adwaita-qt oxygen elogind ${BROWSER:-firefox} gvfs lightdm lightdm-gtk-greeter polkit-elogind font-dejavu
# apk add xorg-server xf86-input-libinput xinit eudev mesa-dri-gallium 
setup-xorg-base lxqt-desktop openbox oxygen elogind gvfs lightdm lightdm-gtk-greeter polkit-elogind font-dejavu lxqt-powermanagement lxqt-themes 
apk add dbus dbus-x11
rc-update add elogind
rc-update add lightdm
rc-update add dbus default
rc-service dbus start

vi ~/.xsession

#!/bin/sh
# Start LXQt (uses Openbox as WM if installed/configured)
export DESKTOP_SESSION=lxqt
export XDG_CURRENT_DESKTOP=LXQt
export XDG_MENU_PREFIX=lxqt-
export QT_QPA_PLATFORMTHEME=lxqt
[ -r /etc/profile ] && . /etc/profile
exec dbus-launch --exit-with-session startlxqt
# OpenBox without lxqt
# exec dbus-launch --exit-with-session openbox-session

Lean:

# apk add openbox xterm terminus-font
apk add lxqt-desktop lxqt-core lxqt-panel lxqt-admin lxqt-config lxqt-notificationd 
# apk add lxqt-powermanagement lxqt-themes openbox
apk add lxqt-desktop openbox oxygen elogind gvfs lightdm lightdm-gtk-greeter polkit-elogind font-dejavu

apk add lximage-qt obconf-qt pavucountrol-qt arandr adwaita-qt 
setup-devd udev

Alpine with Docker Xrdp container

This container works well, but compositor should be off by default. I also had to log in by xrdp twice (it disconnected the first time, logging in again worked)

apk add docker
rc-update add docker boot
service docker start
docker run -d --name rdp --shm-size 1g -p 3389:3389 danielguerra/alpine-xfce4-xrdp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment