Update _index.zh-tw.md

This commit is contained in:
XLion 2024-02-03 21:19:46 +08:00 committed by GitHub
parent 59f89d6bd8
commit 63adfd8a9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,91 +2,85 @@
title: Windows & pm2
weight: 20
---
{{% notice note %}}
Windows 安全政策較為複雜,如果這份教程對您不適用,或您遇到連線不穩定的情況,請考慮轉移到 `Linux` 伺服器。
{{% /notice %}}
## 十字路口
您現在有兩個選擇,您可以使用 pm2 (較簡單) 或 NSSM (稍難) 來啟動 rustdesk 伺服器
您現在有兩個選擇,您可以使用 pm2 (較簡單) 或 NSSM (稍難) 來啟動 RustDesk 伺服器
使用 NSSM 的好處:
- Backwards compatibility with older windows (Windows Server 2008R2/Windows 7 and earlier although untested).
- Ideal for Windows Server
- Auto start on boot without login (The user who created the startup entry does not need to log on for it to start).
- Running both binaries as Services.
- Standalone (no dependency on nodejs)
- 與舊版 WindowsWindows Server 2008 R2/Windows 7 及更早版本,雖未經測試)的向下兼容。
- 適合 Windows 伺服器使用
- 開機自動啟動,無需登入(建立啟動項目的用戶無需登入即可啟動)。
- 將兩個執行檔作為服務運行。
- 獨立運行(不依賴於 nodejs
使用 pm2 的好處:
- Good idea if you run the server on the same computer as your main work computer
- You logon regularly to the user that created the rustdesk startup entry
- 使用者友好
- 如果您在主要工作的電腦上運行伺服器,這是一個好主意。
- 您會定期登入創建 RustDesk 啟動項目的使用者帳戶。
- 使用者友好
## 使用 NSSM 安裝
### 使用 NSSM 安裝
### 安裝 NSSM
Please [download](https://nssm.cc/release/nssm-2.24.zip) and extract NSSM select the appropriate
architecture to your windows system (if x86 use the contents of the win32 folder, if x64 use the
contents of win64 folder). It is also best practice to move the binary of NSSM into the
`Program Files\NSSM` (NSSM once started as a service, it cannot be moved from the directory it was placed in.
thus it is best to tuck it away in Program files) directory of your Installation drive (Usually the C drive).
It is also advisable to add the path (such as `C:\Program Files\NSSM`) to the path variable.
#### 安裝 NSSM
請[下載](https://nssm.cc/release/nssm-2.24.zip)並解壓縮 NSSM選擇適合您的 Windows 系統架構的版本(如果是 x86使用 win32 資料夾內的檔案;如果是 x64則使用 win64 資料夾)。最佳做法是將 NSSM 的執行檔移動到 `Program Files\NSSM` 目錄一旦作為服務啟動NSSM 不能從其放置的目錄中移動,因此最好放在 `Program Files` 中)。建議將路徑(如 `C:\Program Files\NSSM`)添加到環境變數中。
#### 檢查 NSSM 是否正確安裝
如果一切正確,`C:\Program Files\NSSM` 資料夾(在這個例子中使用 C: 磁碟,但您可以使用安裝 Windows 的任何磁碟或所需的任何路徑)應該只包含 `nssm.exe` 檔案。
### Checking if NSSM is installed properly
If you've done everything correctly the folder `C:\Program Files\NSSM` (in this example I use the C:
drive but you can use whatever drive you installed windows to or whatever path you desire) should
only contain the file `nssm.exe`.
我們將在範例中使用 `C:\Program Files\NSSM`
在此範例中,我們將使用 `C:\Program Files\NSSM`
打開命令提示字元並運行 `nssm`,如果您看到幫助頁面,則可以進行下一步。
Open Command prompt and run `nssm` if you see a help page you are ready to move onto the next step
#### 運行 hbbr 和 hbbs
下載 [RustDesk 伺服器](https://github.com/rustdesk/rustdesk-server/releases)的 Windows 版本。解壓縮至 `C:\Program Files\RustDesk Server`(或任何您想要的地方,只要確保在服務安裝後不會改變)。現在回到命令提示字元。
### 執行 hbbr 和 hbbs
Download the Windows version of [server program](https://github.com/rustdesk/rustdesk-server/releases).
Unzip the program to the `C:\Program Files\RustDesk Server` (or anywhere you desire just make sure it
doesn't change after the service is installed). now get back to Command prompt
在此範例中,我們將使用 `C:\Program Files\RustDesk Server`
我們將在範例中使用 `C:\Program Files\RustDesk Server`
```cmd
nssm install "RustDesk hbbs service" "C:\Program Files\RustDesk Server\hbbs.exe" -r 0.0.0.0 -k _
nssm install "RustDesk hbbr Service" "C:\Program Files\RustDesk Server\hbbr.exe" -k _
nssm install "RustDesk hbbs service" "C:\Program Files\RustDesk Server\hbbs.exe" -k _
nssm install "RustDesk hbbr service" "C:\Program Files\RustDesk Server\hbbr.exe" -k _
```
**Note:**
- You can change `RustDesk hbbs service` to whatever you desire to name hbbs the service
- You can change `RustDesk hbbr service` to whatever you desire to name hbbr the service
- You can change `C:\Program Files\RustDesk Server\hbbs.exe` to wherever you placed the rustdesk binaries
- You can change `C:\Program Files\RustDesk Server\hbbr.exe` to wherever you placed the rustdesk binaries
- You do not need the `-k _` option which is optional, it's just for better security
**注意:**
- 您可以將 `RustDesk hbbs service` 改為任何您希望命名 hbbs 的服務名稱。
- 您可以將 `RustDesk hbbr service` 改為任何您希望命名 hbbr 的服務名稱。
- 您可以將 `C:\Program Files\RustDesk Server\hbbs.exe` 改為 RustDesk 執行檔所在的位置。
- 您可以將 `C:\Program Files\RustDesk Server\hbbr.exe` 改為 RustDesk 執行檔所在的位置。
- 您不需要使用 `-k _` 選項,這是可選的,只是為了更好的安全性。在 `Pro` 版本中,請忽略 `-k _`,它是隱含應用的。
**Command templates:**
**指令範例:**
The command template in case you just want to copy and paste and edit.
如果您只想複製並貼上並編輯,這是指令的範例。
```cmd
nssm install <Desired hbbs servicename> <RustDesk hbbs binary path> <RustDesk hbbs arguments>
nssm install <Desired hbbr servicename> <RustDesk hbbr binary path> <RustDesk hbbr arguments>
nssm install <所需的 hbbs 服務名稱> <RustDesk hbbs 執行檔路徑> <RustDesk hbbs 參數>
nssm install <所需的 hbbr 服務名稱> <RustDesk hbbr 執行檔路徑> <RustDesk hbbr 參數>
```
**啟動服務**
成功安裝服務後,需要將其重新啟動。
成功安裝服務後,需要啟動它們。
```cmd
nssm start <Desired hbbs servicename>
nssm start <Desired hbbr servicename>
nssm start <所需的 hbbs 服務名稱>
nssm start <所需的 hbbr 服務名稱>
```
**大功告成!**
**成!**
(上述方法已在 Windows Server Core 2022 Standard 上測試)。
(以上方法已在 Windows Server Core 2022 標準版上測試。)
## 或
###
## 使用 pm2 安裝
### 使用 PM2 安裝
### 安裝 NodeJs
請[下載](https://nodejs.org/dist/v16.14.2/node-v16.14.2-x86.msi)並安裝 NodeJs。
NodeJs 是 pm2 的執行環境,所以要先安裝 NodeJs。
#### 安裝 Node.js
### 安裝 pm2
請[下載](https://nodejs.org/dist/v16.14.2/node-v16.14.2-x86.msi)並安裝 Node.js。
Node.js 是 PM2 的運行環境,所以您需要先安裝 Node.js。
`cmd.exe` 中輸入下面三行指令,每一行都要按 <kbd>Enter</kbd> 鍵,並逐行執行。
#### 安裝 PM2
`cmd.exe` 中輸入以下內容,每行輸入後按 <kbd>Enter</kbd> 鍵,逐行運行。
```cmd
npm install -g pm2
@ -94,19 +88,20 @@ npm install pm2-windows-startup -g
pm2-startup install
```
### 執行 hbbr 和 hbbs
下載 [伺服器程式](https://gitee.com/rustdesk/rustdesk-server/releases)的 Windows 版本,解壓縮到 C: 下。並執行下面四行指令 (記得編輯 `-r` 參數)
#### 運行 hbbr 和 hbbs
下載 [RustDesk 伺服器](https://github.com/rustdesk/rustdesk-server/releases)的 Windows 版本。將程序解壓縮到 C: 磁碟。執行以下四個命令:
```cmd
cd c:\rustdesk-server-windows-x64
pm2 start hbbs.exe -- -r <hbbr 運行所在主機的地址>
cd C:\rustdesk-server-windows-x64
pm2 start hbbs.exe
pm2 start hbbr.exe
pm2 save
```
### 查看記錄
#### 查看日誌
```
```cmd
pm2 log hbbr
pm2 log hbbs
```