
Deploy Ubuntu + Claude Code
Claude Code on Ubuntu 26.04 in your browser and over SSH
Just deployed
/home
Deploy and Host self hosted Claude Code on Ubuntu (Browser Terminal & SSH) on Railway
Ubuntu + Claude Code gives you Claude Code running on Ubuntu 26.04 LTS, reachable from a browser terminal and over real SSH.
About Hosting Ubuntu + Claude Code open-source software on Railway (self hosted Claude Code template)
Ubuntu + Claude Code is an MIT-licensed template from onepush-dev that runs Claude Code 2.1.314 on Ubuntu 26.04.1 LTS. Railway handles the container, TLS, restarts and the volume.
Why Deploy Ubuntu + Claude Code, the GitHub Codespaces / cloud dev box alternative on Railway (Railway Free Trial)
Codespaces suits teams who want GitHub to own the whole dev environment, but you pay by the hour and work inside their VM model.
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 + Claude Code 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.
Railway vs Other Hosting Providers and VPS for Claude Code self hosting
| Provider | What You Get with Railway | What You Get with the Other Provider |
|---|---|---|
| DigitalOcean | A browser terminal, SSH proxy and persistent /home volume from zero deploy inputs. | A Droplet you size and patch yourself, billed whether you use it or not. |
| AWS | Ubuntu 26.04 with Claude Code 2.1.314 and tmux already running, no IAM or security group setup. | Fine-grained control over networking and regions, but you configure EC2, EBS and key pairs first. |
| Hetzner | SSH and browser access without picking a server size or installing Node 22 yourself. | Low raw compute cost and full root, at the price of doing every install and hardening step by hand. |
Common Use Cases for hosted Ubuntu + Claude Code
- Long sessions that outlive your laptop: Start a big refactor or a test-fix loop in claude, close the lid, and come back later to the same tmux session with the output still scrolling.
- Picking up work from a phone or iPad: Open an SSH client on the go, connect to the TCP proxy host and port, and reattach to the session your browser started.
- A sandbox the agent never touches locally: Let Claude Code run shell commands, installs and file edits on the box so your laptop stays clean and nothing leaks into your local home directory.
- Routing through a gateway: Set ANTHROPIC_BASE_URL as a service variable and redeploy so every Claude Code session on the box goes through your proxy.
- A shared team scratch box: Give a few people SSH keys through SSH_AUTHORIZED_KEYS and let them share one Ubuntu environment for quick experiments.
Dependencies for Ubuntu + Claude Code Docker hosted on Railway
The whole stack runs as one Railway service built from a single image. Only the volume mounted at /home persists.
Deployment Dependencies for Managed Claude Code Service (ttyd + OpenSSH + tmux + Claude Code)
The web terminal is ttyd on port 7681, protected by HTTP basic auth with TERMINAL_USER (default ubuntu) and TERMINAL_PASSWORD. The browser and SSH logins share one tmux session named main.
Implementation Details for Ubuntu + Claude Code (Ubuntu 26.04, Claude Code 2.1.314, Node 22, ttyd 1.7.7)
Node.js 22 and npm sit alongside Python 3 with pip and venv, plus ripgrep, build-essential and git.
How does Ubuntu + Claude Code compare against other ways to run Claude Code remotely
Ubuntu + Claude Code vs GitHub Codespaces (GitHub Codespaces Alternative)
- Session model: Codespaces gives you a VS Code environment tied to GitHub. Ubuntu + Claude Code gives you a plain Ubuntu 26.04 box where the browser terminal and SSH share one tmux session.
- Editor: Codespaces wins if you want a full VS Code experience in the browser. This template is terminal first.
- Persistence: Only /home survives a redeploy, so apt installs vanish on rebuild. Codespaces handles more of that for you.
Ubuntu + Claude Code vs code-server (code-server Alternative)
- Weight: code-server runs the full VS Code UI, which is heavier. Ubuntu + Claude Code is a leaner terminal box with Claude Code preinstalled.
- Access: code-server is reached through a browser tab. Ubuntu + Claude Code also offers real SSH through a Railway TCP proxy.
- Editor: code-server wins if you want extensions and a visual editor.
Ubuntu + Claude Code vs browser-only Claude Code templates (Browser-Only Claude Code Alternative)
- Real SSH: Browser-only templates give you a web terminal and nothing else. Here, sshd runs alongside ttyd, so scp, sftp and standard SSH clients work.
- Shell access: This template gives you a full Ubuntu shell with sudo and tmux.
- Simplicity: A browser-only template wins if you only need a quick chat with Claude Code.
Ubuntu + Claude Code vs a plain VPS (VPS Alternative)
- Setup work: A plain VPS means you handle the OS, firewall, TLS and updates yourself. Ubuntu + Claude Code comes preconfigured with ttyd, OpenSSH, tmux and Claude Code.
- Control: A VPS wins if you need systemd, Docker-in-Docker, inbound UDP or a true VM. This template is a container, not a VM.
- Cost and ownership: A VPS can be cheaper at steady load and gives you full root control.
How to use Ubuntu + Claude Code (the always-on Claude Code box)?
- Deploy the template. There are no inputs to fill in, and Railway generates a TERMINAL_PASSWORD for you on the first boot.
- Open the service's Variables tab and copy TERMINAL_PASSWORD. Treat it like a root password, because it guards both the browser terminal and SSH.
- Open the public URL, sign in with the basic auth prompt as user ubuntu and that password, then run
claude. Choose a Claude subscription login (copy the URL, paste the code back), or add ANTHROPIC_API_KEY under Variables and redeploy. - Go to Settings, then Networking, and note the TCP proxy host and port for SSH.
- From any device, connect and reattach to the same tmux session your browser is using.
ssh -p PORT ubuntu@HOST
tmux attach -t main
claude
Replace PORT and HOST with the values from the TCP proxy. Detach with Ctrl-b d.
How to self host Ubuntu + Claude Code on other VPS Services (Claude Code self hosting guide)
Running this on your own VPS means rebuilding the same box yourself. The steps assume Ubuntu 26.04 and a user with sudo.
Clone the Repository
Grab the source and check out the pinned commit.
git clone https://github.com/onepush-dev/ubuntu-claude-code.git
cd ubuntu-claude-code
git checkout 658fc7d
Install Dependencies
The image adds Claude Code 2.1.314, Node.js 22, Python 3 and git on top of ttyd 1.7.7, OpenSSH and tmux 3.6. Build it with Docker.
docker build -t ubuntu-claude-code .
Configure Environment Variables
Set a strong TERMINAL_PASSWORD, since the entrypoint refuses to start without one. Add ANTHROPIC_API_KEY or ANTHROPIC_BASE_URL if you need them.
export TERMINAL_PASSWORD='use-a-long-random-string'
export ANTHROPIC_API_KEY='your-api-key'
Start the Ubuntu + Claude Code Application
Run the container with a volume at /home so your Claude login and SSH host keys persist. Then open your-domain on port 7681 and sign in as ubuntu.
docker run -d -p 7681:7681 -p 2222:2222 -v ubuntu-home:/home \
-e TERMINAL_PASSWORD='use-a-long-random-string' ubuntu-claude-code
Railway handles the public domain, TLS, the SSH TCP proxy and the persistent volume for you, all of which you set up yourself on a VPS.
Official Pricing of Claude Code (Claude Code pricing)
The template is MIT licensed and free. Claude Code itself is Anthropic's CLI, and using it needs either a Claude subscription login or Anthropic API usage billed by Anthropic, so you carry two bills: Railway usage for the box and Claude access from Anthropic.
Ubuntu + Claude Code cloud vs self hosted comparison (Pricing, features, costs, and more)
Running Claude Code on this template or on a VPS you manage comes down to how much box-babysitting you want. The template gives you Ubuntu 26.04 with ttyd, SSH and tmux already wired up.
Monthly cost of self hosting Ubuntu + Claude Code on Railway
The template is free and MIT licensed, so you pay only Railway usage for one service with a volume at /home.
System Requirements for Hosting Ubuntu + Claude Code on a VPS
On a VPS, plan for Ubuntu 26.04 LTS, Node.js 22 for the Claude Code CLI, and enough RAM for ttyd, sshd and your repos.
Frequently Asked Questions (FAQs)
Does my Claude login survive redeploys?
Yes. The ~/.claude login and settings live on the /home volume. The SSH host keys live there too, so your fingerprint doesn't change.
How do I use an API key or a gateway instead of a subscription?
Add ANTHROPIC_API_KEY to the service variables, or set ANTHROPIC_BASE_URL to point at your proxy or gateway, then redeploy so login shells pick it up.
How do I update Claude Code?
Run sudo npm install -g @anthropic-ai/claude-code@latest inside the box. Self-updates are off and that install lives outside /home, so redeploying a newer image is the lasting fix.
Does the browser and SSH share the same session?
Yes. Interactive SSH logins auto-attach to the tmux session named main. Commands run over SSH, scp and sftp skip the auto-attach.
Can I use key-only SSH?
Yes. Set SSH_AUTHORIZED_KEYS to your public keys separated by semicolons, then set SSH_PASSWORD_AUTH to false. Redeploy after changing these.
Is this a full VM or Docker?
Neither. It's a single container, not a VM, with no systemd and no Docker-in-Docker. Only /home persists, so anything installed with apt disappears on redeploy. Inbound UDP isn't available either.
Template Content

