Install Claude Code on a Linux Server: apt, dnf, Pinning
On a server, use the signed apt, dnf or apk repository, not the one-line installer. The package-manager route puts the binary on local disk, hands updates to your normal system upgrade workflow, and lets you choose the stable or latest channel by repository. The one-line installer (curl -fsSL https://claude.ai/install.sh | bash) works too, but it installs into the user's home directory and auto-updates in the background, which is the opposite of what most servers want.
Everything below comes from the Claude Code setup documentation, read on 2026-11-04. We did not run the apt, dnf or apk commands in a live VM for this page, so treat the command blocks as the documented procedure, not as our measured output.
What does the server need?
The documented requirements are:
- Ubuntu 20.04+, Debian 10+, or Alpine Linux 3.19+ (the page also lists macOS and Windows)
- 4 GB or more of RAM, and an x64 or ARM64 processor
- An internet connection
- Bash, Zsh, PowerShell or CMD as the shell
The npm package is optional. If you do install through npm it needs Node.js 22 or later, but the installed claude binary does not itself invoke Node, because the package pulls in a native binary.
Which channel: stable or latest?
Each repository offers two channels. stable serves a version that is typically about one week old and skips releases with major regressions. latest serves every release as soon as it ships. The documentation's own commands configure stable and call it the fit for most users.
One caveat from the same page: a newly launched model can require a Claude Code version newer than the one stable serves. If a model announcement says you need a new version, move to latest for that.
Install on Debian or Ubuntu (apt)
Fresh images may lack curl or gpg, so install them first:
sudo apt install curl gnupg
sudo install -d -m 0755 /etc/apt/keyrings
sudo curl -fsSL https://downloads.claude.ai/keys/claude-code.asc \
-o /etc/apt/keyrings/claude-code.asc
gpg --show-keys /etc/apt/keyrings/claude-code.asc
The fingerprint gpg prints should be 31DDDE24DDFAB679F42D7BD2BAA929FF1A7ECACE. Compare it before you continue; that comparison is the point of the step. If the key download failed, a later apt update fails with NO_PUBKEY BAA929FF1A7ECACE.
Then register the stable repository and install:
echo "deb [signed-by=/etc/apt/keyrings/claude-code.asc] https://downloads.claude.ai/claude-code/apt/stable stable main" \
| sudo tee /etc/apt/sources.list.d/claude-code.list
sudo apt update
sudo apt install claude-code
For latest, both the URL path and the suite name change (.../apt/latest latest main). Upgrade later with sudo apt update && sudo apt upgrade claude-code.
Install on Fedora or RHEL (dnf)
sudo tee /etc/yum.repos.d/claude-code.repo <<'REPO'
[claude-code]
name=Claude Code
baseurl=https://downloads.claude.ai/claude-code/rpm/stable
enabled=1
gpgcheck=1
gpgkey=https://downloads.claude.ai/keys/claude-code.asc
REPO
sudo dnf install claude-code
dnf downloads the key on first install and asks you to confirm the fingerprint. It should read 31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE. For latest, set baseurl to https://downloads.claude.ai/claude-code/rpm/latest. Upgrade with sudo dnf upgrade claude-code.
Install on Alpine (apk)
wget -O /etc/apk/keys/claude-code.rsa.pub \
https://downloads.claude.ai/keys/claude-code.rsa.pub
echo "https://downloads.claude.ai/claude-code/apk/stable" >> /etc/apk/repositories
apk add claude-code
Check the key with sha256sum /etc/apk/keys/claude-code.rsa.pub; the documented value is 395759c1f7449ef4cdef305a42e820f3c766d6090d142634ebdb049f113168b6. Upgrade with apk update && apk upgrade claude-code.
Alpine is musl-based, so the docs add two requirements: libgcc, libstdc++ and ripgrep at runtime, and USE_BUILTIN_RIPGREP set to 0 in settings. If you install through the apk repository you should still read that section; the docs state it for musl-based distributions generally.
{
"env": {
"USE_BUILTIN_RIPGREP": "0"
}
}
How do I stop surprise updates?
Package-manager installs do not auto-update through Claude Code. Updates arrive through your normal upgrade workflow, so the practical control is the usual one: do not run unattended upgrades for the claude-code package unless you want them.
If you did use the native installer or npm, three settings matter, all documented:
| Goal | Setting | Notes |
|---|---|---|
| Stay on the delayed channel | "autoUpdatesChannel": "stable" | Default is "latest" |
| Stop the background check | DISABLE_AUTOUPDATER=1 in env | claude update and claude install still work |
| Block every update path | DISABLE_UPDATES | Use when you ship Claude Code through your own tooling |
Confirm what is in effect with claude doctor. The docs say that with DISABLE_AUTOUPDATER set, the Auto-updates line shows disabled (set by env: DISABLE_AUTOUPDATER).
How do I pin a version range?
Two different mechanisms exist, and they do different things.
minimumVersion is a floor for updates. Background auto-updates and claude update refuse to install anything below it, so moving to stable does not downgrade a machine that is already on a newer latest build:
{
"autoUpdatesChannel": "stable",
"minimumVersion": "2.1.100"
}
The docs also describe requiredMinimumVersion and requiredMaximumVersion as managed settings: they make Claude Code refuse to start outside a version range, and updates respect the maximum as a ceiling. Those are for organizations that distribute managed settings, and we have not tested them.
To install an exact version with the native installer, pass it as an argument: curl -fsSL https://claude.ai/install.sh | bash -s 2.1.89. The docs say claude --version then prints exactly the version you passed.
Gotcha: shared home directories
A running session reads parts of the executable from disk as it works. If the file is deleted or truncated mid-session, the session crashes, and on Linux the shell reports Bus error. That is why the docs recommend a local-disk install (a package manager is the first option they list) when home directories live on NFS, and DISABLE_UPDATES so one machine's in-place upgrade does not delete the binary another machine is running.
FAQ
Should I use apt or the one-line installer on a server?
Use apt, dnf or apk if you want updates under your own control and a signed repository. The one-line installer is simpler on a single dev box and keeps itself updated.
Does claude-code from apt update itself?
No. The documentation says package-manager installations do not auto-update through Claude Code; updates come through your system upgrade workflow.
Do I need Node.js on the server?
Not for the native or package-manager installs. The npm route needs Node.js 22 or later, but the installed binary does not invoke Node.
How do I check the install is healthy?
Run claude --version, then claude doctor for read-only install and settings diagnostics.
Can I run it on 2 GB of RAM?
The documented minimum is 4 GB. We have not measured what happens below that, so we cannot say.