Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 131 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,113 +1,180 @@
# RustDesk-Server 一键安装脚本
# RustDesk Server Tool

## 示例
```sh
# RustDesk-Server x86 一键安装脚本
# Rep <https://github.com/sshpc/rustdesktool>
# You Server:ubuntu
服务状态: [运行中]
一个交互式的 RustDesk Server 安装脚本,现在同时支持:

>~~~~~~~~~~~~~~ rustdesk-server tool ~~~~~~~~~~~~< v: 1.3
- Linux:使用官方发布的 Linux 预编译包安装 `hbbs` / `hbbr`
- macOS:由于官方发布页没有提供 macOS Server 二进制,本脚本会拉取官方源码并在本机编译,然后用 `launchd` 托管服务

1: 安装 2: 卸载
仓库地址:
[https://github.com/signyf/rustdesktool](https://github.com/signyf/rustdesktool)

3: 查看状态 4: 查看key
## 支持情况

5: 启动服务 6: 停止服务
### Linux

7: 升级脚本
- 发行版:Ubuntu、Debian、CentOS、Rocky、AlmaLinux、Alpine
- 架构:`amd64`、`arm64`
- 服务管理:`systemd`

q: 退出
### macOS

请输入命令号:
- 架构:Intel(`amd64`) / Apple Silicon(`arm64`)
- 服务管理:`launchd`
- 安装方式:从官方 `rustdesk/rustdesk-server` 源码编译

## macOS 说明

截至官方 `rustdesk-server` `1.1.15` 版本,发布页提供的是 Linux 资产,没有 macOS Server 预编译包。

因此这个脚本在 macOS 上会:

1. 下载 `rustdesk/rustdesk-server` 对应版本源码
2. 本机执行 `cargo build --release`
3. 安装生成的 `hbbs` / `hbbr`
4. 写入 `launchd` plist 到 `/Library/LaunchDaemons`

### macOS 前置依赖

先安装这些依赖:

```bash
xcode-select --install
brew install rust git
```

## 安装&卸载
说明:

- 建议用普通用户运行脚本,脚本在需要写系统目录时会自动调用 `sudo`
- 首次编译 RustDesk Server 可能需要几分钟

### 一键安装
> root 用户
## 使用方法

```sh
wget -N https://raw.githubusercontent.com/sshpc/rustdesktool/main/rustdesktool.sh && chmod +x ./rustdesktool.sh && ./rustdesktool.sh
### 1. 克隆仓库

```bash
git clone https://github.com/signyf/rustdesktool.git
cd rustdesktool
git checkout codex/macos-support
chmod +x rustdesktool.sh
```

> 再次执行
### 2. 启动脚本

