---
title: "Deploy Ubuntu 24.04 Cloud Dev Box (Web Terminal + Claude Code, Codex, Gemini CLI)"
description: "Persistent Ubuntu web terminal with Claude Code, Codex & Gemini CLI"
category: "Other"
url: https://railway.com/deploy/ubuntu-2404-cloud-dev-box-web-terminal-c
---

# Deploy Ubuntu 24.04 Cloud Dev Box (Web Terminal + Claude Code, Codex, Gemini CLI)

Persistent Ubuntu web terminal with Claude Code, Codex & Gemini CLI

**[Deploy Ubuntu 24.04 Cloud Dev Box (Web Terminal + Claude Code, Codex, Gemini CLI) on Railway](https://railway.com/template/ubuntu-2404-cloud-dev-box-web-terminal-c)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/ubuntu-2404-cloud-dev-box-web-terminal-c/manifest.json

- **Creator:** Nick K's Projects
- **Category:** Other
- **Total deploys:** 2

## Template content

### Ubuntu Dev Box https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/ubuntu-linux.svg

- **Image:** ubuntu:24.04
- **Start command:** `bash -c 'set +e
export DEBIAN_FRONTEND=noninteractive
BIN=/root/.local/bin; mkdir -p "$BIN" /root/workspace
export PATH="$BIN:$PATH"
if [ ! -x "$BIN/ttyd" ]; then
  echo "[boot] fetching web terminal..."
  (command -v curl >/dev/null 2>&1 || (apt-get update -qq && apt-get install -y -qq curl ca-certificates)) >/dev/null 2>&1
  ARCH=$(uname -m); case "$ARCH" in aarch64|arm64) TA=aarch64;; *) TA=x86_64;; esac
  curl -fsSL -o "$BIN/ttyd" "https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.$TA" && chmod +x "$BIN/ttyd" || echo "[boot] ttyd download failed"
fi
if [ ! -f /root/.tools-installed ]; then
  echo "[boot] installing tools (first boot only, may take a few minutes)..."
  (apt-get update -qq && apt-get install -y -qq curl wget git vim nano htop tmux unzip zip jq ca-certificates gnupg build-essential python3 python3-pip python3-venv openssh-client sudo ripgrep) >/tmp/apt.log 2>&1 && touch /root/.tools-installed || { echo "[boot] some packages failed; see /tmp/apt.log"; tail -n 5 /tmp/apt.log; }
fi
if [ ! -f /root/.ai-clis-installed ]; then
  echo "[boot] installing Node 22 + AI coding CLIs..."
  (curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && apt-get install -y -qq nodejs && npm install -g --silent @anthropic-ai/claude-code @openai/codex @google/gemini-cli) >/tmp/node.log 2>&1 && touch /root/.ai-clis-installed || { echo "[boot] AI CLI install issue; see /tmp/node.log"; tail -n 5 /tmp/node.log; }
fi
[ -n "$GIT_USER_NAME" ] && git config --global user.name "$GIT_USER_NAME"
[ -n "$GIT_USER_EMAIL" ] && git config --global user.email "$GIT_USER_EMAIL"
touch /root/.bashrc
grep -q "railway-box" /root/.bashrc || cat >> /root/.bashrc <<"BASHRC"
# railway-box
export PATH="/root/.local/bin:$PATH"
export PS1="\[\e[1;32m\]\u@railway\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\$ "
cd /root/workspace
echo "Ubuntu dev box | CLIs: claude, codex, gemini | files persist in /root"
BASHRC
if [ ! -x "$BIN/ttyd" ]; then echo "[boot] FATAL: web terminal binary missing; idling so you can inspect logs"; sleep infinity; fi
echo "[boot] terminal ready on port $PORT"
exec "$BIN/ttyd" -p "$PORT" -W -c "$USERNAME:$PASSWORD" -t fontSize=14 -t titleFixed="Ubuntu Dev Box" bash -l'`
- **Public domain:** Yes

## Documentation

# Deploy and Host Ubuntu Cloud Dev Box on Railway

Ubuntu Cloud Dev Box is a persistent Ubuntu 24.04 LTS machine you open in your browser. It boots with Node.js 22, Python 3, git, build tools and the three major AI coding agents — **Claude Code**, **OpenAI Codex CLI** and **Google Gemini CLI** — pre-installed, behind a password-protected web terminal. Run agents on long tasks, clone repos, test scripts or just have a Linux shell from any device, including an iPad or a locked-down work laptop.

## About Hosting Ubuntu Cloud Dev Box

The template deploys the official `ubuntu:24.04` image with a start command that installs the toolchain on boot (about 2–3 minutes on first deploy) and then launches `ttyd`, a lightweight web terminal, on your Railway public domain with HTTP basic auth (`USERNAME` / generated `PASSWORD`). Your home directory `/root` — including `/root/workspace`, Claude Code settings, Codex and Gemini logins, SSH keys and shell history — is on a Railway volume, so everything survives restarts and redeploys. Set `ANTHROPIC_API_KEY`, `OPENAI_API_KEY` or `GEMINI_API_KEY` to skip interactive login, or log in once inside the terminal (subscription logins persist on the volume). 1 GB RAM is plenty for CLI agents; scale up for heavy builds.

## Common Use Cases

- Run Claude Code / Codex / Gemini CLI on long autonomous coding tasks without keeping your laptop awake
- A disposable-but-persistent Linux sandbox for trying tools, scripts and repos safely
- Remote dev shell from a tablet, Chromebook or restricted corporate machine
- Cheap always-on box for cron jobs, scrapers and CLI utilities

## Dependencies for Ubuntu Cloud Dev Box Hosting

- Docker image `ubuntu:24.04` (installs ttyd, Node 22, Python 3, git and the AI CLIs on boot)
- A Railway volume mounted at `/root`
- `USERNAME` + `PASSWORD` for the web terminal (password is generated for you — copy it from Variables)

### Implementation Details

Open your public domain, enter the username and password from the service's Variables tab, then:

```bash
claude        # Claude Code (uses ANTHROPIC_API_KEY or /login)
codex         # OpenAI Codex CLI
gemini        # Google Gemini CLI
```

Use `tmux` to keep agents running while you close the tab. To add more packages permanently, extend the Start Command in the service settings.

## Why Deploy Ubuntu Cloud Dev Box on Railway?


Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Ubuntu Cloud Dev Box on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/ubuntu-2404-cloud-dev-box-web-terminal-c
