AI Tool Pipelines — Automate Your WorkflowsAI Tool Pipelines

Every product was carefully curated by an AI Tool Pipelines editor. We may earn a commission from these links. Here's how we choose products and why you should trust us.

How to Run Claude Code on a VPS

By · 5 min read · Updated Dec 2, 2026

Diagram of Claude Code running on a VPS inside tmux, with a laptop connecting over SSH and the session continuing after the laptop disconnects

To run Claude Code on a VPS, rent a Linux server with at least 4 GB of RAM (Claude Code's own minimum), create a non-root user, install it with the native installer, log in with your Claude subscription or an API key, and run it inside tmux so the session keeps going when you close your laptop. A 2 vCPU, 8 GB server such as Hostinger's KVM 2 ($8.79 a month on a two-year term) is enough for most projects. The part that needs real thought is security: you are giving an AI agent a shell on a machine that is always online.

Key takeaways

  • Claude Code needs Ubuntu 20.04+ or Debian 10+, 4 GB+ RAM, and a Pro, Max, Team, Enterprise or Console account. The free plan does not include it.
  • Install with curl -fsSL https://claude.ai/install.sh | bash; no Node.js needed.
  • Run it inside tmux so jobs keep running after you disconnect.
  • Use a non-root user, keep production secrets off the box, and do not skip permission prompts on a server with real credentials.
  • Rent 8 GB if your project runs builds or test suites alongside Claude Code.

Why run Claude Code on a VPS

Claude Code is Anthropic's coding agent that works in your terminal: it reads your repo, edits files and runs commands. On a laptop it stops when the lid closes. On a VPS it keeps going: a long refactor, a test-fix loop, or a migration can run overnight while you check in from your phone over SSH. Hostinger's Claude Code hosting page also points to Claude Code's Remote Control feature for continuing a session from the Claude app.

Diagram showing a laptop connecting over SSH to a VPS where Claude Code runs inside a tmux session next to the project repo, with the session continuing after the laptop disconnects

Which server to rent

Prices from Hostinger's Claude Code hosting page, December 2026, on 24-month terms. Renewals are $11.99, $14.99 and $28.99.
WorkloadPlanWhy
Claude Code only, small reposHostinger KVM 1: 1 vCPU, 4 GB, $6.49/moMeets the 4 GB minimum, little headroom
Claude Code plus builds and testsHostinger KVM 2: 2 vCPU, 8 GB, $8.79/moRoom for npm, Docker and a test database
Several agents or heavy buildsHostinger KVM 4: 4 vCPU, 16 GB, $12.99/moParallel sessions, faster test runs

My opinion: buy KVM 2, not KVM 1. Claude Code itself is light, but the commands it runs are not. The first time it runs npm install and your test suite at the same time on 4 GB, you will wish you had paid the extra $2.30 a month.

Install and log in

bash
# as root: create a normal user for the agent
adduser dev && usermod -aG sudo dev
su - dev

# install Claude Code (native installer, auto-updates)
curl -fsSL https://claude.ai/install.sh | bash
claude --version

# start a tmux session so it survives disconnects
sudo apt install -y tmux git
tmux new -s claude
git clone https://github.com/you/your-repo.git && cd your-repo
claude

The first time you run claude it asks you to log in. On a server with no browser, it gives you a link to open on your own computer; sign in there with your Claude plan and finish the login in the terminal. If you use an Anthropic Console API key instead, set ANTHROPIC_API_KEY before starting and approve it when prompted. To leave Claude Code working, press Ctrl+b then d to detach; tmux attach -t claude brings you back.

Security checklist

  • Non-root user for Claude Code, as in the commands above.
  • SSH keys only: disable password login.
  • Firewall: only port 22 open unless you are serving something.
  • No production secrets on the box. Use test credentials and a separate deploy step.
  • Git as your undo button: commit before every long session so you can review and revert.
  • Spend limits: if you use an API key, set a monthly limit in the Anthropic Console.

A composite of a lesson people learn once, call him Arjun: in autumn 2026 he set up Claude Code on a VPS with his production .env copied in "just for convenience" and permission prompts skipped. A long session ran a migration script against the wrong database. Nothing was lost, thanks to a backup from that morning, but he rebuilt the server the same week with test credentials only and prompts switched back on.

If you also want your automations next to your coding agent, the same server can run n8n; see our best VPS for n8n guide.

“A coding agent on a server is a colleague who never sleeps. Give it a desk, not the keys to the building.”

Frequently asked questions

Frequently asked questions

Can I run Claude Code on a VPS?

Yes. Claude Code runs on Linux servers such as Ubuntu 20.04+ and Debian 10+ with at least 4 GB of RAM. Install it with the native installer and run it inside tmux.

How much RAM does Claude Code need?

Anthropic lists 4 GB or more. In practice, 8 GB is better when Claude Code also runs builds, tests or Docker on the same server.

Do I need a paid Claude plan to use Claude Code on a server?

Yes. Claude Code needs a Pro, Max, Team, Enterprise or Console (API) account. The free Claude plan does not include it.

How do I log in to Claude Code on a server without a browser?

Run claude and follow the login prompt: open the link it gives you on your own computer, sign in, and finish in the terminal. Or set ANTHROPIC_API_KEY to use a Console API key.

How do I keep Claude Code running after I disconnect?

Start it inside tmux. Detach with Ctrl+b then d, and reattach later with tmux attach -t claude.