在 Compute Engine 中建立 Linux VM 執行個體
瞭解如何使用 Trusted Cloud 控制台,在 Compute Engine 中建立 Linux 虛擬機器 (VM) 執行個體。
事前準備
-
In the Trusted Cloud console, on the project selector page, select or create a Trusted Cloud project.
-
Verify that billing is enabled for your Trusted Cloud project.
-
Make sure that you have the following role or roles on the project: Compute Instance Admin (v1), Compute Security Admin, OSPolicyAssignment Admin, Service Account User, Service Usage Admin
Check for the roles
-
In the Trusted Cloud console, go to the IAM page.
Go to IAM - Select the project.
-
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
Grant the roles
-
In the Trusted Cloud console, go to the IAM page.
前往 IAM - 選取專案。
- 按一下「授予存取權」 。
-
在「New principals」(新增主體) 欄位中,輸入您的使用者 ID。 這通常是工作團隊身分集區中,使用者的 ID。詳情請參閱「 在 IAM 政策中代表工作人員集區使用者」,或與管理員聯絡。
- 在「Select a role」(選取角色) 清單中,選取角色。
- 如要授予其他角色,請按一下 「新增其他角色」,然後新增每個其他角色。
- 按一下 [Save]。
- 啟用 Compute Engine API。
-
建立 Linux VM 執行個體
- In the Trusted Cloud console, go to the Create an instance page.
- In the Boot disk section, click Change to begin configuring your boot disk.
- 在「Public images」分頁上,從「Operating system」(作業系統) 清單中選擇「Ubuntu」。
- 從「版本」清單中選擇 Ubuntu 24.04 LTS。
- 按一下 [Select] (選取)。
- 在「Firewall」(防火牆) 區段中,選取 「Allow HTTP traffic」(允許 HTTP 流量)。
- 如要建立 VM,請按一下「建立」。
VM 執行個體啟動需要一些時間。VM 執行個體準備就緒後,就會列在「VM instances」(VM 執行個體) 頁面中,並顯示綠色的狀態圖示。
Compute Engine 會將 roles/compute.instanceAdmin
角色授予建立 VM 執行個體的使用者。Compute Engine 也會將該使用者新增至 sudo
群組。
連線至 VM 執行個體
使用 Trusted Cloud 控制台連線至 VM 執行個體,並完成下列步驟。您會以存取 VM 執行個體頁面的使用者身分,連線至 VM 執行個體。
- In the Trusted Cloud console, go to the VM instances page.
-
In the list of virtual machine instances, click SSH in the row of
the instance that you want to connect to.
清除所用資源
如要避免系統向您的 Trusted Cloud 帳戶收取本頁所用資源的費用,請按照下列步驟操作。
前往 Trusted Cloud 控制台的「VM instances」(VM 執行個體) 頁面。
選取您在本教學課程中建立的 VM 執行個體所在的資料列。
依序點選「刪除」圖示
和「刪除」確認操作。
後續步驟
- 參閱教學課程內容,瞭解如何在新的執行個體上設定基本網路伺服器。
- 逐步完成 Trusted Cloud 控制台中的入門教學課程。
- 瞭解如何使用 gcloud CLI 指令列工具和 API 來建立及管理虛擬機器執行個體。
- 進一步瞭解適用於 Compute Engine 的 Linux 映像檔。
- 瞭解如何將檔案轉移至執行個體。