install-claude-code-linux
Install and configure Claude Code on RPM-based Linux systems (e.g., Alibaba Cloud Linux) with multiple fallback methods (native installer, npm, nvm+npm). Includes DashScope/Qwen API configuration template. Use when the user asks to install Claude Code CLI, set up Claude Code CLI, or configure Claude Code with a custom API endpoint on RPM-based Linux systems.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 665
- Forks
- 195
01 前言 Front Matter
- name
- install-claude-code-linux
- layer
- application
- version
- 1.0.0
- lifecycle
- usage
- description
- Install and configure Claude Code on RPM-based Linux systems (e.g., Alibaba Cloud Linux) with multiple fallback methods (native installer, npm, nvm+npm). Includes DashScope/Qwen API configuration template. Use when the user asks to install Claude Code CLI, set up Claude Code CLI, or configure Claude Code with a custom API endpoint on RPM-based Linux systems.
02 资源文件 1
- 脚本scripts/install-claude-code.sh10.9 KB
03 SKILL.md 正文
Install Claude Code on Alinux 4
System Requirements
- OS: Linux
- RAM: 4 GB+
- Network: 需要联网
- Shell: Bash
- Package Manager: dnf
Installation Workflow
Copy this checklist and track progress:
Task Progress:
- [ ] Step 1: Check system & install prerequisites
- [ ] Step 2: Install Claude Code (try methods in order)
- [ ] Step 3: Verify installation
- [ ] Step 4: Configure API provider
- [ ] Step 5: Test run
- [ ] Step 6: Tokenless plugin auto-installed
Step 1: Check System & Install Prerequisites
Alinux 4 使用 dnf 作为包管理器。先确保基础依赖就绪:
# 确认系统版本
cat /etc/os-release
# 安装基础依赖
sudo dnf install -y curl git tar gzip glibc libstdc++
Step 2: Install Claude Code
Try these methods in order. Move to the next only if the previous one fails.
Method A: Native Installer (Recommended)
curl -fsSL https://claude.ai/install.sh | bash
官方推荐方式,自动后台更新,无需 Node.js 依赖。
To install a specific version:
curl -fsSL https://claude.ai/install.sh | bash -s 1.0.58
To install the stable channel:
curl -fsSL https://claude.ai/install.sh | bash -s stable
安装后确保 ~/.local/bin 在 PATH 中:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Method B: npm Global Install (Fallback)
Requires Node.js 18+. Alinux 4 默认源的 Node.js 版本可能较低,建议先确认版本:
node --version
如果 >= 18,直接安装:
npm install -g @anthropic-ai/claude-code
Do NOT use sudo npm install -g — it causes permission issues. If you get EACCES errors, fix npm prefix:
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
npm install -g @anthropic-ai/claude-code
Method C: nvm + npm (When No Node.js 18+ Available)
Alinux 4 默认源可能只有 Node.js 16,此方法通过 nvm 安装 LTS 版本:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
source ~/.bashrc
nvm install --lts
npm install -g @anthropic-ai/claude-code
Or use the automated script (auto-fallback all 3 methods):
bash scripts/install-claude-code.sh
Pass --skip-tokenless to skip the tokenless Claude Code plugin auto-installation.
Step 3: Verify Installation
claude --version
claude doctor
Step 4: Configure Third-Party API Provider
If the user is NOT using an Anthropic account directly, configure ~/.claude/settings.json with their API provider:
mkdir -p ~/.claude
DashScope (Qwen) Configuration Template:
Write the following to ~/.claude/settings.json:
{
"env": {
"ANTHROPIC_BASE_URL": "https://dashscope.aliyuncs.com/apps/anthropic",
"ANTHROPIC_AUTH_TOKEN": "YOUR_API_KEY",
"ANTHROPIC_MODEL": "qwen3-coder-plus",
"ANTHROPIC_SMALL_FAST_MODEL": "qwen3-coder-plus"
}
}
Replace YOUR_API_KEY with the user's actual API key.
Alternative: Shell Environment Variables
If the user prefers shell env vars over settings.json, append to ~/.bashrc:
export ANTHROPIC_BASE_URL="https://dashscope.aliyuncs.com/apps/anthropic"
export ANTHROPIC_AUTH_TOKEN="YOUR_API_KEY"
export ANTHROPIC_MODEL="qwen3-coder-plus"
export ANTHROPIC_SMALL_FAST_MODEL="qwen3-coder-plus"
Then source ~/.bashrc.
One-liner with script (interactive key input):
bash scripts/install-claude-code.sh --config
Step 5: Test Run
claude "hello, tell me who you are"
If using a third-party API, verify the model responds correctly. If you see authentication errors, double-check the API key and base URL.
Troubleshooting
| Symptom | Fix |
|---|---|
command not found: claude |
Check ~/.local/bin is in PATH: export PATH="$HOME/.local/bin:$PATH" |
| Native installer hangs | Try npm method (Method B or C) |
EACCES permission error (npm) |
Use the npm prefix fix shown in Method B |
model not found |
Verify ANTHROPIC_MODEL value matches the provider's model name exactly |
| Timeout errors | Add "API_TIMEOUT_MS": "600000" to the env block in settings.json |
GLIBC_xxx not found |
Run sudo dnf update glibc libstdc++ to update C runtime |
| dnf lock conflict | Wait for other dnf process to finish, or sudo kill the stale process |
Uninstall
Native installation:
rm -f ~/.local/bin/claude
rm -rf ~/.local/share/claude
npm installation:
npm uninstall -g @anthropic-ai/claude-code
Remove config (optional):
rm -rf ~/.claude
rm -f ~/.claude.json
04 同仓库更多 Skills
ws-ckpt
Linux 工作区快照(ws-ckpt)。用户想保存或备份工作区当前状态("保存一下"、"留个底"、"先备份"), 想撤销或恢复文件改动("回滚"、"撤销"、"改回去"、"恢复到之前"、"刚才那版"), 想查看、对比或删除历史版本,或要开启/关闭每回合自动快照、定时快照、快照保留策略时使用。 用户没提"快照"、只表达保存或恢复工作区文件的意图时同样适用;用户点名 git 操作(commit、branch、reset 到某提交)时不适用。
skillfs-mount
Help users configure, mount, and unmount a skillfs FUSE virtual filesystem on their local machine (e.g. for openclaw). Covers analyzing existing skill usage to suggest view configuration, generating skillfs-views.toml, mounting, and graceful unmount. Use this skill when the user asks to: set up skillfs, configure skill views, mount or unmount skillfs, check if skillfs is running, or get help organizing their skills directory (especially for openclaw users).
test-skill
A test skill used in integration tests.
storage-resize
Linux 磁盘扩容技能(RPM 包管理系统),实现云盘扩容后自动完成分区调整和文件系统扩容。支持系统盘/数据盘在线扩容,适配 XFS/EXT4/Btrfs 文件系统。适用于 RPM 包管理的 Linux 系统(如 Alibaba Cloud Linux)。
ktuner
内核参数自动调优。分析系统配置,输出调优建议并可一键应用,支持自动回滚。使用场景:系统性能优化、安全加固、内核参数诊断。
backup-restore
处理所有备份与恢复任务,覆盖四个层面:工作区(项目/数据库/代码)、用户数据(家目录/dotfiles/密钥)、操作系统(全量系统/磁盘镜像/LVM 快照)、阿里云快照(云盘快照/自动策略/跨地域复制/整机镜像)。适用于 RPM 包管理的 Linux 系统(如 Alibaba Cloud Linux)纯命令行环境,使用 yum 包管理器。当用户提到备份、恢复、快照、归档、回滚、克隆、迁移、容灾等任何涉及数据保存或恢复的请求时触发此技能,即使请求看起来很简单也应使用。