Install Claude Code on Linux: distros, servers, and headless

Linux installation is straightforward and now has a properly packaged path. The parts worth writing down are the signed repositories, the headless case where there is no browser to authenticate with, and the two failures that look like a broken download but are not.

By the Continuum team. We build a workbench that runs Claude Code, Codex, and their peers, so the model rates quoted here are the ones our own cost analytics ship with.

The short version

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.

What you need to know
  • 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 bubblewrap and socat, plus an AppArmor profile on Ubuntu 24.04.

The standard install

Works on mainstream distributions. No Node.js needed.
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.

RequirementValue
DistributionsUbuntu 20.04+, Debian 10+, Alpine Linux 3.19+
Architecturex64 or ARM64, glibc or musl
Memory4 GB or more
ShellBash or Zsh
Searchripgrep, usually bundled with the binary

Per-distro prerequisites, if you are missing anything.

DistroInstall first
Ubuntu / Debiansudo apt install -y git curl gnupg
Fedora / RHELsudo dnf install -y git curl gnupg2
Archsudo pacman -S git curl gnupg
Alpineapk 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.

Debian and Ubuntu, stable channel. Verify the key before you trust it.
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
Fedora and RHEL, stable channel.
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.

ManagerUpgrade withLatest channel
aptsudo apt update && sudo apt upgrade claude-codeBoth the URL path and the suite name become latest
dnfsudo dnf upgrade claude-codeSet baseurl to .../rpm/latest
apkapk update && apk upgrade claude-codeSwap 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.

01

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.

02

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.

Dependencies, then check from inside a session.
# Ubuntu / Debian
sudo apt-get install bubblewrap socat

# Fedora
sudo dnf install bubblewrap socat

# then, in a session:
#   /sandbox

Containers and CI

A minimal image. Non-root on purpose, pinned on purpose.
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"]
ConcernHandling
CredentialsRuntime environment or a mounted secret, never baked into a layer
VersionPin an explicit version and set DISABLE_AUTOUPDATER=1
PermissionsNon-root user, workdir scoped to the repository
Config discovery--bare, so the image behaves the same on every machine
NetworkRestrict 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.

ErrorCauseWhat to do
Error loading shared library libstdc++.so.6The installer detected musl on a glibc system, usually because musl cross-compilation packages are presentCheck ldd --version; remove and reinstall, or pull the right binary from the release manifest
Illegal instructionThe CPU lacks AVX, or the wrong architecture was downloadeduname -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 PATHecho 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc, then a new shell
Missing libgcc or libstdc++ on Alpinemusl distribution without the runtime packagesapk add libgcc libstdc++ ripgrep
Verifying what you downloaded, if you care.
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.

  1. Claude Code advanced setup
  2. Troubleshoot installation and login
  3. Claude Code sandboxing
Try it

Linux hosts,
driven remotely.

Continuum can run agents on a Linux box over Tailscale and show you the sessions from your Mac or phone.

free app · your subscriptions · local-first