This guide provides comprehensive instructions for setting up Claude Code on Linux systems, including Fedora. Claude Code is a powerful AI coding assistant that can be accessed via the command line.
Note: Claude Code is currently available only in supported countries. Please check the Anthropic website for availability in your region.
We provide a convenient installation script that handles all the setup for you:
curl -O https://raw.githubusercontent.com/wronai/wrd/main/install_claude_code.sh
chmod +x install_claude_code.sh
./install_claude_code.sh
If you prefer to install manually, follow these steps:
# For Fedora
sudo dnf install -y nodejs npm
# For Debian/Ubuntu
# sudo apt update && sudo apt install -y nodejs npm
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
npm install -g @anthropic-ai/claude-code
Claude Code offers multiple authentication options:
claude
in your terminalclaude
in your terminalFor enterprise deployments, you can configure Claude Code to use:
Contact your enterprise administrator for specific configuration details.
If you prefer to use an API key directly:
# For Bash
echo 'export ANTHROPIC_API_KEY="your-api-key-here"' >> ~/.bashrc
source ~/.bashrc
# For Zsh
echo 'export ANTHROPIC_API_KEY="your-api-key-here"' >> ~/.zshrc
source ~/.zshrc
# For Fish
set -Ux ANTHROPIC_API_KEY "your-api-key-here"
If you’re using WRD, you can configure Claude Code by updating your ~/.wrd/config.yaml
:
ai_tools:
claude_code:
enabled: true
api_key: ${ANTHROPIC_API_KEY} # Read from environment variable
default_model: claude-3-opus-20240229
max_tokens: 4000
temperature: 0.7
For first-time users, we recommend initializing your project:
cd your-project-directory
claude
> summarize this project
CLAUDE.md
project guide:
/init
CLAUDE.md
file to your repository.# Start an interactive chat session
claude-code chat
# Get a response to a single prompt
claude-code prompt "Explain how to use Claude Code"
# Specify a different model
claude-code --model claude-3-sonnet-20240229 prompt "Write a Python function to reverse a string"
--model
: Specify the model to use (default: claude-3-opus-20240229)--max-tokens
: Maximum number of tokens to generate (default: 4000)--temperature
: Controls randomness (0.0 to 1.0, default: 0.7)--top-p
: Nucleus sampling parameter (0.0 to 1.0)--stream
: Stream the responseclaude-code interactive
In interactive mode, you can:
Ctrl+D
to exit/help
to see available commandsIf you encounter permission errors when installing npm packages globally:
echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
If you’re using WSL and encounter issues:
# Set the correct OS before installation
npm config set os linux
# Install with OS check disabled
npm install -g @anthropic-ai/claude-code --force --no-os-check
Important: Do NOT use
sudo
with npm install as it can lead to permission issues.
exec: node: not found
when running claude
:
which npm
which node
/usr/
) not Windows paths (starting with /mnt/c/
)If you need to manage multiple Node.js versions, we recommend using NVM (Node Version Manager):
# Install NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
# Install and use Node.js LTS
nvm install --lts
nvm use --lts
If you get an error about the API key not being found:
echo $ANTHROPIC_API_KEY
ANTHROPIC_API_KEY=your-key-here claude-code prompt "Hello"
You can integrate Claude Code with WRD workflows by adding it to your project’s workflow configuration:
# .wrd/workflows/code_review.yaml
name: Code Review Workflow
description: Automated code review using Claude Code
triggers:
- pull_request
- push
jobs:
claude-code-review:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Claude Code
run: npm install -g @anthropic-ai/claude-code
- name: Run code review
env:
ANTHROPIC_API_KEY: $
run: |
# Example: Run code review on changed files
git diff --name-only HEAD^ HEAD | xargs -I{} sh -c '
echo "\nReviewing $1..."
claude-code prompt "Review this code for potential issues, security vulnerabilities, and improvements:\n\n$(cat "$1")"
' _ {}'
You can customize how Claude Code responds by providing a system prompt:
claude-code --system "You are a senior software engineer with 10+ years of experience in Python and cloud technologies. Provide concise, professional code reviews." prompt "Review this code..."
For the best Claude Code experience, optimize your terminal setup:
tmux
or screen
for long-running sessionsclaude-3-opus-20240229
: Most capable, highest costclaude-3-sonnet-20240229
: Balanced performance and costclaude-3-haiku-20240307
: Fastest, most cost-effectiveFor additional help, please refer to:
This documentation is part of the WRD project and is licensed under the MIT License.