```sh
```bash
./rustdesktool.sh
```

如果你希望直接以 root 方式运行 Linux 安装,也可以:

```bash
sudo ./rustdesktool.sh
```

## 一键使用链接

当前可直接使用的分支是 `codex/macos-support`,可以直接运行:

### 标准链接

```bash
curl -fsSL https://raw.githubusercontent.com/signyf/rustdesktool/codex/macos-support/rustdesktool.sh -o rustdesktool.sh && chmod +x ./rustdesktool.sh && ./rustdesktool.sh
```

### 国内加速链接

```sh
wget -N https://gh.ddlc.top/https://raw.githubusercontent.com/sshpc/rustdesktool/main/rustdesktool.sh && chmod +x ./rustdesktool.sh && ./rustdesktool.sh
```bash
curl -fsSL https://gh.ddlc.top/https://raw.githubusercontent.com/signyf/rustdesktool/codex/macos-support/rustdesktool.sh -o rustdesktool.sh && chmod +x ./rustdesktool.sh && ./rustdesktool.sh
```
```sh
wget -N https://gh-proxy.com/https://raw.githubusercontent.com/sshpc/rustdesktool/main/rustdesktool.sh && chmod +x ./rustdesktool.sh && ./rustdesktool.sh

```bash
curl -fsSL https://gh-proxy.com/https://raw.githubusercontent.com/signyf/rustdesktool/codex/macos-support/rustdesktool.sh -o rustdesktool.sh && chmod +x ./rustdesktool.sh && ./rustdesktool.sh
```

## 客户端下载
官方地址
https://rustdesk.com/download
说明:

支持 (Windows、Ubuntu、Mac、Android..)
- 这里用 `curl` 而不是 `wget`,因为 macOS 默认自带 `curl`
- 当前命令使用的是 `codex/macos-support` 分支
- 如果你后面把这些修改合并进 `main`,只需要把链接里的 `codex/macos-support` 改成 `main`

## 客户端配置
## 菜单功能

>默认安装后使用的是官方的服务器,需要换成自己的
- `安装`
- `卸载`
- `查看状态`
- `查看公钥`
- `启动服务`
- `停止服务`
- `更新脚本`

设置 → 网络
* ID服务器地址:<你的服务器IP>
* 中继服务器地址:<你的服务器IP>
* API服务器地址:留空
* 秘钥:你的服务器公钥(安装后获得)
说明:

- 这个分支里 `更新脚本` 已禁用,避免把本地的 macOS 适配改回上游原版脚本

## 其他信息
## 安装目录

### 默认安装目录
/usr/local/rustdesk-sever
默认安装目录:

### 服务安装目录
```text
/usr/local/rustdesk-server
```

/usr/lib/systemd/system/RustDeskHbbr.service
/usr/lib/systemd/system/RustDeskHbbs.service
公钥位置:

```text
/usr/local/rustdesk-server/id_ed25519.pub
```

### 秘钥位置
默认安装目录下的 id_ed25519.pub
日志目录:

>自定义秘钥:安装后手动替换安装目录下的 id_ed25519.pub 和 id_ed25519
```text
/usr/local/rustdesk-server/logs
```

### 端口
## 服务文件位置

>若连接失败,请检查防火墙端口是否打开
### Linux

hbbs 监听21115(tcp), 21116(tcp/udp), 21118(tcp)
```text
/usr/lib/systemd/system/RustDeskHbbs.service
/usr/lib/systemd/system/RustDeskHbbr.service
```

hbbr 监听21117(tcp), 21119(tcp)
### macOS

* 21115 -> hbbs用作NAT类型测试
* 21116/UDP -> hbbs用作ID注册与心跳服务
* 21116/TCP -> hbbs用作TCP打洞与连接服务
* 21117 -> hbbr中继服务
* 21118、21119 -> 网页客户端
```text
/Library/LaunchDaemons/com.rustdesk.hbbs.plist
/Library/LaunchDaemons/com.rustdesk.hbbr.plist
```

## 客户端配置

### 官方 rep:
RustDesk 客户端中设置:

https://github.com/rustdesk/rustdesk-server
- ID Server:你的服务器 IP 或域名
- Relay Server:你的服务器 IP 或域名
- API Server:留空
- Key:服务端生成的公钥

## Star History
## 端口

<a href="https://www.star-history.com/?repos=sshpc%2Frustdesktool&type=date&legend=top-left">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/image?repos=sshpc/rustdesktool&type=date&theme=dark&legend=top-left" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/image?repos=sshpc/rustdesktool&type=date&legend=top-left" />
<img alt="Star History Chart" src="https://api.star-history.com/image?repos=sshpc/rustdesktool&type=date&legend=top-left" />
</picture>
</a>
请确保这些端口已放行:

- `21115/tcp`
- `21116/tcp`
- `21116/udp`
- `21117/tcp`
- `21118/tcp`
- `21119/tcp`

作用说明:

- `21115`:NAT 测试
- `21116/tcp`:TCP 打洞与连接
- `21116/udp`:ID 注册与心跳
- `21117`:Relay 服务
- `21118` / `21119`:Web 相关端口

## 官方项目

- RustDesk Server: [https://github.com/rustdesk/rustdesk-server](https://github.com/rustdesk/rustdesk-server)
- RustDesk Client: [https://rustdesk.com/download](https://rustdesk.com/download)
Loading