Running Claude Code on a VPS lets you hand development tasks to an agent that keeps working while your computer is off, from any machine, in an environment kept apart from your personal data. That is the main gain: a coding assistant that becomes an infrastructure resource instead of a tool you launch in a local terminal.
This article starts with what that changes in practice for a developer, an agency or a small team. The technical part comes after, kept deliberately short: how to size the machine, install the tool cleanly and avoid the usual security mistakes.
What you gain by moving it to a server
Claude Code is a command-line agent from Anthropic. It reads your repository, edits files, runs tests and executes commands. On a laptop, it lives and dies with your session: sleep mode, battery, hotel Wi-Fi, a reboot forced by an update. On a VPS, it runs in a persistent session.
The benefits boil down to a few points:
- Continuous availability: a refactor, a dependency migration or a test campaign can run overnight. You review the result in the morning.
- Access from anywhere: a plain SSH connection is enough, from a second computer, a tablet or a borrowed machine. The working context stays on the server.
- A free workstation: builds, tests and containers use the VPS's resources, not your machine's. Your laptop stays responsive.
- A clean, reproducible environment: a machine dedicated to this role, with the right versions of Node, Python or PHP, and none of the leftovers from ten different projects.
- Predictable infrastructure cost: you rent a machine on a fixed subscription. Only your Claude usage (subscription or API) varies with how much you use it.
A clear separation between the agent and your data
An agent that executes commands deserves to be confined. On your own machine, it can potentially reach your home directory, your SSH keys, your browsers and your client documents. On a VPS, it only sees what you have put there.
This is a strong argument for agencies and freelancers working on client code. You create one server per client or per project, with only the repositories and secrets that project needs. When the engagement ends, you delete the machine and the whole perimeter disappears with it.
You remain responsible for the configuration: an isolated VPS only protects you if access is properly managed. More on that below.
The use cases that pay off fastest
Not all uses are equal. These are the ones where a server gives a clear advantage:
- Long-running tasks: framework migrations, adding tests to existing code, large-scale refactoring. As long as the task runs, there is no reason to keep a laptop open.
- Team work: a shared server with one user per person, shared repositories and the same toolchain. Configuration differences between workstations disappear.
- Client site maintenance: updates, fixes and code audits across several WordPress or application projects, from a single entry point.
- Production-like deployments: the agent can prepare and test its changes on the same family of system as your final servers.
- Mobile work: you start a task at the office, follow it from the train and finish it at home.
Which VPS to choose
Claude Code itself is light: most of the computation happens on Anthropic's side, and the machine only executes the commands it is asked to run. What weighs on the server is your project: compilation, test suites, databases, Docker.
As a rough starting point:
| Profile | Suggested starting resources |
|---|---|
| Scripts, static sites, small projects | 2 vCPU, 4 GB RAM |
| Web applications with a database | 4 vCPU, 8 GB RAM |
| Heavy builds, multiple containers | 8 vCPU or more, 16 GB RAM or more |
Plan disk space in proportion too: repositories, dependencies and Docker images grow fast. An Ubuntu LTS or Debian distribution is a simple, well-documented choice, and the natural territory of a Linux VPS.
As for location, choose according to your constraints. If your clients or your compliance requirements say the code must stay in Europe, look at the offers in France or Germany. The offer built for this use is presented on the VPS for Claude Code page, and the full range is on the VPS page.
Installing Claude Code in a few minutes
Once the server is delivered, connect over SSH and create a standard user. Avoid working as root: it is good practice in general, and an agent that runs commands should have limited rights.
Bashadduser dev usermod -aG sudo dev su - dev
Then install Claude Code with the official installer:
Bashcurl -fsSL https://claude.ai/install.sh | bash claude --version
If you prefer npm, you need Node.js (version 18 or later):
Bashnpm install -g @anthropic-ai/claude-code
Then move into your project and run claude. On first launch, the tool asks you to authenticate with a Claude account or an API key. On a server without a browser, it prints a URL to open from your own computer, and you paste the resulting code back into the terminal.
Keeping the session alive with tmux
Without precautions, an SSH drop closes the session and interrupts the agent. tmux solves that:
Bashsudo apt update && sudo apt install -y tmux tmux new -s claude # run claude in this session, then detach with Ctrl+b followed by d tmux attach -t claude
The attach command brings you back exactly where you left the session, even after reconnecting the next day.
Securing the server before letting an agent work on it
An agent that reads and modifies code needs boundaries. A few settings are enough for a sound baseline.
- SSH key authentication only. In
/etc/ssh/sshd_config, setPasswordAuthentication noandPermitRootLogin no, then reload withsudo systemctl reload ssh. - Minimal firewall: open only what is needed.
Bashsudo ufw allow OpenSSH sudo ufw enable
- Limited secrets: store only the keys the project requires on the machine. Prefer read-only deploy keys to your personal Git credentials.
- Reviewing actions: keep Claude Code's default permission mode, which asks for confirmation before sensitive actions, until you have clearly defined what the machine's perimeter is.
- Backups and Git: push your changes to a remote repository regularly. The server is a working tool, not the only copy of your code.
If your server is also exposed to other public services (a website, an API), DDoS protection may make sense too, but it has nothing to do with Claude Code itself.
Pitfalls to avoid
The first: under-sizing memory. An npm install or a build can be killed by the system when RAM runs out. A swap file helps in a pinch, but it does not replace real memory.
The second: mixing projects from different clients under the same Unix user. Separate them by user or, better, by server.
The third: forgetting that Claude usage has its own cost, independent of the VPS. Keep an eye on the consumption of your subscription or API key, especially if the agent runs overnight on broad tasks. Set precise objectives rather than a vague "improve all the code".
To go further with Linux server administration, the site's tutorials cover SSH, firewalls and user management.
FAQ
It runs on common Linux systems (Ubuntu, Debian and equivalents), as well as macOS and Windows. For a VPS, Ubuntu LTS or Debian remains the simplest choice. Check Anthropic's documentation for the exact requirements of your version.
No, the tool itself is light. The resources you need depend mostly on your project: compilation, tests, databases or containers. For a typical web project, 4 vCPU and 8 GB of RAM leave a comfortable margin.
The server isolates the agent from your personal computer, which reduces the exposure of your other data. After that, the security of the VPS depends on your configuration: SSH keys, firewall, updates and limited secrets. Keep in mind too that the content Claude Code reads is sent to Anthropic for processing, under its terms of use.
Yes. Create one Unix user per person, each with their own SSH keys and their own Claude authentication. For different clients, one server per client remains the cleanest approach.
No. The VPS provides the infrastructure. Access to Claude goes through your own Anthropic account (subscription or API key), billed separately.

