Created
March 30, 2026 02:29
-
-
Save lixiangwuxian/96836be2c1e281b1d6fac754af21f5b8 to your computer and use it in GitHub Desktop.
Install claude code directly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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