How to Deploy Claude Code on a VPS (2026): 4 Remote Workflows & Ubuntu Setup Guide

๐Ÿ’ก Transparency: some outbound links on this site earn us a commission, but reviews and benchmarks remain fully independent โ€” rankings and scores are never influenced.

๐Ÿ’ก Summary

  • Eligible Anthropic developers should use a direct Ubuntu install with tmux; pick VS Code Remote-SSH for GUI workflows.
  • This post covers 2026 Claude Code regional compliance limits and compute needs, compares four remote deployment setups plus four hosts including Hetzner and RackNerd, with full commands for account isolation, persistent sessions and mobile reconnection.
๐Ÿ’ก
๐Ÿ’ก

RackNerd โ€” Editor's Pick

Get the best price through our exclusive link and support our reviews.

Explore RackNerd โ†’

Debugging a script on the office Mac, then getting home and opening a Windows desktop to find the environment variables, Python virtualenv, and uncommitted Git branch all sitting on a machine you can't reach โ€” that's a daily frustration for most full-stack developers and independent site builders. The question is whether to run Claude Code locally on a Mac mini or deploy it on a cloud VPS. For long-term cost and convenience, the VPS wins: code repositories, runtime dependencies, and terminal context all live on the server, and switching devices means a single SSH command to pick up exactly where you left off.

Two points to establish before getting into the setup. First, Claude Code's model inference runs on Anthropic's cloud โ€” the VPS only runs the CLI client and local build tooling, so no GPU instance is needed. Second, Claude Code is not available everywhere. Purchasing an overseas VPS solves the problem of persistent development environments, but it doesn't automatically grant service eligibility.

Four Problems a Cloud Dev Environment Actually Solves

Moving Claude Code to a Linux VPS is primarily about engineering workflow efficiency, not model response speed.

Eliminating environment drift across machines. Node.js, Python, Go, Docker, and build toolchains all live on one server. Office desktop, home machine, or a borrowed laptop โ€” you're always connecting to the same dependency versions and directory structure.

Sessions survive local power state. Closing a laptop or letting it sleep kills a local Claude Code session. With tmux on a VPS, local disconnection doesn't kill the cloud process. Reconnecting the next day shows the full execution output. That said, background persistence isn't the same as full automation โ€” file write confirmations, dependency errors, and account usage limits will all pause a session waiting for human input.

Cross-device handoff including mobile. Any device with SSH access works. Using the official Remote Control feature (requires a claude.ai subscription login) also lets you check progress and send follow-up instructions from a phone browser or mobile app.

Cleaner project isolation. Different projects can run as separate Linux users, in separate Git repositories, or under separate Docker Compose environments, keeping the primary local machine clear of test databases and global package pollution.

Regional Compliance: Why a VPS Alone Doesn't Grant Access

Skipping the terms of service check before deployment often leads to account restrictions or verification failures. Claude Code is provided by Anthropic under U.S. export control regulations and official regional access policies.

Under Anthropic's Supported Regions Policy (effective November 12, 2026), mainland China, Hong Kong, and Macau are not on the supported regions list. Taiwan is included. The policy also covers organizational control: entities majority-owned or controlled by individuals or organizations in unsupported regions are restricted even if physically located in a supported region.

A common misconception: buying a U.S. West Coast, Japan, or European VPS bypasses all restrictions. It doesn't. The VPS only changes the CLI client's host and outbound IP. It doesn't change the account registration entity, payment method origin, or the user's actual location. Even a clean native IP is not a substitute for service eligibility.

The rule is simple: an overseas VPS is a remote productivity environment for users who already meet Anthropic's eligibility requirements, not a proxy for circumventing regional policy.

Hardware Sizing: Why 2 vCPU + 4GB Is the Right Starting Point

Unlike local inference frameworks like Ollama or vLLM, Claude Code in standard usage doesn't load model weights on the server or consume VRAM. The actual resource consumption comes from npm installs, pip compilation, TypeScript type checking, test suite execution, and concurrent Docker containers.

