# Selkies setup guide ## 1. Install dependencies ```bash sudo apt-get update sudo apt-get install --no-install-recommends -y python3 python3-pip python3-dev jq ca-certificates curl xserver-xorg-core xvfb x11-utils x11-xkb-utils x11-xserver-utils libx11-xcb1 libxcb-dri3-0 libxkbcommon0 libxdamage1 libxfixes3 libxtst6 libxext6 libpulse0 xfce4 xfce4-terminal dbus-x11 xauth pipewire pipewire-pulse wireplumber ffmpeg nginx certbot python3-certbot-nginx curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - sudo apt-get install -y nodejs ``` ## 2. Install Selkies ```bash git clone https://github.com/selkies-project/selkies.git cd selkies pip install . --break-system-packages ``` ## 4. Setup XVFB service Create: `/etc/systemd/system/xvfb.service` ```ini [Unit] Description=X Virtual Frame Buffer Service After=network.target [Service] Type=simple ExecStart=/usr/bin/Xvfb :1 -screen 0 1920x1080x24 +extension GLX +extension RANDR -ac Restart=always [Install] WantedBy=multi-user.target ``` Run: ```bash sudo systemctl daemon-reload sudo systemctl enable --now xvfb ``` ## 5. Build front-end ```bash git clone https://github.com/selkies-project/selkies.git cd ~/selkies/addons/selkies-web-core npm install npm run build cd ~/selkies/addons/selkies-dashboard-wish npm install npm run build ``` ## 6. Enable lingering for the pipewire/pulse user session `selkies.service` runs as a system unit but points at `/run/user/1000` for pipewire/pulse, which only exists once that user has an active systemd session. Without this, audio silently fails at boot: ```bash sudo loginctl enable-linger lily ``` ## 7. Setup XFCE service Create: `/etc/systemd/system/xfce-session.service` ```ini [Unit] Description=XFCE session on :1 After=xvfb.service Requires=xvfb.service [Service] User=lily Environment=DISPLAY=:1 Environment=XDG_RUNTIME_DIR=/run/user/1000 ExecStart=/usr/bin/startxfce4 Restart=always RestartSec=3 [Install] WantedBy=multi-user.target ``` Run: ```bash sudo systemctl enable --now xfce-session.service ``` ## 8. Setup Selkies service Create: `/etc/systemd/system/selkies.service` ```ini [Unit] Description=Selkies remote desktop After=xvfb.service xfce-session.service network.target user@1000.service Requires=xvfb.service xfce-session.service [Service] User=lily Environment=DISPLAY=:1 Environment=XDG_RUNTIME_DIR=/run/user/1000 Environment=PIPEWIRE_LATENCY=128/48000 Environment=PULSE_RUNTIME_PATH=/run/user/1000/pulse Environment=PULSE_SERVER=unix:/run/user/1000/pulse/native ExecStart=/usr/local/bin/selkies --addr=127.0.0.1 --port=8081 --web-root=/home/lily/selkies/addons/selkies-dashboard-wish/dist --enable-https=false --basic-auth-user={username} --basic-auth-password={password} --encoder=h264enc --enable-resize=true Restart=always RestartSec=3 [Install] WantedBy=multi-user.target ``` Run: ```bash sudo systemctl daemon-reload sudo systemctl enable --now selkies ``` ## 9. Setup nginx Replace `/etc/nginx/sites-enabled/default`: ```nginx server { server_name {vps hostname}; location / { proxy_pass http://127.0.0.1:8081/; # WebSocket support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; # Standard proxy headers proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Authorization $http_authorization; proxy_pass_header Authorization; # Prevent connection drops during active streaming proxy_read_timeout 600s; proxy_send_timeout 600s; # Disable SSL verification for internal self-signed certs proxy_ssl_verify off; } } ``` ## 10. Generate certificates for https ```bash sudo certbot --nginx -d {your hostname} sudo systemctl restart nginx ```