Files
3x-ui-agent/install-master.sh
T
Muse c67f0cb0cf 链接迁移: fork 脚本复活指 Gitea、上游三件套中和、面板自更新链改指本仓
- install-master.sh/install-agent.sh: 二进制下载源由已封账号 aaaamoooo/3x-ui-diy
  改指本仓 Gitea Releases (tag 沿用 v3.7.0-agent.1); README 同步撤下'暂不可用'标注
- install.sh/update.sh: 未被 fork 部署链引用, 整文件替换为中英双语短桩 (exit 1),
  防旧习惯调用时静默装成/更新成上游原版
- x-ui.sh: 保留全部管理功能, 仅中和 install/update/update_dev/update_menu/
  legacy_version/update_shell 的上游下载分支与 uninstall 打印的上游命令,
  一律改为提示本仓 Gitea Releases 地址后退出该分支
- panel.go: 面板自更新运行时耦合处理 — panelUpdaterURL 与版本检查 API 由
  MHSanaei GitHub 改指本仓 Gitea (raw update.sh + /api/v1 releases, 响应字段
  tag_name/body/target_commitish 与原解析结构一致); 下载到的将是本仓 update.sh
  短桩, 面板更新会安全失败而非覆盖成原版
- deploy/cloud-init: curl 上游 install.sh 改为本仓 install-master.sh (Gitea raw);
  头部注明 XUI_* 非交互旋钮与 install-result.env 凭据回显在 fork 安装脚本下无等价物
2026-10-20 12:36:50 +00:00

61 lines
2.1 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# 3x-ui-agent 主控一键安装脚本
# 用法: bash install-master.sh
# 要求: Debian/Ubuntu/Alpine/CentOS (amd64/arm64), root 运行
set -e
RED='\033[0;31m'; GREEN='\033[0;32m'; NC='\033[0m'
info() { echo -e "${GREEN}[INFO]${NC} $1"; }
error() { echo -e "${RED}[ERROR]${NC} $1"; exit 1; }
[[ $EUID -ne 0 ]] && error "请用 root 运行"
ARCH=$(uname -m)
case "$ARCH" in
x86_64|amd64) BIN_ARCH="amd64";;
aarch64|arm64) BIN_ARCH="arm64";;
*) error "不支持的架构: $ARCH (仅支持 amd64/arm64)";;
esac
# 二进制下载地址(本仓 Gitea Releases,tag 沿用 v3.7.0-agent.1)
XUI_URL="${XUI_URL:-https://git.881218.xyz/rogue/3x-ui-agent/releases/download/v3.7.0-agent.1/x-ui-linux-${BIN_ARCH}}"
XRAY_VER="26.6.27"
info "创建目录..."
mkdir -p /usr/local/x-ui/bin /etc/x-ui
info "下载主控二进制..."
curl -fL -o /usr/local/x-ui/x-ui "$XUI_URL" || error "主控下载失败"
chmod +x /usr/local/x-ui/x-ui
info "下载 xray v${XRAY_VER}..."
cd /usr/local/x-ui/bin
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 下载失败"
curl -fL -o geosite.dat "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat" || error "geosite 下载失败"
info "启动主控..."
cd /usr/local/x-ui
pkill -f "/usr/local/x-ui/x-ui" 2>/dev/null; sleep 1
nohup ./x-ui > /tmp/xui.log 2>&1 &
sleep 5
if ss -tlnp 2>/dev/null | grep -q ":2053"; then
info "主控启动成功!"
echo ""
echo " 面板地址: http://$(hostname -I | awk '{print $1}'):2053"
echo " 默认账号: admin / admin"
echo " 请登录后立即修改密码"
else
error "启动失败,查看日志: cat /tmp/xui.log"
fi