一款远程桌面访问的自建方案-rustdesk

前言

一直有听说这款开源软件,之前有替代品所以就懒得搭建,现在todesk开始限制连接数了,那就来折腾下吧。从最早的TeamViewer到后来的向日葵,再到现在todesk,果然都逃不了商业化当然不是说商业化不好

本文使用docker-compose部署,环境的部署请自行百度,不过现在云服务器应该都自带了,下面以腾讯云为例。

服务端

切换镜像源

前几天docker被墙,所以我们这里切换腾讯云内部使用的镜像。

vi /etc/docker/daemon.json

把下面这个json复制进去,有其他可用的也行。

{
  "registry-mirrors": [
    "https://mirror.ccs.tencentyun.com"
  ],
  "insecure-registries": [],
  "debug": false,
  "experimental": false,
  "features": {
    "buildkit": true
  }
}

重启服务

systemctl daemon-reload
systemctl restart docker

配置文件

version: '3'
 
networks:
  rustdesk-net:
    external: false
 
services:
  hbbs:
    container_name: hbbs
    ports:
      - 21115:21115
      - 21116:21116
      - 21116:21116/udp
      - 21118:21118
    image: rustdesk/rustdesk-server:latest
    command: hbbs -r ip/domain:21117 -k _
    volumes:
      - ./data:/root
    networks:
      - rustdesk-net
    depends_on:
      - hbbr
    restart: unless-stopped
 
  hbbr:
    container_name: hbbr
    ports:
      - 21117:21117
      - 21119:21119
    image: rustdesk/rustdesk-server:latest
    command: hbbr -k _
    volumes:
      - ./data:/root
    networks:
      - rustdesk-net
    restart: unless-stopped

这里注意下"command"项的"ip/domain"改为你服务器的ip或者域名,"-k _"表示链接的时候需要key。

docker-compose up -d

等待安装完之后cd到/data文件夹下,会发现一个pub的文件,打开就是你的密钥,记住这个密钥,后面客户端需要使用。

vi ./data/id.xxxx.pub 

端口

Ports required for RustDesk Server self-hosting depends largely on your environment and what you want to do with RustDesk. The Examples shown throughout the docs will generally have all ports suggested to be opened.

Core Ports:
TCP
UDP 21114-21119`21116`

The above are the minimum required ports for RustDesk to work, these handle the signal and relay ports as well as NAT traversal.21115-21117

Additionally TCP ports and can be opened if you want to use the 21118`21119`RustDesk Web Client.

For Pro users without an SSL Proxy you will need to open TCP port for the API to work alternatively using an SSL Proxy open TCP port .21114`443`

这里如果你只是简单的远程,就放行21116的TCP/UDP和21117的TCP就行。

客户端

获取

点击(这里)来获取你要的客户端

使用

  • 第一次下载客户端在左下角会提醒你未安装权限问题,点击安装就行
  • 点击右上角的三横杠进入设置页面,然后点击网络选项卡,解锁网络设置
  • ID/中继服务器就填你的服务器IP或者域名,key就是刚才.pub文件,应用之后就可以开始使用了
  • 使用方式和其他远程软件大同小异,连接过之后可以把对方添加到收藏(因为账户功能是pro的,我们用不了)

参考

Self-host :: Documentation for RustDesk