Install Claude Code on Ubuntu Linux

Claude Code's installation on Ubuntu has shifted from npm to a native one-command installer with no Node.js dependency. This updated guide covers the current installation process, three authentication paths (Console API, Pro/Max subscription, and enterprise platforms), and the MCP server integrations that transform Claude Code into a connected development hub — including Context7 for real-time documentation, Serena for semantic code understanding, and Playwright for AI-driven browser automation.

Back to Blog
18 min read
How to Install Claude Code on Ubuntu Linux: Complete Guide 2025

Claude Code has evolved from a beta research preview into one of the most capable AI coding tools available — and the way you install it has changed just as dramatically. If you followed an older guide that walked you through Node.js setup and npm global packages, that path still works but is now officially deprecated. Anthropic's native installer drops Claude Code onto your Ubuntu system with a single command, no runtime dependencies required.

This guide covers the current installation process for Ubuntu Linux, walks through authentication and initial configuration, and then goes where most installation guides stop: setting up MCP (Model Context Protocol) servers that transform Claude Code from a capable coding assistant into an integrated development hub connected to your documentation, your browser, and your codebase's semantic structure.

✓ Key Takeaways

  • The native installer is now the recommended method — one command, no Node.js dependency, automatic updates built in.
  • Claude Code now supports three authentication paths: Console API billing, Claude Pro/Max subscription, or enterprise platforms (Bedrock, Vertex, Foundry).
  • MCP servers are the force multiplier — Context7 delivers real-time documentation, Serena provides semantic code understanding, and Playwright enables AI-driven browser automation.
  • Claude Code runs on Claude Opus 4.6 and Sonnet 4.5 — with model selection, agent teams, plugins, background tasks, and VS Code integration now part of the production feature set.
  • The claude doctor command is your first-line diagnostic tool for any installation or configuration issue.

What Claude Code Does in 2026

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and takes real action in your development environment. It is not a code suggestion engine — it reads files, writes code, executes commands, manages git workflows, runs tests, and interacts with external tools through the Model Context Protocol.

The tool has matured significantly since its initial beta. Current capabilities include:

  • Multi-file editing and debugging: Claude Code can navigate entire codebases, identify bugs across multiple files, and implement fixes — not just suggest them.
  • Git workflow management: Commit with contextual messages, resolve merge conflicts, create pull requests, and rebase branches through natural language commands.
  • Agent teams (experimental): Multi-agent collaboration where a team lead delegates tasks to specialized teammate agents working in parallel.
  • Background tasks: Long-running operations continue in the background while you work on other things, with notifications on completion.
  • MCP server integration: Connect to external tools, databases, APIs, and services through the open-source Model Context Protocol.
  • Plugins and skills: Extend functionality with community and custom plugins that bundle commands, agents, and MCP servers.
  • VS Code integration: Full support within VS Code including remote sessions, session browsing, and streaming responses.
  • Memory system: Claude Code automatically records and recalls memories across sessions to maintain context about your project.

Claude Code currently supports model selection including Claude Opus 4.6 (with a 1M token context window in beta) and Claude Sonnet 4.5, giving development teams flexibility to balance capability with cost depending on the complexity of the task [Anthropic].

Prerequisites for Ubuntu Installation

The requirements have been simplified significantly with the native installer. You need:

  • Ubuntu 20.04+ or Debian 10+
  • 4GB+ RAM
  • Active internet connection for authentication and AI processing
  • Bash, Zsh, or Fish shell
  • An Anthropic account — either with active API billing through the Claude Console, or a Claude Pro/Max subscription

Node.js is no longer required for the native installation method. If you plan to use MCP servers that rely on npx (most stdio-based servers do), you will need Node.js 18+ installed — but that is for MCP servers, not for Claude Code itself.

Note: Node.js for MCP Servers

Even though Claude Code's native installer doesn't require Node.js, many popular MCP servers (Context7, Playwright, GitHub) run via npx. If you plan to use MCP servers — and you should — install Node.js 18+ as part of your setup. We cover this in the MCP section below.

Installation: The Native Installer (Recommended)

The native installer is now Anthropic's recommended installation method. It produces a single self-contained executable with no external dependencies, includes an automatic updater, and avoids the permission complexities that plagued npm-based global installs.

Step 1: Update Your System

Start with a clean package state:

bash
sudo apt update && sudo apt upgrade -y

Step 2: Run the Native Installer

A single command handles everything — downloading, installing, and adding Claude Code to your PATH:

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

The installer downloads the appropriate binary for your architecture, places it in a system-accessible location, and configures your shell PATH automatically.

You can also install a specific version or the latest pre-release build:

bash
# Install a specific version
curl -fsSL https://claude.ai/install.sh | bash -s 1.0.58

# Install the latest pre-release version
curl -fsSL https://claude.ai/install.sh | bash -s latest

Alternatively, if you use Homebrew on Linux:

bash
brew install --cask claude-code

Step 3: Verify the Installation

bash
# Check the installed version
claude --version

# Run the built-in diagnostic tool
claude doctor

The claude doctor command checks your installation type, version, shell configuration, and system dependencies. If anything is misconfigured, it provides specific remediation steps. Use this as your first-line troubleshooting tool for any issue.

Step 4: Authenticate

Navigate to a project directory and launch Claude Code:

bash
cd your-project-directory
claude

On first launch, Claude Code presents authentication options. There are three paths depending on your account type:

  • Claude Console (API billing): The default option. Complete an OAuth flow that connects to your Anthropic Console account. Requires active billing at console.anthropic.com. A dedicated "Claude Code" workspace is automatically created for usage tracking.
  • Claude Pro or Max subscription: Log in with your claude.ai account. Your existing subscription includes Claude Code access — no separate API billing required. This is the simplest path for individual developers.
  • Enterprise platforms: Configure Claude Code to use Amazon Bedrock, Google Vertex AI, or Microsoft Foundry for deployments that leverage existing cloud infrastructure.

Claude Code securely stores your credentials after the first authentication. You won't need to re-authenticate unless you explicitly log out or your credentials expire.

Legacy Method: npm Installation

The npm installation method still works but is officially deprecated by Anthropic. If you have a specific reason to use it — such as an environment where the native installer isn't supported — the process requires Node.js 18+:

bash
# Only if you need the legacy npm method
npm install -g @anthropic-ai/claude-code

Important: Never Use sudo With npm Install

Running sudo npm install -g creates permission issues and security risks. If you encounter permission errors with npm, configure a user-level npm directory instead: mkdir -p ~/.npm-global && npm config set prefix ~/.npm-global, then add export PATH=~/.npm-global/bin:$PATH to your ~/.bashrc file.

If you already have an npm-based installation, you can migrate to the native binary by running claude install from within an existing Claude Code session.

Essential Commands and Configuration

Once Claude Code is running, you interact through natural language and slash commands. Here are the commands you'll use most frequently:

Command Purpose
claude Start an interactive session in the current directory
claude "query" Start a session with an initial prompt
/init Generate a CLAUDE.md project guide that explains your codebase structure
/compact Summarize and compress conversation history to free context space
/mcp View and manage connected MCP servers and their status
/resume Resume a previous Claude Code session
/context Monitor context window usage across the session
/debug Have Claude help troubleshoot the current session
/tasks View and manage background tasks
/cost Show token usage and cost statistics for the session
claude update Manually update to the latest version
claude doctor Run diagnostics to detect configuration issues

Claude Code also automatically updates in the background. It checks for updates on startup and periodically during sessions, downloading and installing new versions without interrupting your work. Updates apply the next time you start a session. You can disable auto-updates by setting DISABLE_AUTOUPDATER=1 in your environment.

Using Claude Code in Your Projects

With Claude Code installed and authenticated, here are the workflows that deliver the most value for development teams.

Understanding a New Codebase

When joining a project or onboarding new team members, Claude Code can map the entire codebase and generate structural documentation:

Claude Code prompt
# Generate a project guide
/init

# Ask about architecture
> summarize this project's architecture and key dependencies

# Explore specific modules
> explain the authentication flow in this codebase

The /init command creates a comprehensive CLAUDE.md file that serves as persistent context for future sessions — Claude reads this file automatically to understand your project's structure, conventions, and key patterns.

Editing Code and Fixing Bugs

Claude Code prompt
# Fix errors across multiple files
> fix the type errors in the auth module

# Implement a new feature
> create a rate limiting middleware for our express app

# Refactor with context
> refactor the database layer to use connection pooling

Git Workflow Management

Claude Code prompt
# Commit with contextual messages
> commit my changes with a descriptive message

# Handle complex git operations
> rebase on main and resolve any merge conflicts

# Create a pull request
> create a PR with a summary of all changes since branching from main

Claude Code examines the actual diff to write commit messages and PR descriptions that reflect what changed and why — not just boilerplate placeholders.

Setting Up MCP Servers: The Real Force Multiplier

The Model Context Protocol is an open-source standard that connects AI tools to external services. MCP servers give Claude Code access to tools, databases, APIs, and capabilities that go far beyond its built-in features. This is where Claude Code transforms from a coding assistant into an integrated development platform.

MCP servers come in three transport types: HTTP (remote, recommended for cloud services), SSE (remote, deprecated in favor of HTTP), and stdio (local processes). Most of the servers covered here use stdio, which means they run as local processes on your machine.

MCP Server Scopes in Claude Code

Local

Private to you, current project only. Stored in ~/.claude.json. Default scope.

Project

Shared via .mcp.json at project root. Checked into version control for team use.

User

Available across all projects on your machine. Private to your account.

Source: Anthropic Claude Code Documentation, 2026

Prerequisite: Install Node.js for MCP Servers

Most popular MCP servers run via npx, which requires Node.js. If you haven't already installed it:

bash
# Install Node.js 20.x LTS
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs

# Verify
node --version   # Should show v20.x.x
npm --version    # Should show 10.x.x or higher

For Serena specifically, you will also need Python's uv package manager:

bash
# Install uv (Python package manager used by Serena)
curl -LsSf https://astral.sh/uv/install.sh | sh

Context7: Real-Time Documentation in Your Prompt

Context7, developed by Upstash, solves one of the most persistent frustrations with AI code generation: outdated API references. Claude Code's training data has a knowledge cutoff, which means it may suggest deprecated methods, removed API endpoints, or patterns that don't work with the version of a library you are actually using.

Context7 fetches current, version-specific documentation directly from official library sources and injects it into Claude Code's context window at query time. No manual copy-pasting from docs, no tab-switching, no hallucinated methods that don't exist.

Installation takes one command:

bash — run from your terminal, not inside Claude Code
# Add Context7 as a user-scoped server (available in all projects)
claude mcp add context7 --scope user -- npx -y @upstash/context7-mcp@latest

Once installed, append "use context7" to any prompt where you need current documentation:

Claude Code prompt
# Get current Next.js 15 middleware documentation
> Create a Next.js 15 middleware that checks for a valid JWT in cookies. use context7

# Get accurate FastAPI auth patterns for the version you're using
> Implement OAuth2 authentication in FastAPI. use context7

Context7 provides two tools that Claude Code uses automatically: resolve-library-id (converts a library name into a Context7-compatible identifier) and get-library-docs (fetches current documentation for that library). The lookup happens in milliseconds and the results go directly into Claude's context [Upstash].

An optional free API key from context7.com/dashboard provides higher rate limits for heavy usage.

Serena: Semantic Code Understanding Through Language Servers

While Claude Code's built-in file reading treats your codebase as text, Serena integrates with Language Server Protocol (LSP) implementations — the same technology that powers intelligent features in VS Code and JetBrains IDEs. This gives Claude Code symbol-level understanding: it can find all references to a function, understand class hierarchies, navigate to definitions, and make precise edits based on semantic structure rather than text patterns.

Serena supports over 30 programming languages including Python, TypeScript, JavaScript, Rust, Go, Java, C#, and many more. It automatically installs the appropriate language servers when it encounters a new language [Oraios AI].

Add Serena to a specific project:

bash — run from your project root directory
# Add Serena with project context (recommended for project-specific use)
claude mcp add serena -- uvx --from git+https://github.com/oraios/serena \
  serena start-mcp-server --context ide-assistant --project $(pwd)

Or make it available across all projects:

bash
# Add Serena globally (user scope)
claude mcp add serena --scope user -- uvx --from git+https://github.com/oraios/serena \
  serena start-mcp-server --context ide-assistant

The --context ide-assistant parameter optimizes Serena's toolset for IDE-integrated workflows. Once connected, Serena provides tools like find_symbol, find_referencing_symbols, and insert_after_symbol that enable precise, structural code operations.

Practical examples of what Serena enables:

Claude Code prompt
# Semantic code analysis
> Analyze the authentication flow in this project

# Refactoring with full reference awareness
> The UserProfile component is too large — split it while updating all import references

# Understanding dependencies
> Find all functions that handle user data validation and show their callers

Serena also maintains a project memory system in .serena/memories/, enabling context retention across sessions. This is especially valuable in large codebases where rebuilding context each session wastes time and tokens.

Playwright: AI-Driven Browser Automation

Microsoft's Playwright MCP server gives Claude Code the ability to launch and control real browsers. Instead of describing what you want tested and then manually running test scripts, you can ask Claude Code to interact with your web application directly — navigating pages, clicking elements, filling forms, taking screenshots, and inspecting accessibility trees.

There are two Playwright MCP options. The official Microsoft server uses structured accessibility snapshots (no screenshots needed):

bash
# Microsoft's official Playwright MCP (accessibility-based, recommended)
claude mcp add playwright -s local -- npx @playwright/mcp@latest

The community ExecuteAutomation server provides additional capabilities including API testing:

bash
# Community Playwright MCP with extended features
claude mcp add playwright -s local -- npx -y @executeautomation/playwright-mcp-server

When you first use Playwright through Claude Code, browser binaries are automatically downloaded. After installation, a visible Chrome window opens that Claude Code controls in real-time — you can watch it navigate, click, and interact with your application [Microsoft].

Claude Code prompt
# Open a browser and test a login flow
> Use playwright mcp to open a browser to localhost:3000 and test the login form

# Validate a deployment
> Use playwright to navigate to our staging site and verify the new dashboard renders correctly

# Generate test scripts
> Use playwright to test the checkout flow and generate a Playwright test script from the interactions

Because Playwright uses a visible browser window, authentication is straightforward — have Claude navigate to a login page, log in yourself with your own credentials, then tell Claude to continue. Cookies persist for the duration of the session.

Verifying MCP Server Status

After adding MCP servers, verify they're connected and healthy:

bash and Claude Code commands
# From the terminal: list all configured MCP servers
claude mcp list

# From inside Claude Code: check connection status
/mcp

# Debug MCP connections with verbose output
claude --mcp-debug

The /mcp command inside Claude Code shows the live connection status of each server — connected, failed, or disabled — and lets you toggle servers on or off during your session.

Security Best Practices

Claude Code operates with real access to your filesystem and terminal. Treating it as a trusted but supervised team member — rather than either an unrestricted automation script or a sandboxed chat widget — produces the best balance of productivity and safety.

  • Review commands before approving: Claude Code asks for permission before executing shell commands, writing files, or making git operations. Always review the proposed action, especially when working in production-adjacent environments.
  • Store API keys in environment variables: Never hardcode API keys in MCP server configurations that might be checked into version control. Use environment variables and the --env flag when adding MCP servers.
  • Use appropriate MCP scopes: Keep sensitive MCP configurations in local scope (private to you) rather than project scope (shared via version control). Use project scope only for MCP servers that all team members should have.
  • Configure directory ignores: For projects containing sensitive data, configure Claude Code to skip directories that shouldn't be read or modified.
  • Keep Claude Code updated: Auto-updates are enabled by default. If you've disabled them, run claude update regularly to get security fixes and improvements.
  • Vet third-party MCP servers: Anthropic does not verify the security of all third-party MCP servers. Review the source code of any MCP server before granting it access to your environment, especially servers that can fetch untrusted content (which exposes you to prompt injection risk).

Enterprise teams deploying Claude Code across organizations should consider configuring MCP server allowlists and denylists through managed settings to restrict which servers developers can install. AI consulting and strategy partners can help organizations establish governance frameworks that balance developer productivity with security requirements.

Troubleshooting Common Installation Issues

▶ "Command not found" after installation

If claude isn't recognized after installing, your shell hasn't picked up the PATH changes. Run:

