

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 設定遠端 Amazon EC2 機器來疑難排解 Proton
<a name="troubleshoot-compatibility-setup-remote"></a>

 如果您沒有本機 Ubuntu 機器，請依照這些指示改為設定遠端機器。

 在此步驟中，您將使用 Amazon Elastic Compute Cloud (Amazon EC2) 設定遠端 Ubuntu 機器，以針對應用程式與 Amazon GameLift Streams 的 Proton 相容性進行疑難排解。本主題說明如何使用 Ubuntu 22.04 LTS、必要的 GPU 驅動程式和視覺化遠端桌面的 Amazon DCV Server 設定 Amazon EC2 執行個體。

## 使用 Ubuntu 22.04 LTS AMI 啟動 Amazon EC2 執行個體
<a name="troubleshoot-compatibility-setup-remote-launch-ec2"></a>

1.  在 AWS 管理主控台中導覽至 Amazon EC2。

1.  選取**啟動執行個體**。

1.  輸入**名稱**的「Amazon GameLift Streams Testing」。

1.  針對應用程式和作業系統映像 **(Amazon Machine Image) 選取 Ubuntu Server 22.04 LTS (HVM**)。 ****

1.  選取**執行個體類型的** **g4dn.2xlarge**。

1.  對於**金鑰對 （登入）**，如果您想要使用 SSH 存取執行個體，請選擇金鑰對。我們建議您將執行個體描述檔與 `AmazonSSMManagedInstanceCore`政策搭配使用，以使用 連線至您的執行個體 AWS Systems Manager Session Manager。如需詳細資訊，請遵循[將工作階段管理員許可新增至現有 IAM 角色](https://docs.aws.amazon.com/systems-manager/latest/userguide/getting-started-add-permissions-to-existing-profile.html)。

1.  針對**網路設定**，建立新的安全群組：

1.  針對**安全群組名稱**，輸入 **DCV。**

1.  新增**類型**為 `Custom TCP`、**連接埠範圍** `8443`和**來源類型的****傳入安全群組規則**`Anywhere`，以允許使用 Amazon DCV 進行存取。

1.  將儲存體增加到至少 **256 GiB**，然後選擇 **gp3** 作為儲存體類型。

1.  選擇**啟動執行個體**。

您的執行個體現在應該已啟動。

 請遵循[連線至 Linux 執行個體](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstances.html)中的指示，使用 SSH 或 連線至執行個體 AWS Systems Manager Session Manager。

## 安裝 GPU 驅動程式
<a name="troubleshoot-compatibility-setup-remote-install-gpu"></a>

### G4dn - NVIDIA GPU
<a name="troubleshoot-compatibility-setup-remote-install-gpu-nvidia"></a>

 執行下列命令來安裝其他模組和 Linux 韌體：

```
sudo apt install linux-modules-extra-aws linux-firmware 

# Install the AWS CLI required for NVIDIA driver installation 
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" 
sudo apt install unzip
unzip awscliv2.zip 
sudo ./aws/install
```

 在 [Linux 上安裝 NVIDIA 驅動程式時，請遵循適用於 Ubuntu 和 Debian 的 NVIDIA GRID 驅動程式](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-nvidia-driver.html)上的指示。

## 設定使用者環境
<a name="troubleshoot-compatibility-setup-remote-user-env"></a>

設定您的使用者環境，使其可以執行下列命令來使用 GPU。這會執行下列動作：
+ 將您新增至`video`群組，以讓您存取視訊裝置，而 `render`群組可讓您存取轉譯裝置。
+ 安裝 NVIDIA 驅動程式和從 Amazon S3 下載應用程式或遊戲 AWS CLI所需的 。

```
sudo adduser {{user}} 

# Add the current user to the video and render group 
sudo usermod -a -G video {{user}} 
sudo usermod -a -G render {{user}} 
sudo adduser {{user}} sudo 

# Install the AWS CLI 
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" 
sudo apt install unzip 
unzip awscliv2.zip 
sudo ./aws/install 

sudo reboot
```

## Amazon DCV 的安裝和組態
<a name="troubleshoot-compatibility-setup-remote-nice-dcv"></a>

 使用 SSH 或 重新連線至執行個體， AWS Systems Manager Session Manager 並遵循[在適用於 Ubuntu 的 Linux 上安裝 Amazon DCV 伺服器](https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-installing-linux.html)的指示。
+  確認已如 文件所述正確設定伺服器。
+  請遵循[安裝和設定 NVIDIA GPU 的 NVIDIA 驅動程式](https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-installing-linux-prereq.html#linux-prereq-gpu)中的步驟。
+  將 Amazon DCV 使用者新增至視訊群組，如[安裝伺服器指南的步驟 7](https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-installing-linux-server.html) 所述 （導覽至 Ubuntu 索引標籤）。

您不需要安裝 Amazon DCV Server 的任何選用部分。

完成後，請執行下列命令來啟動 Amazon DCV 伺服器：

```
sudo systemctl start dcvserver 
sudo systemctl enable dcvserver
```

## 使用 Amazon DCV 用戶端連線至 Ubuntu 伺服器
<a name="troubleshoot-compatibility-setup-remote-nice-dcv-connect"></a>

 重新連線至 Ubuntu 執行個體，並執行下列動作為使用者建立工作階段：

```
sudo dcv create-session --owner {{user}} --user {{user}} my-session --type console
```

 您現在可以使用 Amazon DCV 用戶端，使用其公有 IP 地址存取 Ubuntu 執行個體。當您啟動 Amazon DCV 用戶端時，會出現視窗，讓您透過視覺化顯示來存取 Ubuntu 執行個體。

![當您啟動 Amazon DCV 用戶端時，會出現視窗，讓您透過視覺化顯示來存取 Ubuntu 執行個體。](http://docs.aws.amazon.com/zh_tw/gameliftstreams/latest/developerguide/images/troubleshoot-compatibility-setup-remote-dcv.png)


## 驗證 GPU 驅動程式
<a name="troubleshoot-compatibility-setup-remote-verify-gpu"></a>

 確認 GPU 驅動程式已安裝並正常運作。其中一種驗證方式是在終端機中執行 [vkcube](https://github.com/krh/vkcube) 應用程式。

1.  使用下列命令安裝 `vulkan-tools` apt 套件。

   ```
   sudo apt install -y vulkan-tools
   ```

1.  執行 `vkcube`。

1.  檢閱輸出。
   +  如果您的系統正確使用正確的 GPU，您會看到類似以下的輸出，並顯示 GPU 的名稱： `Selected GPU 0: AMD Radeon Pro V520 (RADV NAVI12), type: 2`
   +  如果您的應用程式無法正確使用 GPU，您可能會看到類似下列的不同輸出： `Selected GPU 0: llvmpipe (LLVM 15.0.7, 256 bits), type: 4`

      在此情況下，請檢查 GPU 驅動程式並視需要重新安裝。

## 設定 Podman （僅限質子）
<a name="troubleshoot-compatibility-setup-remote-podman"></a>

如果您使用的是 Proton 執行期，則必須安裝 [Podman](https://wiki.debian.org/Podman)，這是 Proton 建置程序所使用的容器。在終端機中完成下列步驟。

1.  安裝 Podman，這是 Proton 建置程序使用的容器。

   ```
   sudo apt install podman
   ```

1.  在 檔案`/etc/subgid`和 中 `/etc/subgid` 

   1. 確認檔案列出您的 Linux 機器使用者名稱和密碼。您可以開啟檔案或使用 `cat`命令來查看檔案中的內容。格式範例：`test:165536:65536`，其中 `test`對應於您的使用者名稱。

   1.  如果未列出，請將它們新增至其中。格式範例：`test:165536:65536`，其中 `test`對應於您的使用者名稱。

   ```
   $ cat /etc/subuid
                 ceadmin:100000:65536
                 test:165536:65536
                 
                 $ cat /etc/subgid
                 ceadmin:100000:65536
                 test:165536:65536
   ```

    如需詳細資訊，請參閱 [Podman 文件中無根環境中 Podman 的基本設定和使用](https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md#basic-setup-and-use-of-podman-in-a-rootless-environment)。

## 下一步驟
<a name="troubleshoot-compatibility-setup-remote-setup-local-next-step"></a>

 您現在已設定 Amazon EC2 執行個體和環境，以疑難排解 Amazon GameLift Streams 的相容性問題。下一步是設定 Proton。如需說明，請參閱 [Proton 上的故障診斷](troubleshoot-compatibility-wp-proton.md)。