Created
November 14, 2025 16:14
-
-
Save treuille/b6c59f8afb387a7a828d6e79f40958c2 to your computer and use it in GitHub Desktop.
Install script to create a WebTop server on Digital Ocean
This file contains hidden or 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
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| echo "=== Remote Desktop Webtop Bootstrap ===" | |
| #----------------------------- | |
| # 0. Sanity checks | |
| #----------------------------- | |
| if [ "$(id -u)" -ne 0 ]; then | |
| echo "This script must be run as root. Try: sudo bash $0" | |
| exit 1 | |
| fi | |
| # Default timezone (change if you like) | |
| TZ_VALUE="Etc/UTC" | |
| WEBTOP_DIR="/root/webtop" | |
| COMPOSE_FILE="$WEBTOP_DIR/docker-compose.yml" | |
| #----------------------------- | |
| # 1. Update system + basic tools | |
| #----------------------------- | |
| echo "[1/5] Updating apt and installing basics..." | |
| apt-get update -y | |
| apt-get install -y ufw ca-certificates curl gnupg lsb-release | |
| #----------------------------- | |
| # 2. Firewall: allow SSH only | |
| #----------------------------- | |
| echo "[2/5] Configuring UFW firewall (SSH only)..." | |
| # Allow SSH and lock down everything else | |
| ufw allow 22/tcp | |
| ufw default deny incoming | |
| ufw default allow outgoing | |
| # Enable non-interactively | |
| ufw --force enable | |
| echo "UFW status:" | |
| ufw status verbose || true | |
| #----------------------------- | |
| # 3. Install Docker + Compose v2 | |
| #----------------------------- | |
| echo "[3/5] Installing Docker Engine and Compose plugin..." | |
| # Official Docker repo (clean and current) | |
| install -m 0755 -d /etc/apt/keyrings | |
| if [ ! -f /etc/apt/keyrings/docker.gpg ]; then | |
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg \ | |
| | gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
| chmod a+r /etc/apt/keyrings/docker.gpg | |
| fi | |
| DOCKER_LIST="/etc/apt/sources.list.d/docker.list" | |
| if [ ! -f "$DOCKER_LIST" ]; then | |
| echo \ | |
| "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \ | |
| https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \ | |
| > "$DOCKER_LIST" | |
| fi | |
| apt-get update -y | |
| apt-get install -y \ | |
| docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
| systemctl enable docker | |
| systemctl start docker | |
| echo "Docker version:" | |
| docker --version || true | |
| echo "Docker Compose plugin version:" | |
| docker compose version || true | |
| #----------------------------- | |
| # 4. Create Webtop Docker Compose setup | |
| #----------------------------- | |
| echo "[4/5] Creating Webtop docker-compose.yml..." | |
| mkdir -p "$WEBTOP_DIR" | |
| mkdir -p "$WEBTOP_DIR/config/Desktop" | |
| cat > "$COMPOSE_FILE" <<'EOF' | |
| version: "3.8" | |
| services: | |
| webtop: | |
| image: lscr.io/linuxserver/webtop:ubuntu-xfce | |
| container_name: webtop | |
| restart: unless-stopped | |
| ports: | |
| - "3000:3000" # accessed via SSH tunnel only | |
| environment: | |
| - PUID=0 # root inside container is fine for this throwaway box | |
| - PGID=0 | |
| - TZ=Etc/UTC | |
| - DISPLAY_WIDTH=1280 | |
| - DISPLAY_HEIGHT=720 | |
| volumes: | |
| - ./config:/config | |
| EOF | |
| #----------------------------- | |
| # 5. Bring up Webtop | |
| #----------------------------- | |
| echo "[5/5] Starting Webtop container..." | |
| cd "$WEBTOP_DIR" | |
| docker compose up -d | |
| echo | |
| echo "Docker containers:" | |
| docker compose ps | |
| #----------------------------- | |
| # Final message | |
| #----------------------------- | |
| cat <<EOF | |
| =========================================== | |
| We did it! 🎉 Remote desktop is ready. | |
| =========================================== | |
| Webtop is running on port 3000 with credentials: | |
| username: abc | |
| password: abc | |
| Anything you copy to this directory on the droplet: | |
| ${WEBTOP_DIR}/config/Desktop/ | |
| will appear on the Webtop desktop. | |
| Firewall status: | |
| - Incoming: DENY by default | |
| - Allowed: 22/tcp (SSH only) | |
| Enjoy your secure remote browsing box. | |
| We did it! | |
| =========================================== | |
| EOF | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment