doc.rustdesk.com/content/self-host/rustdesk-server-oss/install/_index.en.md

164 lines
7.3 KiB
Markdown
Raw Normal View History

2022-04-11 11:05:11 +02:00
---
2023-07-13 13:06:05 +02:00
title: Installation
2023-08-21 21:46:01 +02:00
weight: 1
2022-04-11 11:05:11 +02:00
---
2023-10-21 21:52:40 +02:00
### Install your own server as systemd service using a simple to run install script
2023-07-14 15:02:13 +02:00
Script is hosted on [Techahold](https://github.com/techahold/rustdeskinstall) and supported on our [Discord](https://discord.com/invite/nDceKgxnkV).
2022-08-10 23:27:15 +02:00
Currently the script will download and setup the Relay and Signal Servers (hbbr and hbbs), generate configs and host them on a password protected web page for simple deployment to clients.
2022-08-10 23:27:15 +02:00
2023-10-21 21:52:40 +02:00
#### Requirements
You need to have Linux installed, script is tested working with CentOS Linux 7/8, Ubuntu 18/20 and Debian. A server with 1 CPU, 1 GB RAM and 10 GB disk is plenty to run RustDesk.
2022-08-10 23:27:15 +02:00
2023-10-21 21:52:40 +02:00
##### How to Install the server
2022-08-10 23:27:15 +02:00
Please setup your firewall on your server prior to running the script.
2023-07-15 21:58:09 +02:00
Make sure you have got access via SSH or otherwise setup prior setting up the firewall. The example commands for UFW (Debian based) are:
2022-08-10 23:27:15 +02:00
```
ufw allow proto tcp from YOURIP to any port 22
```
2023-08-27 20:50:56 +02:00
If you have UFW installed use the following commands to configure the firewall (port 8000 only needed if you want to use the auto generated install files):
2022-08-10 23:27:15 +02:00
```
ufw allow 21115:21119/tcp
ufw allow 8000/tcp
ufw allow 21116/udp
sudo ufw enable
```
2023-08-27 20:50:56 +02:00
Run the following commands:
2022-08-10 23:27:15 +02:00
```
2023-06-09 17:44:41 +02:00
wget https://raw.githubusercontent.com/techahold/rustdeskinstall/master/install.sh
2022-08-10 23:27:15 +02:00
chmod +x install.sh
./install.sh
```
2023-07-14 15:02:13 +02:00
There is also an update script on [Techahold's](https://github.com/techahold/rustdeskinstall) repository.
2022-08-10 23:27:15 +02:00
2023-10-21 21:52:40 +02:00
### Install your own server as systemd service using deb file for debian distros
2023-07-15 04:39:33 +02:00
2023-07-15 04:41:36 +02:00
Please [Download](https://github.com/rustdesk/rustdesk-server/releases/latest) deb files yourself and install with `apt-get -f install <filename>.deb` or `dpkg -i <filename>.deb`.
2023-07-15 04:39:33 +02:00
2023-10-21 21:52:40 +02:00
### Set up your own server instance manually.
2022-04-11 11:05:11 +02:00
2023-10-21 21:52:40 +02:00
#### STEP 1: Download server-side software programs
2022-04-11 11:05:11 +02:00
2023-07-15 04:34:25 +02:00
[Download](https://github.com/rustdesk/rustdesk-server/releases/latest).
2022-04-19 07:32:08 +02:00
Platform versions provided:
2022-04-11 11:05:11 +02:00
- Linux
- Windows
The tutorial below is based on Linux build.
2022-04-11 11:05:11 +02:00
2022-04-12 20:13:52 +02:00
There are two executables and a folder:
2022-04-11 11:05:11 +02:00
- `hbbs` - RustDesk ID/Rendezvous server
2023-07-15 21:58:09 +02:00
- `hbbr` - RustDesk Relay server
They are built on CentOS Linux 7, tested on CentOS Linux 7/8 and Ubuntu 18/20.
2022-04-11 11:05:11 +02:00
2023-10-21 21:52:40 +02:00
##### Server Requirements
2022-04-11 15:56:34 +02:00
2023-07-15 21:58:09 +02:00
The hardware requirements are very low; the minimum configuration of a basic cloud server is enough, and the CPU and memory requirements are minimal. You can also use a Raspberry Pi or something similar. Regarding the network size, if the TCP hole punching direct connection fails, the relay traffic will be consumed. The traffic of a relay connection is between 30 K/s and 3 M/s (1920x1080 screen) depending on the resolution settings and screen update. If it is only for office work demand, the traffic is around 100 K/s.
2022-04-11 15:56:34 +02:00
2023-10-21 21:52:40 +02:00
#### STEP 2: Run hbbs and hbbr on your server
2022-04-11 11:05:11 +02:00
2023-07-15 21:58:09 +02:00
We suggest you use [PM2](https://pm2.keymetrics.io/) for managing your service.
2023-03-09 13:28:47 +01:00
2023-10-21 21:52:40 +02:00
##### Option 1
2023-08-27 20:50:56 +02:00
Run hbbs/hbbr without PM2.
2022-04-11 11:05:11 +02:00
```bash
2023-07-13 13:06:05 +02:00
./hbbs -r <relay-server-ip[:port]>
./hbbr
2022-04-11 15:56:34 +02:00
```
2022-04-19 07:32:08 +02:00
2023-10-21 21:52:40 +02:00
##### Option 2
2023-07-15 21:58:09 +02:00
Run hbbs/hbbr with PM2.
2022-04-19 07:32:08 +02:00
```bash
2023-07-13 13:06:05 +02:00
pm2 start hbbs -- -r <relay-server-ip[:port]>
pm2 start hbbr
2022-04-22 11:47:47 +02:00
```
<a name="demo"></a>
2022-04-11 15:56:34 +02:00
{{% notice note %}}
2023-07-15 21:58:09 +02:00
PM2 requires Node.js v16+, if you fail to run PM2 (e.g. you can not see `hbbs`/`hbbr` in `pm2 list`), please download and install the Node.js LTS version from https://nodejs.org. If you want to make `hbbs`/`hbbr` auto-run after reboot, please check out `pm2 save` and `pm2 startup`. More about [PM2](https://pm2.keymetrics.io/docs/usage/quick-start/). Another good tool for your logs is [pm2-logrotate](https://github.com/keymetrics/pm2-logrotate).
2022-04-22 11:47:47 +02:00
The `-r` parameter of `hbbs` is not mandatory, it is just convenient for you not to specify a relay server on the controlled client side. You do not need to specify port if you are using default 21117 port. The relay server specified by the client has a higher priority than this.
2022-04-11 15:56:34 +02:00
{{% /notice %}}
2023-09-05 00:05:43 +02:00
By default, `hbbs` listens on 21115 (TCP), 21116 (TCP/UDP) and 21118 (TCP), `hbbr` listens on 21117 (TCP) and 21119 (TCP). Be sure to open these ports in the firewall. **Please note that 21116 should be enabled both for TCP and UDP.** 21115 is used for the NAT type test, 21116/UDP is used for the ID registration and heartbeat service, 21116/TCP is used for TCP hole punching and connection service, 21117 is used for the Relay services, and 21118 and 21119 are used to support web clients. *If you do not need web client (21118, 21119) support, the corresponding ports can be disabled.*
2022-04-11 11:05:11 +02:00
- TCP (**21115, 21116, 21117, 21118, 21119**)
- UDP (**21116**)
2022-04-11 11:05:11 +02:00
Please run with the `-h` option to see help if you want to choose your own port.
2022-04-11 11:05:11 +02:00
2023-10-21 21:52:40 +02:00
#### STEP 3: Set hbbs/hbbr address on client-side
2022-04-11 11:05:11 +02:00
Click on the Menu button [ &#8942; ] on the right side of ID as shown below, and choose "ID/Relay Server".
2022-04-11 11:05:11 +02:00
2023-08-25 15:36:48 +02:00
![](/docs/en/self-host/rustdesk-server-oss/install/images/server-set-menu.png)
2022-04-11 11:05:11 +02:00
Enter the `hbbs` host or IP Address in the **ID Server** input box (local side + remote side). The other two addresses can be left blank, RustDesk will automatically deduce (if not specially set), and the Relay Server refers to `hbbr` (port 21117).
2022-04-11 11:05:11 +02:00
e.g.
```nolang
2022-05-29 19:59:40 +02:00
hbbs.example.com
2022-04-11 11:05:11 +02:00
```
or
```nolang
2022-05-29 19:59:40 +02:00
hbbs.example.com:21116
2022-04-11 11:05:11 +02:00
```
2023-08-25 15:36:48 +02:00
![](/docs/en/self-host/rustdesk-server-oss/install/images/server-set-window.png)
2023-08-23 05:45:37 +02:00
2023-10-21 21:52:40 +02:00
##### Put config in rustdesk.exe file name (Windows only)
2023-08-23 05:45:37 +02:00
Change `rustdesk.exe` to rustdesk-`host=<host-ip-or-name>,key=<public-key-string>`.exe, e.g. rustdesk-`host=192.168.1.137,key=xfdsfsd32=32`.exe. You can see the config result in the About Window below.
<a name="invalidchar"></a>
{{% notice note %}}
You need to set both `host` and `key`, missing either one will not work.
Optionally add a `,` (comma) character after the key, before the `.exe` part as a delimiter, to avoid the key being mangled if Windows or the browser renames the file when downloading duplicated names.
If there are invalid characters in the key which can not be used in a Windows file name, please remove the
`id_ed25519` file from your server and restart `hbbs`/`hbbr`. This will cause the `id_ed25519.pub` file to regenerate. You may need to
repeat this process until you get valid characters.
{{% /notice %}}
2022-04-11 13:23:47 +02:00
2023-10-21 21:52:40 +02:00
### Key
2022-04-21 14:42:16 +02:00
Different from the old version, the key in this version is mandatory, but you don't need to set it yourself. When `hbbs` runs for the first time, it will automatically generate a pair of encrypted private and public keys (respectively located in the `id_ed25519` and `id_ed25519.pub` files in the running directory), whose main purpose is for communication encryption.
2022-04-11 13:23:47 +02:00
If you did not fill in the `Key:` (the content in the public key file `id_ed25519.pub`) in the previous step, it does not affect the connection, but the connection cannot be encrypted.
```bash
2022-04-11 13:23:47 +02:00
cat ./id_ed25519.pub
2023-07-13 13:06:05 +02:00
```
2022-04-11 13:23:47 +02:00
If you want to prohibit users without the key from establishing non-encrypted connections, please add the `-k _` parameter when running `hbbs` and `hbbr`, for example:
```bash
2022-05-10 05:08:09 +02:00
./hbbs -r <relay-server-ip[:port]> -k _
2022-04-11 13:23:47 +02:00
./hbbr -k _
```
2022-04-11 13:23:47 +02:00
2023-07-15 21:58:09 +02:00
If you want to change the key, remove the `id_ed25519` and `id_ed25519.pub` files and restart `hbbs`/`hbbr`, `hbbs` will generate a new key pair.
{{% notice note %}}
2023-07-14 15:02:13 +02:00
If you are using docker-compose and keys don't exist, the start of containers will create different keys in hbbs and hbbr folders.
2022-08-28 19:17:32 +02:00
2022-09-15 22:09:15 +02:00
You could create keys manually in hbbs and copy them to hbbr before starting the containers.
2022-08-28 19:17:32 +02:00
2022-09-15 22:09:15 +02:00
Or you could stop the hbbr container and copy the keys from hbbs to the hbbr folder, and then restart the container.
{{% /notice %}}
2023-10-21 21:52:40 +02:00