Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save si3mshady/4fddaabac9cd61e66fc744124eefbc10 to your computer and use it in GitHub Desktop.

Select an option

Save si3mshady/4fddaabac9cd61e66fc744124eefbc10 to your computer and use it in GitHub Desktop.
πŸ’» Installs a full XFCE desktop environment and XRDP server on Ubuntu, enabling remote desktop access to run QGroundControl, DroneKit scripts, Prometheus, Grafana, and LangChain-based AI agents. This script is the foundation for developing, testing, and teaching agentic drone systems in a cloud-hosted environment. Ideal for educators, drone devel…
#!/bin/bash
# === STEP 0: Update System ===
echo "[*] Updating system..."
sudo apt-get update && sudo apt-get upgrade -y
# === STEP 1: Install XFCE Desktop Environment ===
echo "[*] Installing XFCE4 desktop environment..."
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y xfce4 xfce4-session
# === STEP 2: Install XRDP and dependencies ===
echo "[*] Installing XRDP and Xorg backend..."
sudo apt-get install -y xrdp xorgxrdp
sudo systemctl enable xrdp
# === STEP 3: Add xrdp user to ssl-cert group ===
echo "[*] Adding xrdp to ssl-cert group..."
sudo adduser xrdp ssl-cert
# === STEP 4: Configure xrdp to use XFCE ===
echo "[*] Configuring XRDP to use XFCE4..."
echo "startxfce4" > ~/.xsession
# Patch /etc/xrdp/startwm.sh to avoid blank screen
echo "[*] Patching /etc/xrdp/startwm.sh to launch XFCE..."
sudo sed -i.bak '/fi/a startxfce4' /etc/xrdp/startwm.sh
# === STEP 5: Restart XRDP service ===
echo "[*] Restarting XRDP..."
sudo systemctl restart xrdp
# === STEP 6: Set password for current user ===
echo "[*] Setting password for user: $USER"
sudo passwd $USER
# === STEP 7: Open port 3389 for RDP ===
echo "[*] Allowing RDP through firewall (TCP 3389)..."
sudo ufw allow 3389/tcp
sudo ufw reload
# === DONE ===
echo "[βœ…] XRDP setup complete. You can now connect via RDP to your VM using:"
echo "πŸ‘‰ IP or External DNS"
echo "πŸ‘‰ Port: 3389"
echo "πŸ‘‰ Username: $USER"
echo "πŸ‘‰ Password: the one you just set"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment