安装脚本支持 arm64 + Alpine(架构自动检测)

This commit is contained in:
Muse
2026-10-19 21:34:29 +08:00
parent 9105f7f364
commit bcd7b47c3d
2 changed files with 28 additions and 12 deletions
+14 -6
View File
@@ -1,7 +1,7 @@
#!/bin/bash
# 3x-ui-agent 主控一键安装脚本
# 用法: bash install-master.sh
# 要求: Debian/Ubuntu/CentOS amd64, root 运行
# 要求: Debian/Ubuntu/Alpine/CentOS (amd64/arm64), root 运行
set -e
@@ -12,10 +12,14 @@ error() { echo -e "${RED}[ERROR]${NC} $1"; exit 1; }
[[ $EUID -ne 0 ]] && error "请用 root 运行"
ARCH=$(uname -m)
[[ "$ARCH" != "x86_64" && "$ARCH" != "amd64" ]] && error "只支持 amd64, 当前: $ARCH"
case "$ARCH" in
x86_64|amd64) BIN_ARCH="amd64";;
aarch64|arm64) BIN_ARCH="arm64";;
*) error "不支持的架构: $ARCH (仅支持 amd64/arm64)";;
esac
# 二进制下载地址(GitHub release,替换为实际地址)
XUI_URL="${XUI_URL:-https://github.com/imamoxilin/3x-ui-diy/releases/download/v3.7.0-agent.1/x-ui-linux-amd64}"
XUI_URL="${XUI_URL:-https://github.com/imamoxilin/3x-ui-diy/releases/download/v3.7.0-agent.1/x-ui-linux-${BIN_ARCH}}"
XRAY_VER="26.6.27"
info "创建目录..."
@@ -27,9 +31,13 @@ chmod +x /usr/local/x-ui/x-ui
info "下载 xray v${XRAY_VER}..."
cd /usr/local/x-ui/bin
curl -fL -o Xray-linux-64.zip "https://github.com/XTLS/Xray-core/releases/download/v${XRAY_VER}/Xray-linux-64.zip" || error "xray 下载失败"
unzip -o -q Xray-linux-64.zip xray && mv xray xray-linux-amd64 && chmod +x xray-linux-amd64
rm -f Xray-linux-64.zip
case "$BIN_ARCH" in
amd64) XRAY_ZIP="Xray-linux-64.zip";;
arm64) XRAY_ZIP="Xray-linux-arm64-v8a.zip";;
esac
curl -fL -o "$XRAY_ZIP" "https://github.com/XTLS/Xray-core/releases/download/v${XRAY_VER}/${XRAY_ZIP}" || error "xray 下载失败"
unzip -o -q "$XRAY_ZIP" xray && mv xray "xray-linux-${BIN_ARCH}" && chmod +x "xray-linux-${BIN_ARCH}"
rm -f "$XRAY_ZIP"
info "下载 geo 文件..."
curl -fL -o geoip.dat "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat" || error "geoip 下载失败"