claude初体验
2026-06-09
claude安装、配置、使用备忘
1. 安装claude code
官方给出的安装方法是curl -fsSL https://claude.ai/install.sh | bash但是即使配置代理,也无法正常安装,报错如下
# curl -fsSL https://claude.ai/install.sh | bash
curl: (22) The requested URL returned error: 403
因此可以使用以下安装方式,以下安装方式是老的安装方式,也是上面install.sh本质做的事情
# rpm系安装
# 添加 NodeSource 仓库
curl -fsSL https://rpm.nodesource.com/setup_20.x | bash -
# 安装 Node.js
dnf install -y python3
dnf install -y nodejs --disablerepo=* --enablerepo=nodesource-nodejs # 此处指定源是为了防止从其他网络源下载nodejs,因为其他源的版本可能太低不能使用
# deb系安装
# 添加 NodeSource 仓库
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
# 安装 Node.js
apt install -y nodejs
# 验证安装
node --version # 应显示 v20.x.x
npm --version
# 安装claude-code
npm install --verbose -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com
2.配置使用deepseek模型
需要先配置其他模型,否则进入claude会卡在Checking connectivity...
# vim .bashrc # 编辑.bashrc,替换sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx为你的的deepseek的key
export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic
export ANTHROPIC_AUTH_TOKEN=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
export ANTHROPIC_MODEL=deepseek-v4-pro[1m]
export ANTHROPIC_DEFAULT_OPUS_MODEL=deepseek-v4-pro[1m]
export ANTHROPIC_DEFAULT_SONNET_MODEL=deepseek-v4-pro[1m]
export ANTHROPIC_DEFAULT_HAIKU_MODEL=deepseek-v4-flash
export CLAUDE_CODE_SUBAGENT_MODEL=deepseek-v4-flash
export CLAUDE_CODE_EFFORT_LEVEL=max
alias claude="claude --permission-mode acceptEdits --allowedTools \"Read,Write,Edit,Bash(*)\""
# source .bashrc # 生效
验证是否生效
# claude
╭─── Claude Code v2.1.169 ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ │ Tips for getting started │
│ Welcome back! │ Run /init to create a CLAUDE.md file with instructions for Claude │
│ │ ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── │
│ │ What's new │
│ │ Added `--safe-mode` flag (and `CLAUDE_CODE_SAFE_MODE`) to start Claude Code with all customizations (CLAUDE.md, plugins, skills, hoo… │
│ │ Added `/cd` command to move a session to a new working directory without breaking the prompt cache mid-session │
│ │ Added a `disableBundledSkills` setting and `CLAUDE_CODE_DISABLE_BUNDLED_SKILLS` environment variable to hide bundled skills, workflo… │
│ deepseek-v4-pro[1m] · API Usage Billing │ /release-notes for more │
│ ~/workspace/sigma-mgr │ │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
▎ Opus 4.8 is now available! · /model to switch
❯ 你是什么模型
Thought for 8s (ctrl+o to expand)
● 我是 DeepSeek V4 Pro(1M 上下文窗口),由 Anthropic 的 Claude Code(CLI 工具)编排和调用。
✻ Crunched for 9s
3. npm相关介绍
# 查看当前源
npm config get registry
# 配置源为阿里源
npm config set registry https://registry.npmmirror.com/
4. 零散的操作备忘
# 安装找技能的skill
npx skills add vercel-labs/skills@find-skills -y
# 安装Frontend Design技能
使用skill find-skills安装Frontend Design
# 安装superpowers 技能
使用skill find-skills安装obra/superpowers