在 Compute Engine 中创建 Linux 虚拟机实例
了解如何使用 Google Cloud 控制台在 Compute Engine 中创建 Linux 虚拟机实例。
如需在 Google Cloud 控制台中直接遵循有关此任务的分步指导,请点击操作演示:
准备工作
- 登录您的 Google Cloud 账号。如果您是 Google Cloud 新手,请创建一个账号来评估我们的产品在实际场景中的表现。新客户还可获享 $300 赠金,用于运行、测试和部署工作负载。
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
- 启用 Compute Engine API。
创建 Linux 虚拟机实例
- In the Google Cloud console, go to the Create an instance page.
- In the Boot disk section, click Change to begin configuring your boot disk.
- 在 Public images 标签页上,从操作系统列表中选择 Ubuntu。
- 从版本列表中选择 Ubuntu 20.04 LTS。
- 点击选择。
- 在防火墙部分,选择 允许 HTTP 流量。
- 如需创建虚拟机,请点击创建。
启动实例需要一段时间,请稍等片刻。实例准备就绪后,将在虚拟机实例页面列出,并带有绿色状态图标。
Compute Engine 向创建虚拟机的用户授予 roles/compute.instanceAdmin
角色。Compute Engine 还会将该用户添加到 sudo
组。
连接到虚拟机实例
通过使用 Google Cloud Console 并完成以下步骤,连接到实例。您作为用于访问虚拟机实例页面的用户连接到虚拟机。
- In the Google 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.
清理
为避免因本页中使用的资源导致您的 Google Cloud 账号产生费用,请按照以下步骤操作。
在 Google Cloud 控制台中,前往虚拟机实例页面。
点击您创建的实例名称。
在实例详细信息页面顶部,点击删除。
后续步骤
- 完成教程以在新实例上设置基础网络服务器。
- 完成 Google Cloud Console 中的入门教程。
- 了解如何使用 gcloud CLI 命令行工具和 API 创建和管理虚拟机实例。
- 详细了解 Compute Engine 上的可用 Linux 映像。
- 了解如何将文件转移到实例。