Use Case CPU RAM Storage Notes
Lightweight scripts and testing 1โ€“2 vCPU 2GB 25โ€“40GB SSD Single Python/Node.js script maintenance; add 2GB swap to prevent OOM
Personal primary development (recommended start) 2 vCPU 4GB 40โ€“60GB NVMe WordPress plugins, Next.js builds, standard backend API and Git workflow
Multi-container full-stack projects 4 vCPU 8GB 80GB+ NVMe Simultaneous PostgreSQL, Redis, Nginx, and multiple Docker microservices
Heavy compilation and concurrent testing 4+ vCPU 8โ€“16GB 120GB+ NVMe Rust/C++ compilation, large monorepo test pipelines, parallel sessions

For most individual developers, 2 vCPU + 4GB RAM + 40GB NVMe balances cost and stability well. If budget allows starting at 4GB, it meaningfully reduces the risk of Linux OOM kills during large frontend dependency installs.

OS: Ubuntu 24.04 LTS or Debian 12/13. Architecture: x86_64 โ€” some older build tools still lack precompiled ARM64 binaries, which creates friction on ARM instances.

For data center location, test SSH interactive latency and peak-hour packet loss from your actual location before committing. Interactive terminals are sensitive to round-trip time โ€” keeping RTT under 180ms with near-zero packet loss keeps command input and code diff scrolling from feeling sticky. Ask providers for a Looking Glass test IP and run ping and mtr before purchasing.

Four Remote Deployment Architectures

Setup Code Lives Main Advantage Main Limitation Rating
Official install + SSH/tmux Entirely on VPS Fewest components, highest stability, low memory overhead Requires comfort with pure command-line and keyboard shortcuts โ˜…โ˜…โ˜…โ˜…โ˜…
VS Code Remote-SSH Entirely on VPS Full graphical IDE, file tree, and Git panel on local machine Depends on local machine and stable long SSH connection โ˜…โ˜…โ˜…โ˜…โ˜…
CC Desk Tunnel Remains on Windows local machine No code migration needed; server only needs 1GB RAM Third-party open-source tool, no professional security audit, reverse tunnel carries high privilege โ˜…โ˜…โ˜…โ˜†โ˜†
Official Remote Control Entirely on VPS Native web (claude.ai/code) and mobile app session handoff Requires claude.ai subscription login; API key alone won't enable it; still needs tmux for session persistence โ˜…โ˜…โ˜…โ˜…โ˜†

Official install + SSH/tmux is the recommended starting point for newcomers and independent developers. Install the official CLI on an Ubuntu server, manage windows and background sessions with tmux, and there's no extra proxy layer anywhere in the stack โ€” the lowest troubleshooting cost of any option.

VS Code Remote-SSH suits developers who rely heavily on graphical diff review. Local VS Code renders only the UI; all file I/O, terminal commands, and Claude Code processes run on the remote VPS, keeping cloud compute and local editing feel together.

CC Desk Tunnel (GitHub project sun168567/cc-desk-tunnel) takes a different approach: Claude Code runs in a Linux server container while project code, compilers, and desktop tools stay on the Windows machine, bridged by an encrypted reverse SSH tunnel (server listens on TCP 8787 by default). The tradeoff is significant โ€” the project's own documentation notes it was largely AI-assisted and hasn't received a professional security audit, and the connection grants server-side ability to execute arbitrary commands as the current Windows user. Evaluate only in an isolated test environment; never mount directories containing production keys or financial data.

Official Remote Control is Anthropic's native cross-device handoff. After enabling it in a VPS session, you can access the terminal conversation directly at claude.ai/code or through the iOS/Android Claude app without setting up a third-party web terminal. This requires logging in with a claude.ai subscription account โ€” an environment configured only with ANTHROPIC_API_KEY can't enable it.

Four VPS Options Compared

Provider Specs Price Reference (2026) Key Advantage Best For
Hetzner CX23 / CX33 2โ€“4 vCPU / 4โ€“8GB / 40โ€“80GB SSD โ‚ฌ5.49โ€“โ‚ฌ8.49/mo (excl. IPv4 and VAT) Solid hardware, no long-term contract, 20TB traffic Long-term value, European latency acceptable
RackNerd KVM 4GB / 8GB 4โ€“6 vCPU / 4โ€“8GB / 60โ€“140GB SSD ~$47.98โ€“$94.98/year (Black Friday 2026) Extremely low annualized monthly cost, U.S. multi-region Budget-sensitive users who can manage their own server
Hostinger KVM 2 / KVM 4 2โ€“4 vCPU / 8โ€“16GB / 100โ€“200GB NVMe Verify intro vs. renewal price gap Intuitive control panel, one-click reinstall and snapshots Site builders who prefer visual server management
DigitalOcean Basic Droplet 2 vCPU / 4GB / 80GB SSD $24/month (per-second billing, ~$0.03571/hr) Complete API ecosystem, destroy-and-rebuild flexibility, thorough docs Teams automating environment creation with Terraform/API

