Skip to content
AgentKennel

← All guides

Guide

How to run Claude Code on a VPS

On your laptop, Claude Code stops when the lid closes. On a small server it keeps going: long tasks finish overnight, and you look in from wherever you are. Here is how to set that up, by hand or with AgentKennel.

Why a server at all

Three reasons come up again and again:

Pick a server

Any Linux VPS works for Claude Code itself. If you plan to use AgentKennel, choose Ubuntu 22.04, Ubuntu 24.04 or Debian 12 on x86_64 or aarch64: that is what its installer supports. Memory decides how many agents can be loaded at once, since each one is its own Claude Code process; you can usually move to a bigger plan later. Create a normal user with sudo rather than working as root.

The manual way: SSH and tmux

This is the classic setup and it works well for one or two sessions.

  1. SSH in and install Claude Code with the official installer from the Claude Code setup docs.
  2. Start a tmux session, for example tmux new -s work, and run claude inside it. tmux is what keeps the process alive after you disconnect.
  3. Sign in once; the authentication docs list the options (a Claude subscription or an API key).
  4. Detach with Ctrl+B then D, log out, and later reattach with tmux attach -t work.

If you want the agent to work without stopping for approval, Claude Code has permission modes for that, described in the permission modes docs. They note that Claude Code refuses to skip all checks when it runs as root or under sudo, one more reason for a normal user.

Where this gets tiring: every session is a separate thing to remember, attach and name. After a reboot you start and resume each one by hand. And from a phone you need an SSH app and a small keyboard.

The dashboard way: AgentKennel

AgentKennel is an open-source (AGPL-3.0) dashboard that does the tmux part for you and puts it in a browser tab. Each agent is still the real claude terminal in its own tmux session on your server; you just open it from a list instead of an SSH prompt. On a fresh VPS, as a normal user with sudo:

shell
curl -fsSL https://raw.githubusercontent.com/yanhs/agentkennel/master/install.sh | bash

What you get, according to the project's README:

Don't want to SSH in at all? Paste a setup script while you create the server instead: there are step-by-step pages for Hetzner, DigitalOcean and Vultr.

Keep it safe

With prompts off, an agent can do in a second what takes a day to undo. A few habits help whichever way you run it:

AgentKennel adds guards on top, as Claude Code hooks that check every shell command: no secrets or the server's IP in a commit, no pkill by pattern, no mail to people without your yes. If you want agents kept off the host entirely, its Docker sandbox runs them inside a container. The install page covers both.