You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.6 KiB

#!/bin/bash
# /root/.openclaw/workspace/scripts/02-install-tailscale.sh
set -e
echo "🔧 安装 Tailscale..."
# 检查是否已安装
if command -v tailscale &> /dev/null; then
echo "⚠ Tailscale 已安装"
tailscale status
read -p "是否重新配置?(y/N): " confirm
if [[ ! $confirm =~ ^[Yy]$ ]]; then
exit 0
fi
tailscale down
fi
# 安装
echo "📦 下载安装脚本..."
curl -fsSL https://tailscale.com/install.sh | sh
# 验证安装
if ! command -v tailscale &> /dev/null; then
echo "❌ Tailscale 安装失败"
exit 1
fi
echo "✅ Tailscale 安装成功"
tailscale version
# 配置 Tailscale
echo ""
echo "🔐 配置 Tailscale..."
echo "节点名称:mem0-general-center"
echo "业务类型:general"
echo "节点角色:center"
# 使用 Auth Key 认证
TS_AUTHKEY="tskey-auth-kBPLmrWqQF11CNTRL-TwpkbDQcDA5vTavwXMWw95tsv2KE48ou"
TS_HOSTNAME="mem0-general-center"
echo "🔗 连接到 Tailscale 网络..."
tailscale up --authkey="$TS_AUTHKEY" --hostname="$TS_HOSTNAME" --accept-routes --advertise-exit-node
# 等待连接
echo "⏳ 等待连接..."
sleep 5
# 显示状态
echo ""
echo "📊 Tailscale 状态:"
tailscale status
echo ""
echo "📊 网络信息:"
tailscale ip -4
tailscale ip -6
echo ""
echo "✅ Tailscale 配置完成"
echo ""
echo "📝 重要信息:"
echo " 节点名称:mem0-general-center"
echo " 业务类型:general"
echo " 节点角色:center"
echo " 管理后台:https://login.tailscale.com/admin/machines"
echo ""
echo "⚠ 请在 Tailscale 管理后台确认节点已上线,并记录分配的 IP 地址"