Hetzner CX23 and CX33 remain strong values after price adjustments in April and June 2026. CX23 (2 vCPU / 4GB) with IPv4 runs around โ‚ฌ5.99/month; CX33 (4 vCPU / 8GB) with IPv4 around โ‚ฌ8.99/month, both excluding VAT. NVMe random read/write and stability continue to lead the European cloud tier at this price. Two things to confirm before ordering: inventory (CX23 and CX33 have shown sold-out periods in multiple tracking checks between September and November 2026), and region (European pricing doesn't apply to U.S. nodes, which cost considerably more). New accounts should prepare valid identity or payment verification to avoid triggering risk review.

RackNerd promotional plans in the 2026 Black Friday window included 4 vCPU / 4GB / 60GB at $47.98/year and 8GB at $94.98/year across U.S. West nodes. These are limited promotional quota slots โ€” confirm renewal pricing and refund policy before purchasing, and avoid IP ranges with a history of heavy abuse.

Hostinger KVM VPS offers a friendly web management panel with browser SSH terminal and firewall configuration, suited for WordPress and independent site developers who don't want frequent command-line ops. Promotional pricing usually requires 12 or 24 months prepaid upfront, with standard renewal rates significantly higher than the intro price โ€” calculate the full-term cost before committing.

DigitalOcean Basic Droplet at 2 vCPU / 4GB is $24/month with per-second billing (minimum 60 seconds, effective January 2026). Long-term idle cost is higher than the other options, but if you only need the environment during active work hours and destroy instances when done (restoring from snapshots), actual monthly spend can be much lower. The key billing rule: powering off a Droplet in the console does not stop billing โ€” the platform still reserves your disk and IP. Only destroying the instance stops the meter.

Deployment Walkthrough: Ubuntu 24.04, User Isolation, CLI, and tmux

Step 1: Update and Install Essentials

# Connect via SSH, then update system packages
ssh root@YOUR_VPS_IP
apt update && apt upgrade -y
apt install -y curl git tmux ca-certificates

Step 2: Create a Dedicated Developer Account

Claude Code can execute shell commands and modify files directly in the terminal. Running it as a non-root user is a basic security baseline.

adduser developer
usermod -aG sudo developer

If you logged into root with an SSH key, copy the authorized key to the new account:

install -d -m 700 -o developer -g developer \
  /home/developer/.ssh
cp /root/.ssh/authorized_keys /home/developer/.ssh/
chown developer:developer \
  /home/developer/.ssh/authorized_keys
chmod 600 /home/developer/.ssh/authorized_keys

Before closing the current window, open a new local terminal and confirm ssh developer@YOUR_VPS_IP connects without a password.

Step 3: Install Claude Code via Official Script

# Switch to the developer account
su - developer
curl -fsSL https://claude.ai/install.sh | bash

After installation, reload environment variables and verify:

source ~/.bashrc
claude --version

If the version number and (Claude Code) label appear, the binary is ready. If you get command not found, check whether ~/.local/bin is in PATH inside ~/.bashrc and run export PATH="$HOME/.local/bin:$PATH" to fix it immediately.

Step 4: Initialize a Sandbox Project and Authorize

mkdir -p ~/projects/demo
cd ~/projects/demo
git init
claude

On first launch, the terminal prompts for a login method: browser OAuth with a Claude Pro/Max/Team/Enterprise subscription, or an ANTHROPIC_API_KEY environment variable for Console pay-as-you-go usage. If you need mobile handoff via Remote Control later, use subscription account login โ€” API key login doesn't enable that feature. Since the VPS has no graphical interface, the CLI will print an authorization URL in the terminal; copy it to a local browser, complete verification, and paste the generated code back into the terminal.

Step 5: Use tmux for Session Persistence

Running claude directly means an SSH disconnect loses the entire conversation context. Start sessions inside tmux:

tmux new -s claude-dev
cd ~/projects/demo
claude

To leave without ending the session, press Ctrl + B, release, then press D (Detach). The terminal shows [detached (from session claude-dev)] and the Claude Code process continues running in the background.

To reconnect from anywhere:

ssh developer@YOUR_VPS_IP
tmux attach -t claude-dev
# List all running sessions
tmux ls

# Terminate a specific session when done
tmux kill-session -t claude-dev

VS Code and Mobile Handoff

VS Code Remote-SSH Setup

Install the official Remote - SSH extension from Microsoft in local VS Code. Add a host entry to ~/.ssh/config (Windows: C:\Users\username\.ssh\config):

Host claude-vps
    HostName YOUR_VPS_IP
    User developer
    IdentityFile ~/.ssh/id_ed25519
    ServerAliveInterval 30

ServerAliveInterval 30 sends a keepalive packet every 30 seconds, preventing home router or carrier NAT from dropping idle connections. In VS Code, press Ctrl + Shift + P (macOS: Cmd + Shift + P), run Remote-SSH: Connect to Host, select claude-vps, and open /home/developer/projects/demo to browse and edit code graphically while interacting with Claude Code in the integrated terminal.

Mobile Handoff via Official Remote Control

During a long-running refactor or test run, enable remote control from inside the Claude Code session:

/remote-control

Or launch with the flag directly:

claude --remote-control "My-VPS-Project"

This requires a claude.ai subscription account login โ€” API key-only configuration cannot enable it. When active, the terminal shows a Remote Control status indicator with a session link and QR code. Open claude.ai/code on your phone or use the Claude iOS/Android app under the Code tab to see the session with a green online indicator, then send instructions or upload screenshots to continue work on the VPS.

One important distinction: Remote Control connects a phone or browser to your own VPS process, with all file access and command execution happening on your server. Claude Code on the web is a separate mode running in Anthropic-hosted containers. And avoid exposing unauthenticated open-source web terminals on public ports โ€” that's effectively handing shell access to anyone who finds the URL.

Common Issues and Operational Details

Frequent crashes on 2GB RAM instances during large builds: npm builds under memory pressure trigger Linux OOM kills. Add a 2GB swap file as a buffer:

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' \
  | sudo tee -a /etc/fstab

Can Claude Code run as a systemd service? Don't wrap an interactive claude session as a systemd unit. Interactive mode depends on a terminal TTY and human permission confirmations โ€” a headless restart loop serves no purpose and can rapidly exhaust usage quotas on error. For true unattended remote access, Anthropic provides claude remote-control (alias claude rc) as a service mode that doesn't require a local interactive session. Some community members run this under systemd, but open issues in the official repository report compatibility problems in certain versions โ€” test thoroughly before long-term deployment. Single non-interactive tasks can be scheduled with -p flag, strict timeouts, and log auditing via systemd or cron.

CC Desk Tunnel firewall and credential hygiene: If using CC Desk Tunnel with Windows local code, configure the cloud provider security group and server ufw to only allow the required TCP port (default 8787). Never commit the randomly generated Service Token to a public repository or share it in screenshots. If credential exposure is suspected, immediately reset the token using the tunnel's credential rotation command on the server.

Deployment Paths by Developer Type

Most individual developers and independent site builders: Ubuntu 24.04 + official CLI + tmux. Start with Hetzner CX23 (4GB, verify inventory) or a RackNerd 4GB annual plan. Minimal maintenance, predictable cost.

Full-stack engineers who rely heavily on graphical IDE: Deploy on a 4GB or 8GB VPS and use VS Code Remote-SSH as the primary interface. When stepping away from the desk, switch to mobile with /remote-control (requires subscription account login).

Teams with complex dependencies who need elastic daily compute: DigitalOcean Basic Droplet (4GB) with per-second billing, using initialization scripts and snapshots to spin up and destroy environments on demand, eliminating idle resource cost.

Regardless of hardware and connection method, always verify that the account and its controlling entity meet Anthropic's supported regions policy before starting. The cloud development workstation is most effective when it's operating within compliance boundaries from the start.

๐Ÿ“– Related Reading

๐Ÿš€

Ready for RackNerd? Now is the perfect time

Use our exclusive link for the best price โ€” and help support our content.

โ“ Frequently Asked Questions

โ† Previous
Bluehost AI Builder: From One Sentence to a Working Web App
๐Ÿท๏ธ Related Keywords

๐Ÿ’ฌ Comments

150 characters left

No comments yet. Be the first!

โ† Back to Articles