Update _index.en.md

This commit is contained in:
Mr-Update 2024-05-21 21:56:48 +02:00 committed by GitHub
parent c588184bbe
commit baace1b8ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,8 +2,10 @@
title: Ubuntu Server with Docker title: Ubuntu Server with Docker
weight: 20 weight: 20
--- ---
Following tutoral will use Ubuntu Server **22.04 minimal** as example. And especially command line procedures, because lowest price spec of VPS can't handle desktop environment.
## Preparation Following tutorial will use Ubuntu Server **22.04 minimal** as example. And especially command line procedures, because lowest price spec of VPS can't handle desktop environment.
### Preparation
> First, you need: > First, you need:
* [Visual Studio Code](https://code.visualstudio.com) * [Visual Studio Code](https://code.visualstudio.com)
@ -15,22 +17,24 @@ Following tutoral will use Ubuntu Server **22.04 minimal** as example. And espec
* [Ubuntu Server ISO](https://ubuntu.com/download/server) * [Ubuntu Server ISO](https://ubuntu.com/download/server)
* Ability to setup port forwarding on your ISP modem or router, if you got these devices from your ISP and don't know how to enter the admin page, please ask your ISP * Ability to setup port forwarding on your ISP modem or router, if you got these devices from your ISP and don't know how to enter the admin page, please ask your ISP
## VPS/VM specs choosing/setting ### VPS/VM specs choosing/setting
If you plan to run only RustDesk Server, lowest spec should be fine, except AWS Lightsail, because its lowest spec is 512MB RAM which may too low and crash, any spec with **1GB RAM** should fine.
For self-hosted VMs, **1GB RAM and 32GB** of disk will suit your need, and UEFI BIOS is preferred. If you plan to run only RustDesk Server, lowest spec should be fine, except AWS Lightsail, because its lowest spec is 512 MB RAM which may too low and crash, any spec with **1 GB RAM** should fine.
For self-hosted VMs, **1 GB RAM and 32 GB** of disk will suit your need, and UEFI BIOS is preferred.
For any other hypervisor that runs on Windows or Linux with GUI, such as VirtualBox or VMware Workstation, please set your virtual network card to **bridged** mode. For any other hypervisor that runs on Windows or Linux with GUI, such as VirtualBox or VMware Workstation, please set your virtual network card to **bridged** mode.
## 1. Installing Ubuntu Server ### 1. Installing Ubuntu Server
#### [Skip](#2-setup-server) if you decide to rent a VPS.
##### Skip [2. Setup Server](#2-setup-server), if you decide to rent a VPS.
{{% notice note %}} {{% notice note %}}
This tutorial assume you install your Ubuntu Server as a virtual machine. If you decide to install on a physical machine, doing wrong procedures, may cause **data loss**. This tutorial assume you install your Ubuntu Server as a virtual machine. If you decide to install on a physical machine, doing wrong procedures, may cause **data loss**.
{{% /notice %}} {{% /notice %}}
{{% notice note %}} {{% notice note %}}
Use **Tab** to navigate different options, use **Space** to choose different options, use **Enter** when hitting Done. Use **Tab** to navigate different options, use **Space** to choose different options, use **Enter** when hitting **Done**.
{{% /notice %}} {{% /notice %}}
1. Choose language 1. Choose language
@ -46,14 +50,13 @@ Use **Tab** to navigate different options, use **Space** to choose different opt
Now, you could go to your router's DHCP settings, find and add your VM's LAN IP address to DHCP reservation, if you want, you could also assign other IP address. Now, you could go to your router's DHCP settings, find and add your VM's LAN IP address to DHCP reservation, if you want, you could also assign other IP address.
{{% /notice %}} {{% /notice %}}
4. It should choose mirror automatically, if yes, next 4. It should choose mirror automatically, if yes, next
![](images/installation/ubt-serv-install-mirror-config.png) ![](images/installation/ubt-serv-install-mirror-config.png)
5. Choose minimized to reduce memory and disk usage 5. Choose minimized to reduce memory and disk usage
![](images/installation/ubt-serv-install-installation-type.png) ![](images/installation/ubt-serv-install-installation-type.png)
6. Use entire disk, next 6. Use entire disk
![](images/installation/ubt-serv-install-use-entire-disk.png) ![](images/installation/ubt-serv-install-use-entire-disk.png)
7. Confirm your disk options 7. Confirm your disk options
@ -64,41 +67,45 @@ Now, you could go to your router's DHCP settings, find and add your VM's LAN IP
9. Skip [Ubuntu Pro](https://ubuntu.com/pro) register, or you could do it right now 9. Skip [Ubuntu Pro](https://ubuntu.com/pro) register, or you could do it right now
![](images/installation/ubt-serv-install-skip-pro.png) ![](images/installation/ubt-serv-install-skip-pro.png)
10. We need to install OpenSSH 10. We need to install OpenSSH
![](images/installation/ubt-serv-install-add-ssh-serv.png) ![](images/installation/ubt-serv-install-add-ssh-serv.png)
11. Skip anyting at this page, because it is snap package 11. Skip anything at this page, because it is snap package
![](images/installation/ubt-serv-install-skip-snap.png) ![](images/installation/ubt-serv-install-skip-snap.png)
12. After installed it may doing auto update, you could let it update, after it done, reboot. 12. After installed it may doing auto update, you could let it update, after it done, reboot.
## 2. Setup Server ### 2. Setup Server
1. Open VSCode, click button at left corner and select SSH 1. Open VSCode, click button at left corner and select SSH
![](images/setup/open_vscode.png) ![](images/setup/open_vscode.png)
2. Enter `username@IP` 2. Enter `username@IP`, for example `demouser@192.168.2.98`, and then `Enter`
For example: `demouser@192.168.2.98`, and then enter
![](images/setup/connect_server_through_vscode.png) ![](images/setup/connect_server_through_vscode.png)
3. Select your system, `Linux` 3. Select your system `Linux`
4. Confirm the fingerprint of the server 4. Confirm the fingerprint of the server
5. Enter the password of your user 5. Enter the password of your user
6. Open your home folder 6. Open your home folder
![](images/setup/vscode_open_folder.png) ![](images/setup/vscode_open_folder.png)
7. Click, **Yes, I trust the authors** 7. Click `Yes, I trust the authors`
8. Open terminal 8. Open terminal
![](images/setup/vscode_open_terminal.png) ![](images/setup/vscode_open_terminal.png)
9. Install packages 9. Install packages
```text ```
sudo apt install docker.io docker-compose python3-pip curl git vim nano zram-config -y sudo apt install docker.io docker-compose python3-pip curl git vim nano zram-config -y
``` ```
10. Disable disk swap 10. Disable disk swap
Check if swapfile exists Check if swap file exists
``` ```
sudo vim /etc/fstab sudo vim /etc/fstab
``` ```
@ -107,17 +114,17 @@ If you find anything similar to:
``` ```
/swap.img none swap sw 0 0 /swap.img none swap sw 0 0
``` ```
If not: Type `:qa!` then enter to exit. And go to Step. 12 If not: Type `:qa!` then `Enter` to exit. And go to step 12
If yes: Press `i` to activate edit mode, comment that line with `#` like this: If yes: Press `i` to activate edit mode, comment that line with `#` like this:
``` ```
#/swap.img none swap sw 0 0 #/swap.img none swap sw 0 0
``` ```
Press `Esc` and type `:wq` then enter to save the changes. Press `Esc` and type `:wq` then `Enter` to save the changes.
11. Adjust ZRAM size 11. Adjust ZRAM size
ZRAM means **"compress ram"**, it is more efficient and won't occupy disk space. ZRAM means "compress ram", it is more efficient and won't occupy disk space.
``` ```
sudo vim /usr/bin/init-zram-swapping sudo vim /usr/bin/init-zram-swapping
@ -141,6 +148,7 @@ Find your timezone at [Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_datab
``` ```
sudo timedatectl set-timezone "Asia/Taipei" sudo timedatectl set-timezone "Asia/Taipei"
``` ```
13. Reboot 13. Reboot
``` ```
sudo reboot sudo reboot
@ -151,12 +159,13 @@ After reboot, reconnect with your VSCode and open terminal.
(Skip if you don't have it.) (Skip if you don't have it.)
We've replaced swapfile with ZRAM, now we can delete `swap.img` now, replace `swap.img` with others if your name is different. We've replaced swap file with ZRAM, now we can delete `swap.img` now, replace `swap.img` with others if your name is different.
``` ```
sudo rm /swap.img sudo rm /swap.img
``` ```
## 3. Setup RustDesk Server ### 3. Setup RustDesk Server
1. Run this command to create required folders once: 1. Run this command to create required folders once:
``` ```
cd ~ && mkdir -p docker/rustdesk-server/data cd ~ && mkdir -p docker/rustdesk-server/data
@ -164,19 +173,21 @@ cd ~ && mkdir -p docker/rustdesk-server/data
2. Create `compose.yml` 2. Create `compose.yml`
Right click `rustdesk-server` folder, create new file named `compose.yml` Right click `rustdesk-server` folder, create new file named `compose.yml`.
Paste this to `compose.yml`. Paste this to `compose.yml`.
After you copied, you should replace `rustdesk.example.com` (Which point to your hbbr) to the domain that will point to your server. After you copied, you should replace `rustdesk.example.com` (Which point to your `hbbr`) to the domain that will point to your server.
{{% notice note %}} {{% notice note %}}
You could modify the line with `hbbs` to your server's LAN IP temporarily (If you're deploying in your LAN) to ensure it is working. After you verify your server is working, you **should** change back. You could modify the line with `hbbs` to your server's LAN IP temporarily (If you're deploying in your LAN) to ensure it is working. After you verify your server is working, you **should** change back.
{{% /notice %}} {{% /notice %}}
{{% notice note %}} {{% notice note %}}
Having problem after you changed LAN IP to domain? You should check [this article](/docs/en/self-host/nat-loopback-issues/). Having problem after you changed LAN IP to domain? You should check [this article](/docs/en/self-host/nat-loopback-issues/).
{{% /notice %}} {{% /notice %}}
```yml
```yaml
services: services:
hbbs: hbbs:
container_name: hbbs container_name: hbbs
@ -214,6 +225,7 @@ Check [here](/docs/en/client) to set up your client. Only `ID server` and `Key`
cd ~/docker/rustdesk-server cd ~/docker/rustdesk-server
sudo docker-compose up -d sudo docker-compose up -d
``` ```
4. Check it is working 4. Check it is working
In your VSCode, you should see `id_ed25519`, `id_ed25519.pub` on your `docker/rustdesk-server/data` folder. You could click `id_ed25519.pub`, this is the public key that you need for your RustDesk client. In your VSCode, you should see `id_ed25519`, `id_ed25519.pub` on your `docker/rustdesk-server/data` folder. You could click `id_ed25519.pub`, this is the public key that you need for your RustDesk client.
@ -221,7 +233,7 @@ In your VSCode, you should see `id_ed25519`, `id_ed25519.pub` on your `docker/ru
The public key will looks like this: The public key will looks like this:
![](images/setup/vscode_see_public_key.png) ![](images/setup/vscode_see_public_key.png)
## 5. Set port forwarding on your router/VPS ### 4. Set port forwarding on your router/VPS
Go to your router's admin webpage, find anything related to `Port forwarding`, it should appear in `WAN` or `Firewall` settings. Go to your router's admin webpage, find anything related to `Port forwarding`, it should appear in `WAN` or `Firewall` settings.
@ -231,13 +243,14 @@ If you're using VPS, Google search `{VPS vendor name} + firewall port` to find t
Open these required ports: Open these required ports:
* `21114` TCP for web console, only available in Pro version * `21114` TCP for web console, only available in Pro version
* `21115` `TCP` For NAT type test * `21115` TCP for NAT type test
* `21116` `TCP` TCP hole punching * `21116` TCP TCP hole punching
* `21116` `UDP` Heartbeat/ID server * `21116` UDP heartbeat/ID server
* `21117` `TCP` Relay * `21117` TCP relay
* `21118/21119` TCP for web socket if you want to run web client * `21118/21119` TCP for web socket if you want to run web client
## 6. Some basics ### 5. Some basics
1. How to apply the settings after you modified `compose.yml`? 1. How to apply the settings after you modified `compose.yml`?
Run this again: Run this again:
@ -263,7 +276,6 @@ Drag and drop them to VSCode Explorer if you want to upload it.
Use [Watchtower](https://containrrr.dev/watchtower/). Use [Watchtower](https://containrrr.dev/watchtower/).
Create folder and put the `compose.yml` in it. Create folder and put the `compose.yml` in it.
``` ```
@ -274,7 +286,8 @@ Change your timezone with yours at `TZ`.
If you didn't specify any container name, it will update **all** of your containers. If you didn't specify any container name, it will update **all** of your containers.
At the following command, it will run everyday at 3 AM, for more details, check their [documentation](https://containrrr.dev/watchtower/arguments/#scheduling). At the following command, it will run everyday at 3 AM, for more details, check their [documentation](https://containrrr.dev/watchtower/arguments/#scheduling).
```yml
```yaml
version: "3" version: "3"
services: services:
watchtower: watchtower: