From 353c280fe8632055cee4e0586dffa3d6c9837f64 Mon Sep 17 00:00:00 2001 From: CN-JS-HuiBai Date: Thu, 19 Mar 2026 14:46:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EFRPS=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E5=92=8C=E9=85=8D=E7=BD=AE=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Prometheus/install_cAdvisor.sh | 2 +- System-Init/install_frps.sh | 94 ++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 System-Init/install_frps.sh diff --git a/Prometheus/install_cAdvisor.sh b/Prometheus/install_cAdvisor.sh index 3cb3a87..f377cf4 100644 --- a/Prometheus/install_cAdvisor.sh +++ b/Prometheus/install_cAdvisor.sh @@ -108,4 +108,4 @@ echo "Enabling and starting cAdvisior service..." sudo systemctl daemon-reload sudo systemctl enable --now cAdvisior.service -echo "Node Exporter installation completed, listening on port ${PORT}" +echo "cAdvisior installation completed, listening on port ${PORT}" diff --git a/System-Init/install_frps.sh b/System-Init/install_frps.sh new file mode 100644 index 0000000..de7ab5d --- /dev/null +++ b/System-Init/install_frps.sh @@ -0,0 +1,94 @@ +#!/bin/bash +set -e + +# 设置版本号 +FRP_VERSION="0.54.0" + +# 检查是否为root用户 +if [ "$EUID" -ne 0 ]; then + echo "请使用 root 权限运行此脚本 (Please run as root)" + exit 1 +fi + +# 强制使用 amd64 架构 +FRP_ARCH="amd64" + +echo "==========================================" +echo "准备安装 FRPS ${FRP_VERSION} (${FRP_ARCH})" +echo "==========================================" + +# 交互式输入 token +read -p "请输入 FRPS 认证 Token (留空则生成随机 Token): " FRP_TOKEN + +if [ -z "$FRP_TOKEN" ]; then + FRP_TOKEN=$(tr -dc A-Za-z0-9 /dev/null 2>&1; then + wget -c --show-progress "$FRP_URL" +elif command -v curl >/dev/null 2>&1; then + curl -O -L "$FRP_URL" +else + echo "未找到 wget 或 curl,请先安装其中一个。" + exit 1 +fi + +echo "正在解压安装包..." +tar -zxf "${FRP_FILE}" +cd "frp_${FRP_VERSION}_linux_${FRP_ARCH}" + +echo "正在安装 frps 到 /usr/local/bin/..." +cp frps /usr/local/bin/ +chmod +x /usr/local/bin/frps + +echo "正在配置 frps..." +mkdir -p /etc/frp +cat > /etc/frp/frps.toml < /etc/systemd/system/frps.service <