0% found this document useful (0 votes)
1 views13 pages

How to install the rustdesk self hosted server

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 13

HOW TO INSTALL THE RUSTDESK SELF HOSTED SERVER

THIS GUIDE FOR UBUNTU SERVER ..

first make sure you have ubuntu server setup and installed

during ubuntu install make sure you install openssh

MINI REQUIRMENTS :

20-60 GB STORAGE / 1-2 GB RAM

FOLLOW BELOW INSTRUCTIONS:

FIRST OF ALL UPDATE THE SERVER:

sudo apt-get update && sudo apt-get upgrade

incase you also want to upgrade the distribution then you can use the command below

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade

now allow ports to server

Please setup your firewall on your server prior to running the script.

Make sure you have got access via ssh or otherwise setup prior setting up the firewall, command
for UFW is:

ufw allow 22/tcp


This port is needed to be able to connect to server using ssh

Setup firewall setting using UFW use the following commands:

ufw allow 21114:21119/tcp


These ports needed for application to connect
ufw allow 8000/tcp (don’t allow 8000 if you will not install gohttp below )
In my case I will not allow it
This port needed only if you install gohttp
Please note it is recommended to use ngnix instead to be able to use https more secure while
access web interface to download scripts / client
https:// ip or domain:8000
ufw allow 21116/udp
This port is needed for API
sudo ufw enable

Lets Begin with installation:


Run the following commands:

These are 3 commands run each one separatly copy one by one don’t copy all

wget https://raw.githubusercontent.com/dinger1986/rustdeskinstall/master/install.sh
chmod +x install.sh
./install.sh
Follow the on screen instructions you will be asked to choose ip / domain
Choose according to your needs
1)IP
2) DNS/ Domain

If you choose 1 then enter the ip address that will be used for rust server
If you choose 2 then enter domain or dns if you use domain
Make sure you create a dns (A) record for your server ip in your domain host (dns
only) not proxied record .

You will then be prompted to install http server or not .


1 Yes
2 No
Please choose if you want to download configs and install HTTP server:
In my case I don’t need gohttp not recommended and secure
Also I will setup my own ngnix to host my scripts and client downloads

Choose 1 for http server (gohttp) will be installed ( I don’t recommend it)

Can be changed later to ngnix no problem.

Choose 2 then continue ..


After that installation continues and you will see this :

Your IP/DNS Address is xxxxx.xxxxxx


Your public key is es9KPqK7fAEA+I3NkcEB5k1SuzwUv11xMgKTNxknUdU=
Install Rustdesk on your machines and change your public key and IP/DNS name to the
above
You can access your install scripts for clients by going to http:// xxxxx.xxxxxx.com: 8000
Username is admin and password is PkJlRi50tIgPctAU
Press any key to finish install waiting for the keypress

Copy this into a text file these information is critical and needed
You must copy it because it can’t be retrieved later and it is needed for client
configuration and web access .

public key is the key needed for client config.

xxxxx.xxxxxx.com is your domain if you choose dns/domain option or xxx.xxx.xxx.xxx ip


address if you choose IP address but this is your WAN ip we don’t need it if we run
rustserver locally just use the ip of ubuntu server instead ..

username of web portal and your password to log in if you used gohttp .

Now Rust server is installed and ready for testing.

If you want to restart the services use the following commands:

sudo systemctl restart rustdesksignal


sudo systemctl restart rustdeskrelay

USEFULL LINKS:

RUSTDESK GITHUB TUTORIALS:


https://github.com/rustdesk/rustdesk/wiki/FAQ#video-tutorials

Rustdesk Guide on main website:


https://rustdesk.com/docs/en/self-host/

Preconfigured Client deployment methods:


https://rustdesk.com/docs/en/self-host/client-deployment/

Documentations :
https://rustdesk.com/docs/en/
RUSTDESK CLIENT CONFIGURATION :

WE GO TO REALSES FROM RUSTDESK MAIN SITE

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

then install the client based on your operating system

that’s it now client is linked to your self hosted server

if you want to make a preconfigured client install script read the below section
RUSTDESK WINDOWS POWERSHELL INSTALL SCRIPT

How to Generates a powershell script to install a Preconfigured client to your server for easy
deployment.

Go to this link :

https://rustdesk.com/docs/en/self-host/client-deployment/

choose powershell script copy the contents into a text file

MAKE SURE YOU CHANGE configstring MARKED BELOW WITH YOUR STRING.

then save it as for example Rust-PreconfigClientinstall.PS1

how to get the config string easy way .. ? !!!!!

go to rustdesk website and download client based on your system

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

then install it and open client


