Skip to content

Agent 安装记录

📅 发表于 2026/04/01
🔄 更新于 2026/08/05
👁️ — 次访问
📝 1171 字
5 分钟
claude
#claude
#dashscope
#tavily
#mcp

Claude Code 源码安装

前置环境

设置github镜像和安装zip

bash
git config --global url."https://gh-proxy.com/https://github.com/".insteadOf "https://github.com/"
sudo apt-get update && sudo apt-get install zip unzip -y

需要较新的版本

bash
# linux node 安装,根据官方脚本安装即可,记得配置环境变量到我的mf.bashrc里
# 下载并安装 nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
# 代替重启 shell
\. "$HOME/.nvm/nvm.sh"
# 下载并安装 Node.js:
nvm install 24
# 验证 Node.js 版本:
node -v # Should print "v24.14.1".
# 下载并安装 pnpm:
corepack enable pnpm
# 验证 pnpm 版本:
pnpm -v
# 安装bun
npm install -g bun

# 环境变量配置
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # 加载 nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # 加载 nvm 命令补全

或单独安装bun,但是经常网不通

bash
# bun 安装
curl -fsSL https://bun.com/install | bash
# 环境变量配置
export PATH="/Users/plm/.bun/bin:$PATH"

# node 安装
# 去下载macos .pkg,一步步安装就好了
# https://nodejs.org/zh-cn/download

非源码安装

bash
npm install -g @anthropic-ai/claude-code

npm update -g @anthropic-ai/claude-code

源码编译

下载编译,下载好以后, 先在package.json里吧修改项目bin名称由claude-js修改为claude

json
{
  "name": "claude",
  "bin": {
    "claude": "dist/cli.js"
  },
}
bash
# 源代码
git clone https://github.com/claude-code-best/claude-code.git
# git clone https://github.com/plmsmile/claude-code.git

# 编译安装
cd claude-code
bun install
bun run build
# 也可以先开发模式看一下
bun run dev

设置环境变量,全局运行claude

bash
# 编译完成后进入dist检查,但是运行的话,需要先配置一些东西
cd dist
bun cli.js 
# 或者
bun cli.js -p "Hello Claude"
# 配置
bun link 
# 然后检查是否存在claude
ls ~/.bun/bin

# 运行结果
(base)  claude-code (main) ✗ ls ~/.bun/bin
bun  claude

ClaudeCode 配置

ClaudeCode 跳过登录配置

~/.claude.json

  • 跳过登录,解决无法连接到Anthropic服务的问题
json
{
  // ...
  "hasCompletedOnboarding": true,
  // ...
}

LLM 配置

配置环境变量.zshrc,可使用Qwen 百炼LLM,具体见 百炼接入Claude Code

bash
export ANTHROPIC_API_KEY="sk-xxxxx"
export ANTHROPIC_BASE_URL="https://dashscope.aliyuncs.com/apps/anthropic"
export ANTHROPIC_MODEL="qwen3.6-plus"

也可以直接配置在~/.claude/settings.json ,没有可以新建立一个。

json
{
     "env": {
        "ANTHROPIC_AUTH_TOKEN": "",
        "ANTHROPIC_BASE_URL": "https://dashscope.aliyuncs.com/apps/anthropic",
        "ANTHROPIC_MODEL": "deepseek-v4-pro",
        "ANTHROPIC_SMALL_FAST_MODEL": "deepseek-v4-pro",
        "ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro",
        "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-pro",
        "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-pro"
  }
}

AnySearch 配置

python
由于我在国内没办法使用 Claude 默认的 Web Fetch 和 Web Search 功能,我需要禁掉它,然后我需要使用 AnySearch。这个是https://github.com/anysearch-ai/anysearch-skill                                                    
  skill,你帮我安装一下,我的anysearch的ak是as_sk_3e3f82418dd84df9c03da1d3470ed533。你帮我配置一下。我不清楚这个 skill 是否能够代替 web fetch 功能,总之我是需要一个能搜索、能爬取网页的正常服务。并且配置它默认允许可用,不要每次都来询问我。

PlaywrightMCP和Chrome浏览器自动化

python
这个网页里有一些内容,你帮我看一下:https://academy.claude-code.club/zh/getting-started/claude-code/faq/fetch-websearch-alternatives 。
按照配置一下Paywright MCP,并设置默认可用。
安装完成后,需要重启,并进行测试。

Tavily MCP 配置

由于无法搜索,因此需要配置Tavily MCP 或者 代理。

bash
claude mcp add tavily-remote-mcp --transport http https://mcp.tavily.com/mcp/

再开启一个claude 对话,/mcp,根据引导会自动打开网页做鉴权。

bash
claude

/mcp

# 指令做验证
使用tavily-remote-mcp搜索一下杭州的天气

ClaudeCode 目录及权限配置

根目录设置

bash
# claude 根目录配置
export CLAUDE_CONFIG_DIR=/mnt/nas/liming.plm/.claude

模型设置

bash
{
  "permissions": {
        "allow": [
        "Bash(*)"
        ]
  },
  "env": {
        "ANTHROPIC_AUTH_TOKEN": "",
        "ANTHROPIC_BASE_URL": "https://dashscope.aliyuncs.com/apps/anthropic",
        "ANTHROPIC_MODEL": "deepseek-v4-pro",
        "ANTHROPIC_SMALL_FAST_MODEL": "deepseek-v4-pro",
        "ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro",
        "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-pro",
        "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-pro"
  }
}

Hermes Agent

安装过程

源码安装

提示
  • hermes官方文档
  • 需要配置pip uv 源做加速,否则下载包会比较慢。可用cnpip
  • 由于国内环境,让claude执行本地安装,不用一直等待。
bash
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone & enter
git clone --recurse-submodules https://github.com/NousResearch/hermes-agent.git
cd hermes-agent

# Create venv with Python 3.11
uv venv venv --python 3.11
export VIRTUAL_ENV="$(pwd)/venv"

# Install everything
uv pip install -e ".[all]"
uv pip install -e "./tinker-atropos"
npm install  # optional, for browser tools and WhatsApp

# Configure
mkdir -p ~/.hermes/{cron,sessions,logs,memories,skills,pairing,hooks,image_cache,audio_cache,whatsapp/session}
cp cli-config.yaml.example ~/.hermes/config.yaml
touch ~/.hermes/.env
echo 'OPENROUTER_API_KEY=sk-or-v1-your-key' >> ~/.hermes/.env

# Make hermes available globally
mkdir -p ~/.local/bin
ln -sf "$(pwd)/venv/bin/hermes" ~/.local/bin/hermes

# Verify
hermes doctor
hermes

非源码安装

python
# 需要配置阿里云镜像,pip安装会快一些
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash

配置qwen模型

python
hermes model
https://dashscope.aliyuncs.com/compatible-mode/v1

浏览器安装

bash
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

测试

bash
cd /root/.hermes/hermes-agent && source venv/bin/activate && hermes

hermes

配置微信

bash
cd /root/.hermes/hermes-agent && source venv/bin/activate
pip install aiohttp cryptography
pip install qrcode
hermes gateway setup
总访客数:— · 总访问量:—
PLM's Blog @ 2016 - 2026