Hivra
One command to install, one browser tab to sign in, and a few Linux gotchas worth knowing about.

Claude Code on Linux: install, sign in, run it on a server and fix common errors

Claude Code runs well on Linux, and Anthropic's own docs treat it as a first-class platform. This guide covers what you need, the install command, signing in on a desktop and on a headless server, keeping it alive on a VPS, updating, and the errors people actually hit, using only what Anthropic documents as of November 2026.

Short answer

To use Claude Code on Linux, run curl -fsSL https://claude.ai/install.sh | bash, then claude, and sign in through the browser. It needs Ubuntu 20.04+, Debian 10+ or Alpine 3.19+, 4 GB of RAM and a Claude Pro, Max, Team, Enterprise or Console account. On a server, run it inside tmux.

What you need before you install

Anthropic's setup page lists the requirements for the command-line version of Claude Code. On Linux they are:

  • Operating system: Ubuntu 20.04 or later, Debian 10 or later, or Alpine Linux 3.19 or later. Fedora and RHEL are covered through Anthropic's dnf repository.
  • Hardware: 4 GB of RAM or more, and an x64 or ARM64 processor.
  • Shell: Bash or Zsh.
  • Network: an internet connection, since the model runs on Anthropic's side. Claude Code is also limited to Anthropic's supported countries.
  • Account: a Claude Pro, Max, Ultra, Team or Enterprise subscription, or a Claude Console account. The free claude.ai plan does not include Claude Code. Amazon Bedrock, Google Cloud's Agent Platform and Microsoft Foundry also work as providers.

One more thing to know: there is a separate Claude desktop app for Linux, in beta, for Ubuntu 22.04 or later and Debian 12 or later on x86_64 or arm64. This guide is about the terminal version, which is the one that works on a server, and it runs on every distribution above. Anthropic's own advice for Fedora, Arch and other non-Debian distributions is to use the command-line version too.

On Windows? Use WSL and follow the Linux steps here, or read Claude Code on Windows.

The native install script (the recommended way)

Anthropic marks the native installer as the recommended method. Open a terminal and run:

bash
curl -fsSL https://claude.ai/install.sh | bash

The installer puts a launcher at ~/.local/bin/claude, which is a symlink into ~/.local/share/claude/versions/. It needs no sudo, no Node.js and no npm. When it finishes, check it worked:

bash
claude --version claude doctor

claude --version prints a version number such as 2.1.211 (Claude Code). claude doctor prints a read-only health report: install health, settings errors and warnings with suggested fixes, without starting a session.

If your shell says claude: command not found after the install, ~/.local/bin is probably missing from your PATH. The installer reports this under "Setup notes" and prints the fix, but it doesn't change PATH itself. To check and fix it in Bash:

bash
ls -la ~/.local/bin/claude echo $PATH | tr ':' '\n' | grep -Fx "$HOME/.local/bin" echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc source ~/.bashrc

The first command confirms the program is there, the second shows whether the folder is on your PATH, and the last two add it permanently for Bash. For Zsh, use ~/.zshrc in place of ~/.bashrc. Prefer to skip the server setup? Claude Code on Hivra comes with the official CLI already installed.

Other Linux install methods: apt, dnf, apk and npm

The install script is not the only documented route. Anthropic publishes signed package repositories and an npm package, and each suits a different situation.

MethodBest forAuto-updates?Notes
Native script (install.sh)Most people, desktop or serverYes, in the backgroundNo sudo, no Node.js. Installs under your home directory
apt, dnf or apk repositoryManaged fleets, or anyone who wants the system package manager in chargeNo, you upgrade with the package managerSigned repositories, with a stable channel and a latest channel
npm (npm install -g @anthropic-ai/claude-code@latest)People who already live in npmYes, if the global directory is writableNeeds Node.js 22 or later. Installs the same native binary

The apt, dnf and apk repositories each offer two channels. stable serves a version about a week old that skips releases with major regressions. latest serves every release as soon as it ships. Anthropic's page has the exact repository setup for each package manager, including the signing key and its fingerprint, so copy those commands from the setup page rather than from a blog. Once a repository is configured, installing and upgrading are the normal commands:

bash
sudo apt install claude-code sudo apt update && sudo apt upgrade claude-code

On Fedora and RHEL the equivalents are sudo dnf install claude-code and sudo dnf upgrade claude-code.

npm. The npm package needs Node.js 22 or later. On an older Node, npm prints an EBADENGINE warning and finishes the install anyway, and the installed claude still runs, because the package downloads a native binary that does not use your Node. Never use sudo npm install -g: Anthropic warns it causes permission problems and security risks, and an install that needs sudo can't update itself. Avoid npm update -g too, since it may not move you to the newest release. One more trap: npm 12 skips the package's postinstall step by default, so claude can then fail with Error: claude native binary not installed. Check with npm --version; if it starts with 12, Anthropic's fix is to switch to the native installer or allow the step, as its npm 12 instructions describe.

Alpine. Alpine ships without bash and curl, so the install command fails with a not found error until you add them:

bash
apk add bash curl

Alpine is a musl distribution, and the installer picks the matching musl binary for it. The docs also list libgcc, libstdc++ and ripgrep as things it needs on Alpine, so install those too.

Signing in on a Linux desktop

On a desktop, signing in is the easy case. Run claude, and Claude Code opens your browser so you can log in with your claude.ai account (or your Console account, if that is what you use). Approve the request and you are back in the terminal, signed in.

If the browser does not open on its own, press c at the login prompt to copy the login URL, and paste it into a browser. If the browser shows a login code instead of redirecting back, paste that code into the terminal where it says Paste code here if prompted.

There is one shortcut: if you have set the ANTHROPIC_API_KEY environment variable and approve the key when Claude Code asks, it skips the browser login and uses that key instead of your subscription login. The key is a Claude Console API credential, so usage goes to the Console account that owns it, not your Pro or Max plan. Choose it deliberately.

On Linux, Claude Code stores your login in ~/.claude/.credentials.json with file mode 0600, so only your user can read it. To sign out and sign in again, type /logout inside Claude Code.

Signing in on a headless server over SSH

A server has no browser, so the normal flow looks stuck. Anthropic documents the fix in its troubleshooting page for "OAuth login fails in WSL2, SSH, or containers". You sign in through the URL the terminal prints, on a browser on your own computer:

  1. SSH into the server and run claude.
  2. At the login prompt, press c to copy the login URL, or select it in the terminal. With claude auth login, copy the URL it prints.
  3. Open that URL in a browser on your local machine and sign in.
  4. The browser shows a code instead of returning to localhost. Paste that code into the terminal at the prompt that begins Paste code here.

If pasting into the interactive prompt does nothing, your terminal's paste shortcut may not be reaching the input field. Try an alternate shortcut, such as Shift+Insert, or use claude auth login, which reads the pasted code from standard input:

bash
claude auth login

Tokens for scripts. For CI jobs and scripts where no interactive login is possible, Anthropic documents claude setup-token. It opens the same browser authorization as /login and prints a one-year OAuth token, which it does not save anywhere. You copy the token and set it as an environment variable where you want to authenticate:

bash
claude setup-token export CLAUDE_CODE_OAUTH_TOKEN=your-token

That token needs a Pro, Max, Ultra, Team or Enterprise subscription and can only make model requests. It can't start Remote Control sessions or fetch claude.ai connectors, so for those you need a normal interactive login on the server. Treat the token like a password: anyone who has it can use your subscription.

Running Claude Code on a Linux server or VPS

A VPS is the usual answer to "I want Claude Code working when my laptop is shut". It is an ordinary Linux machine in a data centre that stays on, so the setup is the install above plus one habit: run claude inside tmux so an SSH disconnect doesn't end the session. Anthropic's Remote Control docs say the same thing: if you run claude from a terminal on a remote machine, start it inside tmux or screen so it keeps going after you disconnect from SSH.

The tmux basics, from the tmux project's own getting-started page:

bash
# start a named session and run Claude Code inside it tmux new -s claude claude # detach and leave it running: press Ctrl+b, then d # list sessions, then reattach later from any SSH connection tmux ls tmux attach -t claude

Detaching leaves the session running on the server. Reconnect from your phone, a different laptop or another office, run tmux attach, and you are back in the same conversation. If you have not used tmux before, our tmux cheat sheet lists the keys.

What the server needs. The requirement is 4 GB of RAM or more. Smaller VPS plans are where people hit the install problem in the next section. Pick a server that matches the system requirements, and see our AI agent VPS guide for sizing and providers.

Reaching it from a phone or browser. Claude Code has a feature called Remote Control that lets claude.ai/code or the Claude mobile app drive a session running on your machine, with the session still running locally. It needs a claude.ai subscription login (not an API key), and the claude process has to stay running, which is why tmux matters again. The full walkthrough is in Claude Code Remote Control: how it works and how to keep it online, and our guide to running Claude Code 24/7 goes through the other ways to keep a session alive.

Unattended work and permissions. On a server you will eventually want Claude Code to work without stopping to ask permission on every command. There is a flag for that, and it deserves care. What --dangerously-skip-permissions skips, and where to run it explains the trade-off. A disposable server with nothing valuable on it is a much safer place for it than your main machine.

Updating Claude Code on Linux

How you update depends on how you installed.

Native install. Claude Code checks for updates on startup and periodically while it runs, installs them in the background and applies them the next time you start it. To update right now:

bash
claude update

When an update installs, the command prints a line ending in to version <new version>. claude doctor shows the result of the last update attempt, which is the first place to look if updates seem stuck.

apt, dnf and apk. These do not auto-update through Claude Code. Updates arrive with your normal system upgrades, or by running the upgrade command yourself, such as sudo apt update && sudo apt upgrade claude-code.

npm. Run npm install -g @anthropic-ai/claude-code@latest, not npm update -g.

Release channel. The autoUpdatesChannel setting in settings.json takes "latest" (the default, newest features straight away) or "stable" (about a week old, skipping releases with major regressions). If you run Claude Code on a machine you can't easily fix, stable is the cautious choice. Anthropic notes a newly released model may need the latest channel.

Pinning or turning updates off. The install script accepts a channel or version number, for example curl -fsSL https://claude.ai/install.sh | bash -s stable. To stop background updates, set DISABLE_AUTOUPDATER to "1" in the env block of settings.json. That only stops the background check, and claude update still works. DISABLE_UPDATES blocks every update path.

Common Linux errors and how to fix them

These are the Linux problems Anthropic's troubleshooting pages cover, with the documented fix for each.

claude: command not found. ~/.local/bin is not on your PATH. Check with ls -la ~/.local/bin/claude, then add it to your shell profile as shown in the install section above.

Permission errors during install. The native installer writes to ~/.claude/, ~/.local/bin/, ~/.local/share/claude/, ~/.local/state/claude/, ~/.cache/claude/ and ~/.claude.json. Check the two main ones:

bash
test -w ~/.local/bin && echo "writable" || echo "not writable" test -w ~/.claude && echo "writable" || echo "not writable"

If either is not writable, create the folder and make yourself the owner:

bash
sudo mkdir -p ~/.local/bin sudo chown -R $(whoami) ~/.local

Those two commands repair ~/.local. If it was ~/.claude that failed the check, the installer can't write its downloads there either, so take that folder back too with sudo chown -R $(whoami) ~/.claude, then run both test -w checks again before you retry the install.

If the problem was npm's global directory, Anthropic's advice is to switch to the native installer rather than reach for sudo.

The install is Killed on a small VPS. A Killed message, exit code 137 and a note about running out of memory mean the Linux out-of-memory killer stopped the install. Installing needs roughly 512 MB of free memory, and running Claude Code needs more. Anthropic's fixes are to add swap, close other processes or use a larger server. A 2 GB swap file:

bash
sudo fallocate -l 2G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile

Then run the install command again. Anthropic's note is that Claude Code needs at least 4 GB of RAM, so swap gets you through the install but a bigger server is the real fix.

Node version warnings (EBADENGINE). This only affects the npm install, which wants Node.js 22 or later. On an older Node it warns and finishes anyway, and the installed claude still runs. If you'd rather not manage Node at all, use the native script.

Search, @file mentions or custom skills find nothing (ripgrep). The bundled ripgrep may not run on your system. Install your distribution's package (sudo apt install ripgrep on Ubuntu and Debian, apk add ripgrep on Alpine, pacman -S ripgrep on Arch), then tell Claude Code to use it by setting USE_BUILTIN_RIPGREP to "0" in the env block of settings.json:

json
{ "env": { "USE_BUILTIN_RIPGREP": "0" } }

Run claude doctor afterwards. The Search line should show your system ripgrep's path instead of OK (bundled).

Missing shared library (ld-linux-x86-64.so.2 and similar). The installer may have picked the wrong libc variant. Check which libc you have with ldd --version 2>&1 | head -1. On glibc with a musl binary, remove the install and reinstall. On musl (Alpine) with a glibc binary, install the packages named above and rerun the install command.

Illegal instruction. Either the architecture is wrong (for example an x86 binary on an ARM server; check with uname -m) or your CPU lacks AVX. On a VPS, grep -m1 -ow avx /proc/cpuinfo printing nothing means the hypervisor isn't passing AVX to your server. Anthropic lists no workaround for the AVX case, and other install methods download the same binary, so the fix is a different host or machine.

Bus error while a session is running. The executable disappeared from under a running session, which happens on network storage such as an NFS home directory when an upgrade deletes the old binary. Install on local disk, for example with a Linux package manager, and keep each version in its own directory.

When none of this fits, claude doctor is the first diagnostic to run, and Anthropic's installation troubleshooting page lists many more cases.

Own Linux desktop, VPS or a managed Linux computer: which fits?

There are three realistic places to run Claude Code on Linux, and the install is the same on each. What differs is who looks after the machine and whether it is on when you are not.

Your own Linux desktop or laptopA VPS you rentA Hivra computer
SetupThe install script, then sign inCreate the server, harden SSH, install, sign in over SSH, install tmuxLaunch Claude Code, open it in a browser
Who maintains the OSYouYouHivra looks after the computer
Keeps working when you disconnectOnly while the machine is awake and onlineYes, if you started it inside tmuxA run you start inside tmux keeps going. See the section below
CostFree if you own the machineA monthly server bill that varies by providerFrom $9.99 a month for 2 vCPU and 4 GB of RAM
Reach it from your phoneSSH from a phone, or Remote Control while the machine is awakeSSH from a phone, or Remote ControlOpen the computer in a browser on any device
ControlFullFull, including the firewall and the OSTerminal, files and browser; Hivra manages the host
Best forDay-to-day coding at your deskPeople comfortable running a Linux serverPeople who want the always-on setup without the server admin

A simple way to choose: if you only code at your desk, run it on your own Linux machine and skip everything else. If you want sessions to carry on while your laptop is shut, you need a machine that stays on, and the choice is between running one yourself and having one run for you.

Running Claude Code on a Hivra computer

Hivra is a managed alternative to the VPS route. A Hivra computer comes set up for Claude Code, so there is no server for you to administer and no install to debug. You launch Claude Code, and Hivra starts a private cloud computer reserved for it, with the official Anthropic CLI installed. You open its terminal, files and chat in a browser, from any device.

You sign in with your own Anthropic account on that computer, the same way you would on a desktop, or you choose Hivra credits at launch and Claude Code runs on Claude models through Venice, paid from your credits. Hivra hosting does not include or replace an Anthropic subscription. Plans start at $9.99 a month for 2 vCPU and 4 GB of RAM.

On a paid Hivra plan the computer stays on and keeps your files, sessions and login. A Claude Code or Codex run you start inside tmux in the computer's Terminal tab keeps going after you close the laptop. On Claude Code, work you send through Telegram, connected in the agent's Telegram tab, runs on the computer, not in your browser.