fill in the details as follows :

ID : is xxxxx.xxxxxx.com is your domain if you choose dns/domain option or


xxx.xxx.xxx.xxx ip address if you choose ip address.
Relay Server : same as above
API:http:// xxxxx.xxxxxx.com is your domain if you choose dns/domain option or
http://xxx.xxx.xxx.xxx ip address if you choose ip address.
KEY: is the API key you got after the installation from above

Click on Apply then click export :

You should have something like this :

9JSPSvJzNrBDasJjNSdXOVVBlERDlleoNWZzIHcOJiOikXZr8mcw5yazVGZ0NXdy5CdyciojI0N3b
oJye

This is the configstring now paste it script below replace highlighted configstring with it and
save script as for example :

Rust-PreconfigClientinstall.PS1

Now you can use this script to install the preconfigured client linked to your self
hosted server to any PC or machine directly just by right click on script and
choose run with powershell .
https://rustdesk.com/docs/en/self-host/client-deployment/#powershell

POWERSHELL SCRIPT:

$ErrorActionPreference= 'silentlycontinue'

# Assign the value random password to the password variable

$rustdesk_pw=(-join ((65..90) + (97..122) | Get-Random -Count 12 | % {[char]$_}))

# Get your config string from your Web portal and Fill Below

$rustdesk_cfg="configstring"

################################### Please Do Not Edit Below This Line


#########################################

# Run as administrator and stays in the current directory

if (-Not
([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsIn
Role([Security.Principal.WindowsBuiltInRole]::Administrator))

if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty


BuildNumber) -ge 6000)

{
Start-Process PowerShell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy
Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";

Exit;

# This function will return the latest version and download link as an object

function getLatest()

$Page = Invoke-WebRequest -Uri 'https://github.com/rustdesk/rustdesk/releases/latest' -


UseBasicParsing

$HTML = New-Object -Com "HTMLFile"

try

$HTML.IHTMLDocument2_write($Page.Content)

catch

$src = [System.Text.Encoding]::Unicode.GetBytes($Page.Content)

$HTML.write($src)

}
# Current example link:
https://github.com/rustdesk/rustdesk/releases/download/1.2.3/rustdesk-1.2.3-x86_64.exe

$Downloadlink = ($HTML.Links | Where {$_.href -match


'(.)+\/rustdesk\/rustdesk\/releases\/download\/\d{1}.\d{1,2}.\d{1,2}(.{0,3})\/rustdesk(.)+x86_64.
exe'} | select -first 1).href

# bugfix - sometimes you need to replace "about:"

$Downloadlink = $Downloadlink.Replace('about:', 'https://github.com')

$Version = "unknown"

if ($Downloadlink -match './rustdesk/rustdesk/releases/download/(?<content>.*)/rustdesk-


(.)+x86_64.exe')

$Version = $matches['content']

if ($Version -eq "unknown" -or $Downloadlink -eq "")

Write-Output "ERROR: Version or download link not found."

Exit

# Create object to return


$params += @{Version = $Version}

$params += @{Downloadlink = $Downloadlink}

$Result = New-Object PSObject -Property $params

return($Result)

$RustDeskOnGitHub = getLatest

$rdver = ((Get-ItemProperty
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RustDesk\").Version)

if ($rdver -eq $RustDeskOnGitHub.Version)

Write-Output "RustDesk $rdver is the newest version."

Exit

if (!(Test-Path C:\Temp))

{
New-Item -ItemType Directory -Force -Path C:\Temp > null

cd C:\Temp

Invoke-WebRequest $RustDeskOnGitHub.Downloadlink -Outfile "rustdesk.exe"

Start-Process .\rustdesk.exe --silent-install

Start-Sleep -seconds 20

$ServiceName = 'Rustdesk'

$arrService = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue

if ($arrService -eq $null)

Write-Output "Installing service"

cd $env:ProgramFiles\RustDesk

Start-Process .\rustdesk.exe --install-service

Start-Sleep -seconds 20

}
while ($arrService.Status -ne 'Running')

Start-Service $ServiceName

Start-Sleep -seconds 5

$arrService.Refresh()

cd $env:ProgramFiles\RustDesk\

.\rustdesk.exe --get-id | Write-Output -OutVariable rustdesk_id

.\rustdesk.exe --config $rustdesk_cfg

.\rustdesk.exe --password $rustdesk_pw

Write-Output "..............................................."

# Show the value of the ID Variable

Write-Output "RustDesk ID: $rustdesk_id"

# Show the value of the Password Variable

Write-Output "Password: $rustdesk_pw"


Write-Output "..............................................."

You might also like