Claude Code is Anthropic's AI assistant that works in the terminal. It does not just answer questions: it reads files, runs commands, edits configuration and checks the result. We use it every day on our own server. Here is how to get it running on a VPS in about 5 minutes.
1. Why on a server and not on your laptop
- It keeps working when your laptop is off. You start a task, close SSH and come back later. The session carries on.
- It sees the servers directly. Logs, nginx, databases, the internal network: no need to copy output back and forth.
- It is separated from your personal files. On the VPS there is only what you chose to give it access to. Your laptop has everything: photos, documents, passwords saved in the browser.
- Scheduled jobs. Scripts the assistant wrote run from cron without your computer being on.
2. What you need
- A Linux VPS with Ubuntu 20.04+ or Debian 10+.
- At least 4 GB of RAM (the official requirement), x64 or ARM64. With us that is VPS Plus (2 vCPU, 4 GB RAM) or larger.
- A paid account: Claude Pro, Max, Team, Enterprise or Console (pay-as-you-go API). The free claude.ai plan does not include Claude Code.
3. A separate user, not root
The assistant runs with the rights of the user who starts it, so do not run it as root:Code: Select all
sudo adduser claude
sudo su - claude4. Installation
The official installer does not need Node.js and keeps itself updated afterwards:Code: Select all
curl -fsSL https://claude.ai/install.sh | bashCode: Select all
claude --version
claude doctorclaude --version shows the version. claude doctor checks the installation and settings without starting a session, and shows the result of the last automatic update.If you prefer npm:
npm install -g @anthropic-ai/claude-code@latest (needs Node.js 22+). Do not use sudo with npm.5. A session that survives an SSH disconnect
Code: Select all
sudo apt install tmux
tmux new -s claude
claudeCtrl+B then D. Claude Code keeps running. Come back with:Code: Select all
tmux attach -t claude6. Signing in on a server without a browser
The first time you runclaude, it shows a sign-in link. Copy it, open it in the browser on your own computer, sign in to your account and paste the code it gives you back into the terminal.On Windows, does Ctrl+V not paste the code and show "No image found in clipboard. You're SSH'd; try scp?" instead? The fix is in the next topic: Ctrl+V does not work in Claude Code over SSH from Windows. Until then, use
Ctrl+Shift+V or right-click.7. Updates and limits
- An install from the official installer updates itself. To update by hand:
claude update. - The paid plans have usage limits: a 5-hour window and a weekly limit. You can see how much you have left with
/usageinside Claude Code.
In short
- A VPS with at least 4 GB of RAM and Ubuntu or Debian.
- A separate user, not root.
curl -fsSL https://claude.ai/install.sh | bash, thenclaude doctor.- Run it in tmux so it does not stop when you disconnect.