GuidesClaude Code on a VPS

Run Claude Code on a VPS, 24/7.

A coding agent on a server keeps working when your laptop is closed. This guide covers the manual route step by step, then the easy path: one command that installs Harness Maxxing, a web app around Claude Code, Codex, OpenCode and other engines.

Works for any engineManual and easy pathPhone access
Why

Why put an AI agent on a server

On a laptop, the agent stops when the lid closes, the Wi-Fi drops or you shut down. On a VPS it keeps running: long refactors, overnight jobs, a scheduled report at 7 a.m., a bot that answers on Telegram. Your files and keys sit in one place, and you can reach the same session from any device.

The price is a little setup and some responsibility for security. Both are manageable.

Step 1

1. Pick a VPS

Any Linux VPS from a provider such as Hetzner, OVH or Hostinger works. For one person running a few sessions, 2 vCPU, 4 GB of RAM and 40 GB of disk is a comfortable minimum. Choose Ubuntu 24.04 or Debian 12 and x86_64 or arm64. A coding agent mostly calls a remote model, so you do not need a big machine, unless you also want to run local models.

Add your SSH public key when you create the server, so you can sign in without a password.

Step 2

2. Connect by SSH and update

From your computer, connect, then update the system.

ssh root@your-server-ip
apt update && apt upgrade -y
Step 3

3. Install the engine by hand

Install the coding agent you want. Claude Code has an official installer, Codex is an npm package, and OpenCode has its own installer. Check each project's docs for the current command.

Then start it once and sign in with your subscription (the CLI prints a link to open in your browser) or export an API key.

curl -fsSL https://claude.ai/install.sh | bash
claude
Never paste an API key into a file in a repository. Keep it in an environment variable or a secrets manager.
Step 4

4. Keep it alive: tmux, or a harness

Closing the SSH window kills a plain terminal session. The classic fix is tmux: start a session, run the agent inside, detach with Ctrl+B then D, and re-attach later.

  • tmux is simple and works everywhere.
  • It gives you one terminal per session and nothing else: no project structure, no memory beyond the files you write, no schedules, no phone view.
  • Scheduling means writing cron lines and scripts yourself.
apt install -y tmux
tmux new -s work
# run claude inside, then Ctrl+B, D to detach
tmux attach -t work
Step 5

5. Secure the server

  1. 1Use SSH keys and turn off password login (PasswordAuthentication no in /etc/ssh/sshd_config).
  2. 2Turn on a firewall that only opens SSH and the ports you need, for example ufw allow OpenSSH then ufw enable.
  3. 3Install fail2ban and automatic security updates.
  4. 4Run the agent as a non-root user when you can, and keep it out of folders it does not need.
  5. 5Keep keys in environment files with tight permissions, and back up your work to a private repository.
Step 6

6. Reach it from your phone

With a plain setup, you SSH from a phone app such as Termius, or put a web terminal behind a VPN like Tailscale. It works, but typing long prompts in a terminal on a small screen is not fun, and you must keep the connection healthy.

The easy path

Or install Harness Maxxing in one command

Harness Maxxing does steps 3 to 6 for you and adds a web app on top. It is free under a fair source license and runs on a Linux VPS (also on a Mac, or on Windows through WSL 2). The installer sets up the engine, a sandbox for every topic, HTTPS, fail2ban and automatic updates, then prints your sign-in link.

The engine is your choice: Claude Code is the default, and Codex, OpenCode, GitHub Copilot CLI, Antigravity, Grok Build, Mistral Vibe, DeepSeek, Kimi Code and Qwen Code are available, or your own.

curl --proto '=https' --tlsv1.2 -fsSL https://get.harness-maxxing.com | bash

Questions, answered.

Can I run Claude Code on a VPS?

Yes. Install it on a Linux server, sign in with your subscription or an API key, and keep it running with tmux or a harness such as Harness Maxxing.

How much does a VPS need?

About 2 vCPU, 4 GB of RAM and 40 GB of disk for one person. The model runs at your provider, so the server stays small unless you host local models.

Can I use my Claude subscription on a server?

Claude Code signs in with a subscription or an API key. Check Anthropic's current terms for your plan, and use whichever fits.

How do I keep it running after I close SSH?

Use tmux or screen for a manual setup. Harness Maxxing runs sessions as services, so they continue after you close the tab.

Free. On your server.

One command on a fresh server, no account with us.

Watch the 2-min video tutorial
$curl -fsSL https://get.harness-maxxing.com | bash
Star on GitHub