You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在GCP中创建搭载Ubuntu系统的Datalab VM实例?

Creating a Datalab VM Instance with Ubuntu

Got it, let's walk through exactly how to set up a Cloud Datalab VM running Ubuntu—since the default docs often skip over OS customization, I'll break down both the Cloud Console and CLI methods for you.

Using the Google Cloud Console

This is the most straightforward way if you prefer a GUI:

  • Open the Google Cloud Console and navigate to the Cloud Datalab section (you can search for "Datalab" in the top bar to jump right there).
  • Click the Create instance button to start configuring your VM.
  • Skip past the machine type customization (since you already know that part) and scroll down to the Operating system dropdown menu.
  • From the list, select your preferred Ubuntu version—options like Ubuntu 22.04 LTS or Ubuntu 20.04 LTS are typically available as official, supported images.
  • Configure remaining settings as needed: pick your region/zone, adjust disk size, set up network access, etc.
  • If you want to pre-install tools or run setup scripts on boot, head to the Advanced options tab, find the Startup script field, and add your bash commands there.
  • Hit Create and wait a few minutes for the instance to provision. Once it's ready, you can access the Datalab web interface directly from the console.

Using the gcloud Command-Line Tool

If you prefer working in the terminal, this method is quick and scriptable:

  • First, make sure your gcloud CLI is installed, authenticated, and set to the correct project/region (run gcloud init if you haven't already).
  • Use the gcloud datalab instances create command with flags to specify the Ubuntu image. Here's a working example:
    gcloud datalab instances create my-ubuntu-datalab \
      --image-family ubuntu-2204-lts \
      --image-project ubuntu-os-cloud \
      --machine-type n1-standard-2
    
    • my-ubuntu-datalab: Replace this with your desired instance name.
    • --image-family: Specifies the Ubuntu version family (use ubuntu-2004-lts for 20.04, etc.).
    • --image-project: Points to Ubuntu's official cloud image project to ensure compatibility.
    • --machine-type: Add this if you want to use a custom machine type (adjust to your needs, e.g., n1-highmem-4).
  • After running the command, wait for the instance to spin up. Once done, connect to the Datalab interface with:
    gcloud datalab instances connect my-ubuntu-datalab
    

Quick Notes

  • Always use official Ubuntu images from the ubuntu-os-cloud project to avoid compatibility issues with Datalab's tools.
  • Check your project's VM quota before creating the instance—you might need to request a quota increase if you hit limits.
  • To see all available Ubuntu image families, run:
    gcloud compute images list --project ubuntu-os-cloud --filter="family:ubuntu*"
    

内容的提问来源于stack exchange,提问作者user1058210

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 10:28:52