source ~/.bashrc   # or ~/.zshrc for Zsh users

If that doesn't work, open a new terminal window to reload your shell configuration entirely. Run claude doctor to identify the specific PATH issue.

▶ Authentication failures

If the OAuth flow fails or your session expires:

# Log out and re-authenticate
/logout
/login

Verify that your Anthropic Console billing is active (for API auth) or that your Claude Pro/Max subscription is current. Enterprise users should confirm their Bedrock or Vertex configuration with their cloud administrator.

▶ MCP server shows "failed" status

If an MCP server fails to connect:

  • Verify the server command is correct: claude mcp get server-name
  • Check that required dependencies are installed (Node.js for npx-based servers, uv for Serena)
  • Run Claude Code with MCP debugging enabled: claude --mcp-debug
  • Remove and re-add the server: claude mcp remove server-name
▶ Migrating from npm to native installer

If you have an existing npm installation and want to migrate:

# From inside an existing Claude Code session
claude install

# Or uninstall npm version first, then install native
npm uninstall -g @anthropic-ai/claude-code
curl -fsSL https://claude.ai/install.sh | bash

Your MCP configurations, project settings, and session history are preserved during migration.

Enterprise Deployment Considerations

Organizations deploying Claude Code across development teams should approach the rollout with the same governance structure applied to any development tool that accesses source code and production infrastructure:

  • Start with a pilot group to establish usage patterns, identify high-value workflows, and develop internal guidelines before broader rollout.
  • Set workspace spending limits in the Anthropic Console to prevent unexpected API costs. Claude Pro/Max subscriptions provide more predictable per-seat pricing for larger teams.
  • Standardize MCP server configurations using project-scoped .mcp.json files committed to version control, ensuring all team members have access to the same integrations.
  • Configure MCP allowlists through enterprise managed settings to restrict which MCP servers developers can install, preventing unauthorized tool connections.
  • Consider development container setups for consistent environments that include Claude Code, MCP servers, and required dependencies pre-configured.
  • Implement network access controls for environments handling sensitive data, restricting which external endpoints Claude Code and MCP servers can reach.

For organizations that need managed IT services to support development infrastructure modernization — including AI tool deployment, security policy configuration, and developer environment standardization — working with an experienced technology partner accelerates time-to-value while maintaining compliance posture.

Sources

  • Anthropic. "Set up Claude Code." Claude Code Documentation, 2026. code.claude.com/docs/en/setup
  • Anthropic. "Connect Claude Code to tools via MCP." Claude Code Documentation, 2026. code.claude.com/docs/en/mcp
  • Anthropic. "claude-code." GitHub Repository, 2026. github.com/anthropics/claude-code
  • Upstash. "Context7 MCP Server." GitHub Repository, 2026. github.com/upstash/context7
  • Oraios AI. "Serena: A Powerful Coding Agent Toolkit." GitHub Repository, 2026. github.com/oraios/serena
  • Microsoft. "Playwright MCP Server." GitHub Repository, 2026. github.com/microsoft/playwright-mcp

Related Resources

AI Consulting & Strategy

Strategic AI adoption guidance for development teams, including tool selection, governance frameworks, and integration planning.

Managed IT Services

Comprehensive IT management including developer infrastructure, tool deployment, and security policy configuration.

Cybersecurity Services

Security assessment and policy development for organizations deploying AI-powered development tools across their engineering teams.

How To Install Serena MCP on Linux

Deep-dive technical guide covering advanced Serena MCP configuration, language server setup, and production deployment strategies.

Ready to Accelerate Your Development Workflow?

Claude Code with properly configured MCP servers turns your terminal into an integrated development hub — connected to your documentation, your codebase's semantic structure, and real browser automation. ITECS helps development teams deploy and govern AI-powered tools at enterprise scale, with the security controls and operational oversight that production environments demand.

Talk to Our AI Consulting Team →

continue reading

More ITECS blog articles

Browse all articles

About Brian Desmot

The ITECS team consists of experienced IT professionals dedicated to delivering enterprise-grade technology solutions and insights to businesses in Dallas and beyond.

Share This Article

Continue Reading

Explore more insights and technology trends from ITECS

View All Articles