יצירת מכונות וירטואלית של Linux ב-Compute Engine

איך יוצרים מכונה וירטואלית (VM) של Linux ב-Compute Engine באמצעות Google Cloud המסוף


לחצו על תראו לי איך כדי לקרוא הסבר מפורט על המשימה ישירות במסוף Google Cloud :

תראו לי איך


לפני שמתחילים

  1. נכנסים לחשבון Google Cloud . אם אתם משתמשים חדשים ב- Google Cloud, צרו חשבון כדי שתוכלו להעריך את הביצועים של המוצרים שלנו בתרחישים מהעולם האמיתי. לקוחות חדשים מקבלים בחינם גם קרדיט בשווי 300$ להרצה, לבדיקה ולפריסה של עומסי העבודה.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. 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

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. 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.

    4. 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

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. Click Grant access.
    4. In the New principals field, enter your user identifier. This is typically the email address for a Google Account.

    5. Click Select a role, then search for the role.
    6. To grant additional roles, click Add another role and add each additional role.
    7. Click Save.
  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  6. Verify that billing is enabled for your Google Cloud project.

  7. 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

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. 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.

    4. 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

    1. In the Google Cloud console, go to the IAM page.

      Go to IAM
    2. Select the project.
    3. Click Grant access.
    4. In the New principals field, enter your user identifier. This is typically the email address for a Google Account.

    5. Click Select a role, then search for the role.
    6. To grant additional roles, click Add another role and add each additional role.
    7. Click Save.
  8. מפעילים את Compute Engine API.

    הפעלת Compute Engine API

יצירת מכונה וירטואלית של Linux

  1. נכנסים לדף Create an instance במסוף Google Cloud .

    כניסה לדף Create an instance

  2. בקטע OS and Storage לוחצים על Change כדי להתחיל בהגדרת דיסק האתחול.
  3. בכרטיסייה Public images, בוחרים באפשרות Ubuntu מהרשימה Operating system.
  4. בוחרים באפשרות Ubuntu 24.04 LTS מהרשימה Version.
  5. לוחצים על בחירה.
  6. בקטע Firewall בוחרים באפשרות Allow HTTP traffic.
  7. כדי ליצור את המכונה הווירטואלית (VM), לוחצים על האפשרות Create.

צריך להמתין זמן קצר עד שהמכונה הווירטואלית תופעל. אחרי שהמכונה הווירטואלית מוכנה, היא מופיעה בדף VM instances עם סמל סטטוס ירוק.

מערכת Compute Engine מעניקה למשתמש שיצר את המכונה הווירטואלית את התפקיד roles/compute.instanceAdmin. ‫Compute Engine גם מוסיף את המשתמש לקבוצה sudo.

התחברות למכונת ה-VM

כדי להתחבר למופע של מכונה וירטואלית באמצעות מסוף Google Cloud , מבצעים את השלבים הבאים. אתם מחוברים למכונת ה-VM בתור המשתמש שדרכו ניגשתם לדף של מכונות ה-VM.

  1. נכנסים לדף VM instances במסוף Google Cloud .

    כניסה לדף VM instances

  2. ברשימת המכונות הווירטואליות, לוחצים על SSH בשורה של המכונה שרוצים להתחבר אליה.

    הלחצן SSH ליד שם המכונה.

הסרת המשאבים

כדי לא לצבור חיובים לחשבון Google Cloud על המשאבים שבהם השתמשתם בדף הזה, פועלים לפי השלבים הבאים:

  1. נכנסים לדף VM instances במסוף Google Cloud .

    כניסה לדף VM instances

  2. בוחרים את השורה שמכילה את מופע מכונת ה-VM שיצרתם במדריך הזה.

  3. לוחצים על מחיקה ואז על מחיקה כדי לאשר.

המאמרים הבאים