How to install Claude Code on Linux. On a small server the installer can run out of memory
How to install Claude Code on Ubuntu, Debian, Fedora and Alpine. The install script, the apt, dnf and apk repositories, logging in over SSH, common errors and uninstalling.
Part of the guideClaude Code, the complete guide. From installation to your own skills and plugins
In this article
In short
On Linux, Claude Code installs with a script or from signed apt, dnf and apk repositories. We cover distribution requirements, Alpine, logging in on a server without a browser, memory and library errors, and uninstalling.
On the cheapest cloud server, the Claude Code install ends with a single word, Killed. That is not a bug in the program. It is the system killing the process because memory ran out. Linux gives you more ways to install than a Mac or Windows, and more places where things can go differently. Everything below was checked against the Anthropic documentation as of 10 November 2026.
What the tool itself does is covered in What is Claude Code. The rest of the series lives in the Claude Code guide.
Requirements before you install Claude Code on Linux
The documentation lists Ubuntu 20.04 and later, Debian 10 and later, and Alpine Linux 3.19 and later. Package repositories also exist for Fedora and RHEL. The processor must be x64 or ARM64, with at least 4 GB of RAM. The install step alone needs roughly 512 MB of free memory. To log in you need a Pro, Max, Ultra, Team or Enterprise plan, a Claude Console account, or access through your company's cloud provider.
Windows with WSL follows these same instructions, because in WSL you install the Linux version. The differences are in the Windows install guide.
Install with the script or from a repository
The simplest route is the install script. That version updates itself.
curl -fsSL https://claude.ai/install.sh | bashThe program goes to ~/.local/bin/claude, and its versions to ~/.local/share/claude/versions/. When the installer finishes, open a new terminal session and run claude --version. claude doctor checks the install and settings files without starting a session.
On servers, repositories are often more convenient because updates arrive with the rest of the system. Anthropic runs signed apt, dnf and apk repositories, each with a stable and a latest channel. Stable serves a version that is usually about a week old and skips releases with major regressions. This is the stable channel on Debian and Ubuntu.
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
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-codegpg --show-keys should print exactly one fingerprint, 31DDDE24DDFAB679F42D7BD2BAA929FF1A7ECACE. If a fresh system is missing curl or gpg, install them with sudo apt install curl gnupg. On Fedora and RHEL you add the repository with a file in /etc/yum.repos.d/ and install with sudo dnf install claude-code. The documentation has the exact file contents.
A repository install does not update through Claude Code. You update it with your normal system upgrade, for example sudo apt update && sudo apt upgrade claude-code or sudo dnf upgrade claude-code.
Alpine and other musl distributions
Alpine has no bash or curl by default, so the install script fails with not found. Install the needed packages first.
apk add bash curl libgcc libstdc++ ripgrepripgrep is in the community repository. If apk cannot find it, add that repository to /etc/apk/repositories and run apk update. Then set USE_BUILTIN_RIPGREP to 0 in ~/.claude/settings.json so Claude Code uses the system ripgrep. Anthropic also runs an apk repository, in which case the install is apk add claude-code after you add the key and the repository address.
Logging in on a server without a browser
On first start, claude wants to open a browser. Over SSH or in a container there is none, so press c to copy the login address. Open it in a browser on your own computer and sign in. The page shows a code, which you paste into the terminal at Paste code here. If pasting does not work, use claude auth login, which reads the code from standard input.
On Linux the login is stored in ~/.claude/.credentials.json with mode 0600, so only your user can access it. A Mac uses the Keychain, here it is a plain file, so do not copy your ~/.claude folder to other people's machines.
Common installation errors on Linux
The documentation describes a few symptoms that mostly happen on Linux.
Killed, or a message about the install being killed with exit code 137, means out of memory. Close other processes or add a swap file, for example 2 GB, and run the script again.- The install hangs in a Docker container when the script starts from
/. SetWORKDIR /tmpfirst. Error loading shared library libstdc++.so.6means you got the musl build on a glibc system or the other way round.ldd --versiontells you which one you have.Illegal instructionmeans the wrong architecture or a CPU without AVX, common in older virtual machines. Another install method will not help, because it downloads the same binary.bash: claude: command not foundmeans~/.local/binis not on PATH. Addexport PATH="$HOME/.local/bin:$PATH"to~/.bashrcand open a new session.
If home folders live on network storage, a session can crash with Bus error when an update on another machine removes the file it is running. The documentation recommends installing the binary on local disk in that case, for example from a repository.
Sandboxing, updates and uninstalling
On Linux and WSL 2, Claude Code can run commands in a sandbox that limits file and network access. It needs the bubblewrap and socat packages, installed on Debian and Ubuntu with sudo apt-get install bubblewrap socat. Running /sandbox inside a session shows what is missing.
The script install updates itself, and claude update does it right away. Removing it looks like this.
rm -f ~/.local/bin/claude
rm -rf ~/.local/share/claudeAn apt install is removed with sudo apt remove claude-code, dnf with sudo dnf remove claude-code, and apk with apk del claude-code. Remove the repository file and the key as well. Settings, approvals and history stay in ~/.claude and the ~/.claude.json file.
After installing, go on to first run and login, and before working on a server read about Claude Code permissions.
On a low-memory server, add swap first and run the installer after that. If you want to find out where AI could take work off your business beyond code, our free AI audit is a good place to start.
What would you like to change in your business?
Leave your number. We will talk about your process and see whether we can help. The first call is free.
The service this text is about
Automation and AI / OCRAutomation of document re-typing, OCR and checking rules, and your data stays with you.