Files
dock/ru2进制下载安装
2026-01-22 16:22:53 +08:00

96 lines
2.8 KiB
Plaintext
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.
bash <(curl -sSL https://raw.githubusercontent.com/tech-shrimp/rustdesk-native-install/main/install.sh 2>/dev/null || echo "
#!/bin/bash
# 颜色定义
GREEN='\033[32m'
RED='\033[31m'
YELLOW='\033[33m'
PLAIN='\033[0m'
# 安装目录
INSTALL_DIR='/opt/rustdesk'
WORK_DIR='/vol1/1000/dock/rustdesk_native' # 既然没有Docker我们用这个目录存数据以符合你的习惯
echo -e \"\${GREEN}>>> 开始安装 RustDesk Server (原生版) <<<\${PLAIN}\"
# 1. 准备环境
if [[ \$EUID -ne 0 ]]; then
echo -e \"\${RED}请使用 root 运行!\${PLAIN}\"
exit 1
fi
apt-get update && apt-get install -y wget unzip tar
# 2. 获取 IP
read -p \"请输入服务器公网 IP (必填): \" HOST_IP
if [[ -z \"\$HOST_IP\" ]]; then echo -e \"\${RED}IP 不能为空\${PLAIN}\"; exit 1; fi
# 3. 下载程序 (使用 GitHub 最新稳定版)
mkdir -p \$INSTALL_DIR
mkdir -p \$WORK_DIR
cd \$INSTALL_DIR
echo -e \"\${YELLOW}正在下载 RustDesk 服务端程序...\${PLAIN}\"
# 这里使用固定的稳定版链接,防止获取失败
wget -O rustdesk-server.zip https://github.com/rustdesk/rustdesk-server/releases/download/1.1.11-1/rustdesk-server-linux-amd64.zip
unzip -o rustdesk-server.zip
chmod +x hbbs hbbr
# 4. 创建系统服务 (hbbs - ID服务器)
cat > /etc/systemd/system/rustdesk-hbbs.service <<EOF
[Unit]
Description=RustDesk ID Server
After=network.target
[Service]
Type=simple
LimitNOFILE=1000000
ExecStart=\$INSTALL_DIR/hbbs -r \$HOST_IP -k _
WorkingDirectory=\$WORK_DIR
User=root
Group=root
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
# 5. 创建系统服务 (hbbr - 中继服务器)
cat > /etc/systemd/system/rustdesk-hbbr.service <<EOF
[Unit]
Description=RustDesk Relay Server
After=network.target
[Service]
Type=simple
LimitNOFILE=1000000
ExecStart=\$INSTALL_DIR/hbbr -k _
WorkingDirectory=\$WORK_DIR
User=root
Group=root
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
# 6. 启动服务
systemctl daemon-reload
systemctl enable rustdesk-hbbs rustdesk-hbbr
systemctl restart rustdesk-hbbs rustdesk-hbbr
# 7. 检查与输出
sleep 3
if systemctl is-active --quiet rustdesk-hbbs; then
PUB_KEY=\$(cat \$WORK_DIR/id_ed25519.pub)
echo -e \"\${GREEN}=============================================\${PLAIN}\"
echo -e \" 原生版 RustDesk 部署成功!\"
echo -e \"\${GREEN}=============================================\${PLAIN}\"
echo -e \"ID 服务器: \${GREEN}\${HOST_IP}\${PLAIN}\"
echo -e \"中继服务器: \${GREEN}\${HOST_IP}\${PLAIN}\"
echo -e \"Key (公钥): \${YELLOW}\${PUB_KEY}\${PLAIN}\"
echo -e \"\${GREEN}=============================================\${PLAIN}\"
echo -e \"数据存储目录: \${WORK_DIR}\"
else
echo -e \"\${RED}启动失败,请检查 systemctl status rustdesk-hbbs\${PLAIN}\"
fi
")