The fastest way to install Claude Code on Linux takes less than two minutes, and you have three solid methods to choose from: Anthropic’s native installer, a signed apt repository for Debian/Ubuntu fleets, and npm for teams that already standardize on Node.js tooling. This guide walks through each method, shows you how to verify the installation, complete authentication, and fix the handful of problems almost everyone hits the first time.
Before You Install Claude Code on Linux: Requirements
Check the basics first and you will avoid most setup headaches:
- A 64-bit (x86_64) or ARM64 Linux system — Ubuntu 20.04 or later, Debian, Fedora, RHEL and other mainstream distributions are supported. Aim for at least 4 GB of RAM.
- An internet connection, since Claude Code talks to Anthropic’s API.
- A supported shell (Bash or Zsh are typical) and
curlfor the installer. - A paid Claude account (Pro, Max, Team or Enterprise) or an Anthropic Console account for API billing — the free plan does not include Claude Code access.
Node.js is not required for the recommended native install. You only need it (Node 22 or later) if you deliberately choose the npm route.
Method 1: Install Claude Code on Linux with the Native Installer (Recommended)
Anthropic’s native installer is the officially recommended path: it drops a self-contained binary into your home directory, needs no dependencies, and updates itself in the background.
curl -fsSL https://claude.ai/install.sh | bash
The installer places the binary at ~/.local/bin/claude. Make sure that directory is on your PATH — most modern distributions include it by default; if your shell cannot find the command, add it manually:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Verify everything works:
claude --version
claude doctor
claude doctor is the built-in diagnostic tool: it checks the binary, your PATH, auto-update status and conflicting installations, and suggests fixes. Run it whenever something feels off.
Method 2: Install Claude Code on Linux with npm (Legacy)
The original installation method still works and is fine if your team manages global tools through npm:
npm install -g @anthropic-ai/claude-code
Two warnings from experience: never run this with sudo (fix your npm prefix permissions instead), and know that Anthropic now treats npm as a legacy channel — the native installer receives updates first and avoids Node version surprises. Migrating later is painless: install the native build, then remove the npm copy with npm uninstall -g @anthropic-ai/claude-code. Your settings in ~/.claude/ carry over untouched.
Method 3: The Signed apt Repository for Managed Machines
If you administer a fleet of Ubuntu workstations, Anthropic also publishes a signed apt repository so Claude Code installs and updates through your normal package-management lifecycle, just like any other managed package. This is the cleanest option for organizations that pin and audit software centrally. Individual users can ignore it — the native installer is simpler.

First Run and Authentication
Move into any project directory and start your first session:
cd ~/projects/my-app
claude
On first launch, Claude Code opens your browser for OAuth sign-in with your Claude account. Authorize it, return to the terminal, and you are in — credentials are stored locally on your machine. You can also authenticate explicitly with claude auth login, and sign out with claude auth logout.
Prefer API billing, or setting up a headless server? Export an API key instead:
export ANTHROPIC_API_KEY="your-api-key"
claude
Add that export to your shell profile if you want it permanent, and treat the key like any other secret — never commit it to a repository.
Your First Session
Inside a project, run the /init command once: it scans the codebase and generates a CLAUDE.md project memory file so future sessions start with context. Then try a read-only question (“explain how this app is structured”) before asking for edits. Our best practices guide shows how experienced users structure those first real tasks.
Updating and Uninstalling
Native installs update automatically in the background; you can force a check with claude update. Homebrew users (on macOS) update through brew upgrade --cask claude-code, and npm users with npm update -g @anthropic-ai/claude-code. To remove the native install, delete ~/.local/bin/claude and, if you want a clean slate, the ~/.claude configuration directory.
Troubleshooting Common Problems
- “command not found”:
~/.local/binis missing from PATH — see the fix in Method 1, then open a new shell. - Two versions fighting: an old npm copy alongside the native binary. Run
claude doctor, then uninstall the one you don’t use. - Login loop: clear the session with
claude auth logout, sign in again, and check that your subscription is active. - Behind a proxy: Claude Code respects the standard
HTTPS_PROXYenvironment variables used by other CLI tools.
For the authoritative reference, keep Anthropic’s official quickstart documentation bookmarked — it tracks the latest installer changes. New to the tool entirely? Start with our overview of what Claude Code is before diving into advanced features.