Deploy Ubuntu Linux | Most Popular Linux Distro
Self Host Ubuntu on Railway: browser shell, basic auth, one click.
Just deployed
Deploy and Host Ubuntu Web Terminal on Railway
Deploy Ubuntu on Railway with a browser-accessible terminal powered by ttyd — no SSH client, VPN, or local VM required. Self-host Ubuntu 24.04 LTS as a lightweight cloud shell you can access from any device with a web browser, pre-loaded with Python 3, Node.js, curl, wget, and git.
This Railway template provisions a single Ubuntu container running ttyd (a web-based terminal emulator), secured with HTTP Basic Auth via USERNAME and PASSWORD environment variables. The container uses tini as PID 1 for proper signal handling and zombie process reaping, and exposes a single HTTPS port that Railway routes to automatically.
Getting Started with Ubuntu Web Terminal on Railway
Once your Railway deployment is live, click the generated .up.railway.app domain to open the web terminal. Your browser will prompt for HTTP Basic Auth credentials — enter the USERNAME and PASSWORD values you configured in the service's environment variables.
After login, you land in a full bash shell running as root on Ubuntu 24.04 LTS. neofetch runs automatically on each new session, displaying system info (OS, kernel, CPU, memory). The terminal supports copy-paste, keyboard input, and standard terminal escape sequences via Xterm.js. Install additional packages with apt-get install as needed — but note that anything installed at runtime is lost on redeploy unless you attach a Railway volume to persist /root or another directory.
To customize the shell environment, edit /root/.bashrc directly in the terminal. Changes persist across browser refreshes within the same deployment but are reset on redeploy.
About Hosting Ubuntu Web Terminal on Railway
Ubuntu Web Terminal combines Ubuntu 24.04 LTS with ttyd, an open-source command-line tool that shares a terminal session over HTTP using WebSockets and Xterm.js. It solves the problem of needing shell access to a cloud Linux environment without installing SSH clients, managing keys, or setting up VPNs.
Key features:
- Full Ubuntu 24.04 LTS environment with apt package manager
- Browser-based terminal via ttyd — works on desktop, tablet, and mobile
- HTTP Basic Auth built in (
-c username:password) - tini init process for proper signal forwarding and zombie reaping
- Multi-architecture support (x86_64 and ARM64)
- Pre-installed: Python 3, pip, curl, wget, git, neofetch
- Xterm.js frontend with CJK/IME support and ZMODEM file transfer
Why Deploy Ubuntu Web Terminal on Railway
Access a full Linux shell from any browser — no SSH setup, no local VM, no VPN.
- Zero client requirements — any device with a browser gets shell access
- Instant provisioning — deploy in under 2 minutes on Railway
- Secured by default — HTTP Basic Auth via environment variables
- Full root access — install anything with
apt-get - Persistent storage — attach a Railway volume to keep files across redeploys
Common Use Cases for Ubuntu Web Terminal on Railway
- Cloud dev environment — a throwaway Linux shell for testing scripts, installing tools, or running one-off commands without polluting your local machine
- Remote administration — access a Linux terminal from a tablet or phone when you're away from your workstation
- Teaching and demos — share a browser URL with students or colleagues to demonstrate Linux commands in real-time
- CI/CD debugging — spin up a quick shell to reproduce build issues in a clean Ubuntu environment
Dependencies for Self-Hosting Ubuntu Web Terminal
| Service | Source | Purpose |
|---|---|---|
| Ubuntu + ttyd | Custom Dockerfile (ubuntu:24.04 + ttyd binary) | Ubuntu OS with browser-based terminal |
Environment Variables Reference for Ubuntu Web Terminal on Railway
| Variable | Required | Description |
|---|---|---|
PORT | Yes (auto-set by Railway) | HTTP port ttyd listens on. Railway sets this automatically |
USERNAME | Yes | HTTP Basic Auth username for the web terminal |
PASSWORD | Yes | HTTP Basic Auth password for the web terminal |
Deployment Dependencies
- Base image: ubuntu:24.04 (Docker Hub official)
- Web terminal: tsl0922/ttyd — MIT licensed, 11.4k GitHub stars
- Init process: tini — installed via apt
- License: MIT (ttyd) / Canonical Ubuntu license (Ubuntu base image) — free to self-host
Hardware Requirements for Self-Hosting Ubuntu Web Terminal
Ubuntu + ttyd is extremely lightweight. The base container idles at under 50 MB RAM.
| Resource | Minimum | Recommended |
|---|---|---|
| CPU | 0.1 vCPU | 0.5 vCPU |
| RAM | 64 MB | 256 MB |
| Storage | None (stateless) | 1 GB (with Railway volume for persistence) |
| Runtime | Docker | Docker |
Resource usage scales with what you run inside the terminal. Heavy compilation or large package installs will temporarily spike CPU and RAM.
Self-Hosting Ubuntu Web Terminal with Docker
Dockerfile:
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
ca-certificates wget curl git \
python3 python3-pip \
tini neofetch \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN set -eux; \
arch="$(uname -m)"; \
case "$arch" in \
x86_64|amd64) ttyd_asset="ttyd.x86_64" ;; \
aarch64|arm64) ttyd_asset="ttyd.aarch64" ;; \
*) echo "Unsupported arch: $arch" >&2; exit 1 ;; \
esac; \
wget -qO /usr/local/bin/ttyd \
"https://github.com/tsl0922/ttyd/releases/latest/download/${ttyd_asset}" \
&& chmod +x /usr/local/bin/ttyd
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["/bin/bash", "-lc", \
"/usr/local/bin/ttyd --writable -i 0.0.0.0 -p ${PORT:-7681} -c ${USERNAME}:${PASSWORD} /bin/bash"]
Build and run locally:
docker build -t ubuntu-ttyd .
docker run -d -p 8080:8080 \
-e PORT=8080 \
-e USERNAME=admin \
-e PASSWORD=changeme \
ubuntu-ttyd
Open http://localhost:8080 in your browser and log in with admin / changeme.
How Much Does Ubuntu Web Terminal Cost to Self-Host?
Both Ubuntu (base image) and ttyd (MIT license) are completely free and open source. There are no licensing fees, subscription costs, or usage limits. Running this on Railway costs only the infrastructure — the idle container uses under 64 MB RAM and negligible CPU, making it one of the cheapest possible Railway deployments. You pay only for Railway compute and any attached volume storage.
Ubuntu Web Terminal vs SSH — Which Should You Use on Railway?
| Feature | Ubuntu + ttyd (Web Terminal) | Ubuntu + SSHD |
|---|---|---|
| Client required | Any web browser | SSH client (terminal app) |
| Auth method | HTTP Basic Auth | SSH keys or password |
| Mobile access | Excellent (browser) | Requires SSH app |
| File transfer | ZMODEM via browser | SCP / SFTP |
| Port exposure | Single HTTP port | SSH port (22) |
| Shareable | Share URL + credentials | Share SSH key or password |
| Setup complexity | Zero — just open the URL | Manage SSH keys, config |
Summary: Choose the web terminal if you want zero-setup browser access from any device. Choose SSHD if you need SCP/SFTP file transfer, SSH tunneling, or prefer key-based authentication.
FAQ
What is Ubuntu Web Terminal and why self-host it on Railway? Ubuntu Web Terminal is a Docker container running Ubuntu 24.04 LTS with ttyd, an open-source tool that exposes a bash shell via a web browser over HTTP/WebSocket. Self-hosting on Railway gives you a persistent cloud Linux environment accessible from any browser — no SSH client, VPN, or local VM required.
What does this Railway template deploy?
It deploys a single service: an Ubuntu 24.04 LTS container with ttyd pre-installed. ttyd serves a full bash terminal over HTTPS on the Railway-generated domain, secured with HTTP Basic Auth using the USERNAME and PASSWORD environment variables.
How do I persist files across redeploys on Railway?
By default the container is stateless — all files are lost on redeploy. To persist data, attach a Railway volume (e.g. mounted at /root) via the Railway dashboard. Any files stored in the mounted directory will survive redeploys and restarts.
How do I install additional packages in the Ubuntu Web Terminal?
Run apt-get update && apt-get install -y in the terminal. You have full root access. Note that packages installed at runtime are lost on redeploy unless the installation directory is backed by a Railway volume.
Is the Ubuntu Web Terminal secure on Railway? The terminal is protected by HTTP Basic Auth (username + password). Railway provides HTTPS encryption on all generated domains, so credentials and terminal traffic are encrypted in transit. For additional security, use a strong password and consider placing the terminal behind an OAuth2 proxy.
Can I use the Ubuntu Web Terminal for long-running processes on Railway?
Yes — processes started in the terminal persist as long as the Railway service is running. However, closing the browser tab disconnects your terminal session (though background processes started with nohup or tmux continue running). Install tmux or screen to maintain persistent sessions.
How do I change the default shell or terminal prompt in self-hosted Ubuntu?
Edit /root/.bashrc in the terminal. The template sets a custom colored prompt (PS1) automatically. To change the default shell, install your preferred shell (e.g. apt-get install zsh) and update the ttyd CMD to launch it instead of /bin/bash.
Template Content
PASSWORD
password for access
USERNAME
username for access