A service of Daily Data, Inc.
Contact Form

User Tools

Site Tools


software:rust:server_devuan

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
software:rust:server_devuan [2025/09/18 09:34] rodolicosoftware:rust:server_devuan [2025/09/29 16:51] (current) rodolico
Line 1: Line 1:
 ====== RustDesk Server on Devuan ====== ====== RustDesk Server on Devuan ======
  
-<WRAP center round alert 60%> +<WRAP center round important 60%> 
-Warning. I am still editing this on 18 Sep 2025. Do not use these instructions until I have finished editingthen tested the procedureThis notice will be removed at that time.+The RustDesk Server must be accessible from any connecting clients on ports 21114-21119TCP and UDPIf any workstation will be accessing from outside your network, you will need to forward those ports on your router to your server. Not all are required for all installations. See section //Open Ports// for more information.
 </WRAP> </WRAP>
- 
  
 We use [[https://www.devuan.org/|Devuan]] as an alternative to Debian as Devuan allows us to choose the init system instead of forcing the use of SystemD. With its many faults, we still choose SysVInit for our init system, and Devuan allows that. We use [[https://www.devuan.org/|Devuan]] as an alternative to Debian as Devuan allows us to choose the init system instead of forcing the use of SystemD. With its many faults, we still choose SysVInit for our init system, and Devuan allows that.
Line 11: Line 10:
  
 This article describes how to set up the Rust Server on Devuan, and may be helpful for other systems also. This article describes how to set up the Rust Server on Devuan, and may be helpful for other systems also.
 +
 +
 +===== Open Ports =====
 +
 +On your firewall/NAT/whatever, you need ports <code>21114,21115,21116,21117,21118,21119</code> open and forwarded to the Rust Server. Additionally, to use the webui, you will need to open a port for that.
 +
 +Following table shows what the ports are used for.
 +
 +^Port   ^Purpose                ^Protocol^Notes^
 +| 21114 | HBBS (RustDesk server) | TCP     | Default port for API (not required)         |
 +| 21115 | HBBS (RustDesk server) | TCP/UDP | Default port for the RustDesk server.       |
 +| 21116 | HBBS (RustDesk server) | TCP/UDP | Used for client connections to the server.  |
 +| 21117 | HBBS (RustDesk server) | TCP/UDP | Additional port for server communication.   |
 +| 21118 | HBBS (RustDesk server) | TCP/UDP | Another port for server communication.      |
 +| 21119 | HBBS (RustDesk server) | TCP/UDP | Used for additional server functionalities. |
 +| 80 | HTTP (optional fallback) | TCP | Commonly allowed port for web traffic; can be used for fallback. |
 +| 443 | HTTPS (optional fallback) | TCP | Secure web traffic; can be used for fallback   |
  
 ===== Set up user ===== ===== Set up user =====
Line 28: Line 44:
 ===== Download Server ===== ===== Download Server =====
  
-Open a web browser to https://github.com/rustdesk/rustdesk-server/releases, locate the entry for //rustdesk-server-linux-amd64.zip//. Right click on it and select "Copy Link".+This will download the latest version of RustDesk Server from their github siteSecond two lines stolen directly from techahold's scriptHe's a much better sh programmer than me.
  
 <code bash> <code bash>
 cd /tmp cd /tmp
-wget ###Paste the URL from above here###+LATEST=$(curl https://api.github.com/repos/rustdesk/rustdesk-server/releases/latest -s | grep "tag_name" | awk -F'"' '{print $4}'
 +wget "https://github.com/rustdesk/rustdesk-server/releases/download/${LATEST}/rustdesk-server-linux-amd64.zip"
 unzip rustdesk-server-linux-amd64.zip unzip rustdesk-server-linux-amd64.zip
 mv /tmp/amd64/* /opt/rustdesk mv /tmp/amd64/* /opt/rustdesk
 chown rust:rust /opt/rustdesk/* chown rust:rust /opt/rustdesk/*
 +chmod 755 /opt/rustdesk/*
 </code> </code>
  
-This will create three binary files in /opt/rustdesk+This will get three binary files in /opt/rustdesk
   * hbbr - The relay server. If a direct P2P connection can not be made, this will be used to relay traffic between clients.   * hbbr - The relay server. If a direct P2P connection can not be made, this will be used to relay traffic between clients.
   * hbbs - this is the "signal" server. Your clients will ping this to notify they exist, and will use it to set up a connection between clients.   * hbbs - this is the "signal" server. Your clients will ping this to notify they exist, and will use it to set up a connection between clients.
Line 50: Line 68:
  
 **Note**: The check is made in the current working directory, so you **must** run hbbs from within it's home directory (/opt/rustdesk) **Note**: The check is made in the current working directory, so you **must** run hbbs from within it's home directory (/opt/rustdesk)
- 
-A way that gives you more control is to run the rustdesk-utils, generate the key, then run hbbs. 
  
 <code bash> <code bash>
 cd /opt/rustdesk cd /opt/rustdesk
-sudo -u rust ./rustdesk-utils genkeypair +echo Starting signaling server for testingPress ^c to exit when you are happy
-# verify they exist +
-ls -ablph id_ed25519* +
-# make them owned by the rust user +
-chown rust:rust id_ed25519*+
 sudo -u rust ./hbbs sudo -u rust ./hbbs
-# watch for errors, press ^c to leave. 
  
 echo Your key for the clients is echo Your key for the clients is
 cat id_ed25519.pub cat id_ed25519.pub
 echo To find this again at a later date, just run the command cat id_ed25519.pub echo To find this again at a later date, just run the command cat id_ed25519.pub
-</bash> 
  
 +</code>
 ===== Set automatic run ===== ===== Set automatic run =====
  
Line 73: Line 84:
  
 Copy the following two files to /etc/init.d (Devuan), or wherever your init scripts are stored. By the way, I built these starting with the template at [[https://github.com/fhd/init-script-template|fhd's Github]]. Copy the following two files to /etc/init.d (Devuan), or wherever your init scripts are stored. By the way, I built these starting with the template at [[https://github.com/fhd/init-script-template|fhd's Github]].
 +
 +Create the file /etc/init.d/hbbs with the following content to control the signaling server via SysV Init
  
 <code bash hbbs> <code bash hbbs>
Line 86: Line 99:
 ### END INIT INFO ### END INIT INFO
  
-dir="/opt/rust+dir="/opt/rustdesk
-cmd="hbbs"+cmd="/opt/rustdesk/hbbs"
 user="rust" user="rust"
  
 name=`basename $0` name=`basename $0`
 pid_file="/var/run/$name.pid" pid_file="/var/run/$name.pid"
-stdout_log="/var/log/$name.log" +stdout_log="/var/log/rustdesk/$name.log" 
-stderr_log="/var/log/$name.err"+stderr_log="/var/log/rustdesk/$name.err"
  
 get_pid() { get_pid() {
Line 174: Line 187:
  
 exit 0 exit 0
 +
 </code> </code>
 +
 +Create the file /etc/init.d/hbbr with the following content to control the relay server via SysV Init
 +
  
 <code bash hbbr> <code bash hbbr>
 #!/bin/sh #!/bin/sh
 ### BEGIN INIT INFO ### BEGIN INIT INFO
-# Provides:          hbbs+# Provides:          hbbr
 # Required-Start:    $remote_fs $syslog # Required-Start:    $remote_fs $syslog
 # Required-Stop:     $remote_fs $syslog # Required-Stop:     $remote_fs $syslog
Line 188: Line 205:
 ### END INIT INFO ### END INIT INFO
  
-dir="/opt/rust+dir="/opt/rustdesk
-cmd="hbbr"+cmd="/opt/rustdesk/hbbr"
 user="rust" user="rust"
  
 name=`basename $0` name=`basename $0`
 pid_file="/var/run/$name.pid" pid_file="/var/run/$name.pid"
-stdout_log="/var/log/$name.log" +stdout_log="/var/log/rustdesk/$name.log" 
-stderr_log="/var/log/$name.err"+stderr_log="/var/log/rustdesk/$name.err"
  
 get_pid() { get_pid() {
Line 276: Line 293:
  
 exit 0 exit 0
 +
 </code> </code>
  
Line 294: Line 312:
 If you made it through the last step with no errors, you should now be able to access the server from one of the clients. If you made it through the last step with no errors, you should now be able to access the server from one of the clients.
  
 +===== Set automatic log rotate =====
 +
 +Your logs can get quite large, so it is best to rotate them occassional. Devuan uses the logrotate script to do this for, and it is fairly simple to add a new definition in /etc/logrotate.d for the next pass.
 +
 +Following command will create the definition. It will rotate the hbbr/hbbs logs daily, keeping two weeks of logs. All logs except for the current one and the previous one will be compressed.
 +
 +This is just one command. Just copy and paste it anywhere into the server.
 +
 +<code bash rotatelogs>
 +cat << EOF > /etc/logrotate.d/rustdesk
 +/var/log/rustdesk/*.log /var/log/rustdesk/*.err {
 +   daily
 +   rotate 14
 +   compress
 +   delaycompress
 +   create 640 rust rust
 +   postrotate
 +      service hbbr restart > /dev/null
 +      service hbbs restart > /dev/null
 +   endscript
 +   sharedscripts
 +   missingok
 +   notifempty
 +}
 +EOF
 +</code>
 +
 +
 +===== Links =====
 +
 +  * [[https://github.com/fhd/init-script-template|Template for creating SysV init scripts]]
 +  * [[https://github.com/techahold/rustdeskinstall/blob/master/install.sh|Excellent install script for open source RustDesk Server on Linux which uses SystemD]]
 +  * [[https://rustdesk.com/docs/en/self-host/rustdesk-server-oss/install/|Documentation from RustDesk for installing the Open Source server]]
 +  * [[https://raw.githubusercontent.com/dinger1986/rustdeskinstall/master/|Installer Scripts for RustDesk Client]]
 +  * [[https://rustdesk.com/docs/en/self-host/client-deployment/|Several customized installer scripts for RustDesk Client]]
software/rust/server_devuan.1758206040.txt.gz · Last modified: 2025/09/18 09:34 by rodolico