Skip to content

Instantly share code, notes, and snippets.

@lixiangwuxian
Created March 30, 2026 02:29
Show Gist options
  • Select an option

  • Save lixiangwuxian/96836be2c1e281b1d6fac754af21f5b8 to your computer and use it in GitHub Desktop.

Select an option

Save lixiangwuxian/96836be2c1e281b1d6fac754af21f5b8 to your computer and use it in GitHub Desktop.
Install claude code directly
#!/bin/bash
set -euo pipefail
INSTALL_DIR="/root/.local/share/claude/versions"
BIN_LINK="/root/.local/bin/claude"
ARCH="linux-x64"
# 1. 获取最新版本号
echo "正在获取最新版本..."
VERSION=$(curl -s https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/latest)
echo "最新版本: $VERSION"
TARGET="$INSTALL_DIR/$VERSION"
if [ -x "$TARGET" ]; then
echo "版本 $VERSION 已存在且可执行,跳过下载。"
else
# 2. 下载二进制文件
echo "正在下载 claude $VERSION ..."
proxychains4 wget -q --show-progress -O "$TARGET" \
"https://downloads.claude.ai/claude-code-releases/$VERSION/$ARCH/claude"
chmod +x "$TARGET"
fi
# 3. 更新符号链接
rm -f "$BIN_LINK"
ln -s "$TARGET" "$BIN_LINK"
echo "已更新 claude -> $VERSION"
claude --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment