Run curl -fsSL https://claude.ai/install.sh | bash, restart your shell, and run claude. No Node.js is involved. If you would rather your package manager owned it, Claude Code publishes signed apt, dnf, and apk repositories, each with a stable and a latest channel. Supported distributions are Ubuntu 20.04 and later, Debian 10 and later, and Alpine 3.19 and later, on x64 or ARM64 with 4 GB of RAM, as of August 2026. On a headless server, authenticate with a token generated elsewhere rather than the browser flow.
- The native script covers mainstream distributions in one command and self-updates.
- Signed apt, dnf, and apk repos exist. Verify the key fingerprint before trusting it.
- Package-manager installs do not auto-update through Claude Code.
- Never
sudo npm install -g. Switch to the native installer instead. - Headless servers need a token or an API key, because there is no browser.
- The Bash sandbox on Linux needs
bubblewrapandsocat, plus an AppArmor profile on Ubuntu 24.04.
The standard install
curl -fsSL https://claude.ai/install.sh | bash
exec $SHELL -l
claude --version
# 2.1.211 (Claude Code)
claude doctor
The binary lands at ~/.local/bin/claude as a symlink into ~/.local/share/claude/versions/. Nothing is written outside your home directory, and nothing needs root.
Supported platforms, as of August 2026.
| Requirement | Value |
|---|---|
| Distributions | Ubuntu 20.04+, Debian 10+, Alpine Linux 3.19+ |
| Architecture | x64 or ARM64, glibc or musl |
| Memory | 4 GB or more |
| Shell | Bash or Zsh |
| Search | ripgrep, usually bundled with the binary |
Per-distro prerequisites, if you are missing anything.
| Distro | Install first |
|---|---|
| Ubuntu / Debian | sudo apt install -y git curl gnupg |
| Fedora / RHEL | sudo dnf install -y git curl gnupg2 |
| Arch | sudo pacman -S git curl gnupg |
| Alpine | apk add bash curl libgcc libstdc++ ripgrep, then set USE_BUILTIN_RIPGREP=0 |
The signed package repositories
If you would rather your package manager owned the install, Claude Code publishes signed apt, dnf, and apk repositories. Each offers two channels: stable serves a version roughly a week old that skips releases with major regressions, and latest serves every release as it ships. Updates then arrive through your normal system upgrade workflow, not through Claude Code.
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
# fingerprint must be 31DDDE24DDFAB679F42D7BD2BAA929FF1A7ECACE
gpg --show-keys /etc/apt/keyrings/claude-code.asc
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
sudo tee /etc/yum.repos.d/claude-code.repo <<'EOF'
[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
EOF
sudo dnf install claude-code
Upgrade paths differ by manager. None of them auto-update through Claude Code.
| Manager | Upgrade with | Latest channel |
|---|---|---|
| apt | sudo apt update && sudo apt upgrade claude-code | Both the URL path and the suite name become latest |
| dnf | sudo dnf upgrade claude-code | Set baseurl to .../rpm/latest |
| apk | apk update && apk upgrade claude-code | Swap the repository line for .../apk/latest |
The npm route, and why it is rarely the answer here
The npm package downloads and links the same native binary the script installs; it does not run Claude Code under Node. It requires Node.js 22 or later as of v2.1.198, and on an older Node it prints an EBADENGINE warning during install rather than failing.
npm install -g @anthropic-ai/claude-code
# upgrade with an explicit tag, not npm update -g
npm install -g @anthropic-ai/claude-code@latest
Headless servers
The default login flow opens a browser, which a server does not have. Two approaches work, and they bill completely differently.
A long-lived token generated on a machine with a browser
# on your laptop
claude setup-token
# on the server
export CLAUDE_CODE_OAUTH_TOKEN="<the token>"
claude
This keeps the session on your subscription rather than metered billing. claude setup-token exists specifically to generate a long-lived OAuth token for CI and scripts.
An API key
export ANTHROPIC_API_KEY="sk-ant-..."
claude
Simpler, and the right choice for anything genuinely automated, since a subscription is licensed for interactive use by one person. Set a Console budget limit first. When ANTHROPIC_API_KEY is set, Claude Code prompts you once to approve the key instead of opening a browser.
The Bash sandbox on Linux
Linux is one of the platforms where Claude Code's sandboxed Bash tool runs, alongside macOS and WSL2. Inside the sandbox, commands write only to the working directory and the session temp directory by default, and the operating system rather than a prompt enforces that. It needs two packages.
# Ubuntu / Debian
sudo apt-get install bubblewrap socat
# Fedora
sudo dnf install bubblewrap socat
# then, in a session:
# /sandbox
Containers and CI
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
git curl ca-certificates gnupg \
&& rm -rf /var/lib/apt/lists/*
# An agent that can write to system paths is a worse agent, not a better one.
RUN useradd -m -s /bin/bash agent
USER agent
WORKDIR /workspace
RUN curl -fsSL https://claude.ai/install.sh | bash -s 2.1.89
ENV PATH="/home/agent/.local/bin:${PATH}"
ENV DISABLE_AUTOUPDATER=1
ENTRYPOINT ["claude"]
| Concern | Handling |
|---|---|
| Credentials | Runtime environment or a mounted secret, never baked into a layer |
| Version | Pin an explicit version and set DISABLE_AUTOUPDATER=1 |
| Permissions | Non-root user, workdir scoped to the repository |
| Config discovery | --bare, so the image behaves the same on every machine |
| Network | Restrict egress if the container runs code you have not read |
When the binary refuses to run
Two failures look like a corrupt download and are not. Both are worth recognising on sight, because reinstalling does nothing for either.
| Error | Cause | What to do |
|---|---|---|
Error loading shared library libstdc++.so.6 | The installer detected musl on a glibc system, usually because musl cross-compilation packages are present | Check ldd --version; remove and reinstall, or pull the right binary from the release manifest |
Illegal instruction | The CPU lacks AVX, or the wrong architecture was downloaded | uname -m for architecture; grep -m1 -ow avx /proc/cpuinfo for AVX. Roughly pre-2013 CPUs and some hypervisors are affected |
command not found: claude | ~/.local/bin is not on PATH | echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc, then a new shell |
Missing libgcc or libstdc++ on Alpine | musl distribution without the runtime packages | apk add libgcc libstdc++ ripgrep |
curl -fsSL https://downloads.claude.ai/keys/claude-code.asc | gpg --import
gpg --fingerprint security@anthropic.com
# 31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE
REPO=https://downloads.claude.ai/claude-code-releases
VERSION=2.1.89
curl -fsSLO "$REPO/$VERSION/manifest.json"
curl -fsSLO "$REPO/$VERSION/manifest.json.sig"
gpg --verify manifest.json.sig manifest.json
sha256sum ~/.local/share/claude/versions/$VERSION
Questions people ask
Run curl -fsSL https://claude.ai/install.sh | bash, restart your shell, and run claude doctor. Ubuntu 20.04 and later is supported. If you prefer apt to own it, add the signed Claude Code apt repository and run sudo apt install claude-code.
Yes. Claude Code publishes signed apt, dnf, and apk repositories, each with a stable and a latest channel. Verify the signing key fingerprint 31DDDE24DDFAB679F42D7BD2BAA929FF1A7ECACE before trusting it. Package manager installs do not auto-update through Claude Code.
Not for the native installer, which installs entirely under your home directory. You need root only for the package-manager repositories, and you should never use sudo with npm.
Run claude setup-token on a machine that has a browser and set CLAUDE_CODE_OAUTH_TOKEN on the server to stay on your subscription. For anything automated, set ANTHROPIC_API_KEY instead, since a subscription is licensed for interactive use.
Your global npm prefix is not writable by your user. Do not fix it with sudo, which leaves root-owned files that break later installs. Switch to the native installer, which needs no elevated privileges at all.
Yes, on Alpine 3.19 and later. Install bash, curl, libgcc, libstdc++, and ripgrep first, then set USE_BUILTIN_RIPGREP to 0 in settings. There is also a signed apk repository.
The CPU almost certainly lacks AVX, which affects roughly pre-2013 processors and virtual machines whose hypervisor does not pass AVX through. Check with grep -m1 -ow avx /proc/cpuinfo. No install method avoids it, because they all ship the same binary.
Install bubblewrap and socat, then run /sandbox inside a session to pick a mode. On Ubuntu 24.04 and later you also need an AppArmor profile allowing bwrap to create user namespaces.
Sources
Every figure above was read from these pages on August 2026. Vendors reprice without notice; if you find a stale number, tell us.