Last active
January 26, 2025 10:55
-
-
Save bpmct/4e51d7092089f278c91f53e344749b6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This has been tested on the aws-linux Coder template, which runs Ubuntu Focal | |
# Check if LXDE is installed | |
if ! dpkg -s lxde &> /dev/null; then | |
sudo apt-get update | |
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y lxde | |
else | |
echo "LXDE is already installed." | |
fi | |
# Check if vncserver is installed | |
if ! dpkg -s kasmvncserver &> /dev/null; then | |
cd /tmp | |
wget https://github.com/kasmtech/KasmVNC/releases/download/v1.1.0/kasmvncserver_focal_1.1.0_amd64.deb | |
sudo apt install -y ./kasmvncserver_focal_1.1.0_amd64.deb | |
else | |
echo "VNC Server is already installed." | |
fi | |
sudo addgroup $USER ssl-cert | |
# Coder port-forwarding from dashboard only supports HTTP | |
sudo bash -c 'cat > /etc/kasmvnc/kasmvnc.yaml <<EOF | |
network: | |
protocol: http | |
ssl: | |
require_ssl: false | |
udp: | |
public_ip: 127.0.0.1 | |
EOF' | |
# This password is not used since we start the server without auth. | |
# The server is protected via the Coder session token / tunnel | |
# and does not listen publicly on the VM | |
echo -e "password\npassword\n" | vncpasswd -wo -u $USER | |
# Start the server :) | |
sudo su -u $USER bash -c 'vncserver -select-de "lxde" -disableBasicAuth' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment