Compute Engine で Linux VM インスタンスを作成する
Google Cloud コンソールを使用して Compute Engine で Linux 仮想マシン(VM)インスタンスを作成する方法について説明します。
このタスクを Google Cloud コンソールで直接行う際の順を追ったガイダンスについては、「ガイドを表示」をクリックしてください。
始める前に
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
- 
    
    
      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
      (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
 
- 
  
    Verify that billing is enabled for your Google 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 Google 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 Google Cloud console, go to the IAM page. IAM に移動
- プロジェクトを選択します。
- [ アクセスを許可] をクリックします。
- 
              [新しいプリンシパル] フィールドに、ユーザー ID を入力します。 これは通常、Google アカウントのメールアドレスです。 
- [ロールを選択] リストでロールを選択します。
- 追加のロールを付与するには、 [別のロールを追加] をクリックして各ロールを追加します。
- [保存] をクリックします。
 
- 
              
- 
    
    
      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
      (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
 
- 
  
    Verify that billing is enabled for your Google 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 Google 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 Google Cloud console, go to the IAM page. IAM に移動
- プロジェクトを選択します。
- [ アクセスを許可] をクリックします。
- 
              [新しいプリンシパル] フィールドに、ユーザー ID を入力します。 これは通常、Google アカウントのメールアドレスです。 
- [ロールを選択] リストでロールを選択します。
- 追加のロールを付与するには、 [別のロールを追加] をクリックして各ロールを追加します。
- [保存] をクリックします。
 
- 
              
- Compute Engine API を有効にします。
Linux VM インスタンスを作成する
- In the Google Cloud console, go to the Create an instance page.
- In the OS and Storage section, click Change to begin configuring your boot disk.
- [Public images] タブで、[OS] リストから [Ubuntu] を選択します。
- [バージョン] リストから [Ubuntu 24.04 LTS] を選択します。
- [選択] をクリックします。
- [ファイアウォール] で、 [HTTP トラフィックを許可する] を選択します。
- VM を作成するには、[作成] をクリックします。
VM インスタンスが起動するまで、しばらく待ちます。インスタンスの準備が整うと、[VM インスタンス] ページに緑色のステータス アイコン付きで表示されます。
Compute Engine によって、VM インスタンスを作成するユーザーに roles/compute.instanceAdmin ロールが付与されます。また、そのユーザーは sudo グループに追加されます。
VM インスタンスに接続する
Google Cloud コンソールで次の操作を行い、VM インスタンスに接続します。[VM インスタンス] ページにアクセスしたときに使用したユーザーとして VM インスタンスに接続されます。
- 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 コンソールで、[VM インスタンス] ページに移動します。 
- このチュートリアルで作成した VM インスタンスを含む行を選択します。 
- [削除] をクリックし、確認のため [削除] をクリックします。 
次のステップ
- 新しいインスタンスで基本的なウェブサーバーを設定する手順を確認する。
- Google Cloud コンソールでガイド付きのスタートガイドのチュートリアルを使用する。
- gcloud CLI コマンドライン ツールと API を使用して仮想マシン インスタンスの作成と管理を行う方法を確認する。
- Compute Engine で利用可能な Linux イメージについて詳しく学習する。
- ファイルをインスタンスに転送する方法を学習する。