一、通过编译好的文件安装

  1、下载服务端程序

wget -P /usr/local/src https://github.com/rustdesk/rustdesk-server/releases/download/1.1.9/rustdesk-server-linux-amd64.zip

  2、解压文件并创建用户

# 解压
tar xf /usr/local/src/rustdesk-server-linux-amd64.zip -C /data
mv mv amd64 rustdesk

# 创建用户
useradd -d /data/rustdesk -M rustdesk
chown -R rustdesk. /data/rustdesk

  3、创建服务启动脚本

# hbbs启动脚本
# vim /etc/systemd/system/hbbs.service 
[Unit]
Description=RustDesk Hbbs
After=network.target

[Service]
Type=simple
User=rustdesk
WorkingDirectory=/data/rustdesk
ExecStart=/data/rustdesk/hbbs -k _
ExecStop=/bin/kill -TERM $MAINPID
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

# hbbr启动脚本
# vim /etc/systemd/system/hbbr.service 
[Unit]
Description=RustDesk Hbbr
After=network.target

[Service]
Type=simple
User=rustdesk
WorkingDirectory=/data/rustdesk
ExecStart=/data/rustdesk/hbbr -k _
ExecStop=/bin/kill -TERM $MAINPID
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

# 启动服务
systemctl enable --now hbbs hbbr

  4、放行端口

# 放行端口
firewall-cmd --zone=public --add-port=21115/tcp --permanent
firewall-cmd --zone=public --add-port=21116/tcp --permanent
firewall-cmd --zone=public --add-port=21117/tcp --permanent
firewall-cmd --zone=public --add-port=21118/tcp --permanent
firewall-cmd --zone=public --add-port=21119/tcp --permanent
firewall-cmd --zone=public --add-port=21116/udp --permanent
firewall-cmd --reload

# 查看已放行端口
firewall-cmd --list-ports

二、基于Docker安装

  1、Docker、Docker-Compose安装

https://www.cnblogs.com/a120608yby/p/9883175.html
https://www.cnblogs.com/a120608yby/p/14582853.html

  2、配置Docker-Compose启动文件

# vim docker-compose.yml
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 rustdesk.example.com:21117
    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
    volumes:
      - ./data:/root
    networks:
      - rustdesk-net
    restart: unless-stopped

  3、启动服务

docker compose up -d

  4、查看服务启动状态

docker compose ps

三、客户端配置(ID 服务器/中继服务器/Key)

参考:

https://github.com/rustdesk/rustdesk-server
https://github.com/rustdesk/rustdesk/releases

  

posted on 2023-12-13 13:29  a120608yby  阅读(454)  评论(0编辑  收藏  举报