Hivra is not tied to one agent. The same account launches Hermes, OpenClaw, Claude Code, Codex and Agent Zero, each on a computer of its own, and you reach all of them from a browser on any device. If you try Codex next month, you don't need a second server, a second account or a second install to work out. Hivra is not affiliated with Anthropic.

Two honest limits. A Hivra computer is a managed machine, so you don't get the freedom of a VPS you root yourself, and Hivra administrators retain infrastructure access to managed hosts. And if you are comfortable running your own VPS, you may not need Hivra at all: everything in the server section above works, and a rented server can be cheaper. Hivra is for the people who would rather skip the setup and keep the time.

See how Claude Code runs on Hivra, or read how it compares to a plain server in Hivra vs a self-hosted VPS.

Common questions

Does Claude Code work on Linux?

Yes. Anthropic lists Ubuntu 20.04 or later, Debian 10 or later and Alpine Linux 3.19 or later as supported, on x64 or ARM64 with 4 GB of RAM or more. Install it with `curl -fsSL https://claude.ai/install.sh | bash`, then run `claude`. Fedora and RHEL users can use Anthropic's dnf repository.

How do I install Claude Code on Ubuntu?

Run `curl -fsSL https://claude.ai/install.sh | bash` in a terminal, then `claude --version` to confirm. You can also use Anthropic's signed apt repository, or npm with Node.js 22 or later. Don't use sudo with npm. Anthropic recommends the native script.

Do I need Node.js to run Claude Code on Linux?

Not for the recommended install. The native script needs no Node.js. Only the npm install wants Node.js 22 or later, and on an older Node it prints an EBADENGINE warning but still finishes, because the installed claude is a native binary that doesn't use your Node.

How do I sign in to Claude Code on a headless Linux server?

Run `claude` over SSH and press `c` to copy the login URL. Open it in a browser on your own computer, sign in, then paste the code the browser shows into the terminal at the `Paste code here` prompt. `claude auth login` works the same way if pasting fails. For scripts, `claude setup-token` makes a one-year token.

How do I keep Claude Code running on a Linux server after I disconnect?

Start it inside tmux: `tmux new -s claude`, run `claude`, then detach with Ctrl+b followed by d. Reattach later with `tmux attach -t claude`. Anthropic's Remote Control docs give the same advice for a remote machine: use tmux or screen so the session survives an SSH disconnect.

How do I update Claude Code on Linux?

A native install updates itself in the background, and `claude update` applies an update immediately. apt, dnf and apk installs update through your system's package manager, for example `sudo apt update && sudo apt upgrade claude-code`. For npm, run `npm install -g @anthropic-ai/claude-code@latest`.

Why does the Claude Code install say Killed on my VPS?

The Linux out-of-memory killer stopped it. Installing needs roughly 512 MB of free memory, and Claude Code needs at least 4 GB of RAM to run. Add a swap file, close other processes or move to a larger server, then run the install command again.

What do I do when claude says command not found after installing?

Your PATH is missing `~/.local/bin`, where the native installer puts the launcher. Add `export PATH="$HOME/.local/bin:$PATH"` to `~/.bashrc` (or `~/.zshrc`), run `source ~/.bashrc`, and try again. `ls -la ~/.local/bin/claude` confirms the program is there.

Is there a Claude Code desktop app for Linux?

Yes, in beta, for Ubuntu 22.04 or later and Debian 12 or later on x86_64 or arm64, installed from Anthropic's apt repository. On other distributions such as Fedora or Arch, Anthropic says to use the command-line version instead.

Do I need a VPS, or can I run Claude Code on my own Linux machine?

Your own machine is enough if you only work at your desk. You need a machine that stays on if you want sessions to continue when your laptop is shut. That can be a VPS you manage, or a managed computer such as Hivra's, which skips the server setup.

Give your agent a computer that stays on.

From $9.99/mo. Bring your own AI key. 7-day money-back guarantee on card payments.

Start Now