Set Up Claude Code on a DigitalOcean Droplet, Step by Step
Run Anthropic's Claude Code on your own Ubuntu VPS with a hardened, persistent setup in under an hour.
Cloud & DevOpsPDF · 6 pages· v1.0
4.3Run Anthropic's Claude Code on your own Ubuntu VPS with a hardened, persistent setup in under an hour.
Cloud & DevOpsPDF · 6 pages· v1.0
4.3A complete, tested walkthrough for installing and running Claude Code on a fresh DigitalOcean droplet. This is for developers who want a stable, always-available coding agent on a remote machine rather than their laptop, and who care about doing it securely. You will start from a brand-new Ubuntu 24.04 droplet and finish with Claude Code installed under a non-root user, your API key stored safely, Node.js managed cleanly, and a tmux-based workflow so sessions survive SSH disconnects. The guide explains exactly which droplet size to pick, how to add swap so you do not run out of memory on a small box, and how to lock the machine down with SSH keys and a firewall before you ever paste a credential. After following it you will be able to SSH in, attach to a persistent session, and use Claude Code against your repositories from anywhere, without leaving secrets lying around or exposing the box to the internet. Every command is copy-paste ready and explained, so you understand what each step does instead of blindly running it. Common failure points such as the wrong Node version, missing build tools, and authentication errors are called out with fixes. This guide assumes basic command-line comfort but does not assume prior DevOps experience.
You need either an Anthropic API key (from console.anthropic.com) or a Claude subscription that supports Claude Code login. The guide covers both authentication paths.
A 2 GB / 1 vCPU droplet is the practical minimum. The guide shows how to add a swap file so smaller boxes do not crash during installs.
Yes. The guide sets up tmux so your Claude Code session keeps running on the server and you can re-attach later.
The guide hardens SSH, enables a firewall, and stores your key with restricted permissions, but a shared dev droplet should not hold production credentials. Treat it as a developer workstation.
Read the full refund policy and trust & safety terms.