3.3. Uploading and running a RHEL instance on Google Cloud


To run your RHEL instance on Google Cloud, you need to configure and upload a RHEL image to Google Cloud.

3.3.1. Installing the Google Cloud SDK

You can use Google Cloud SDK to manage Google Cloud resources and services from your command line by using Google Cloud CLI.

Prerequisites

Procedure

  1. Use the gcloud CLI utility to manage project and instances.
  2. Create a project:

    # gcloud projects create <example_gcp_project_id> --name <example_gcp_project>

    The example creates a project with the project ID <example_gcp_project_id> and the project name <example_gcp_project>.

  3. Display project information:

    # gcloud compute <example_project_info> describe --project <example_project_name>

3.3.2. Creating a new project on Google Cloud

To upload your RHEL image to Google Cloud, You need to create new project on Google Cloud. A project manages your assigned Google Cloud resources.

Prerequisites

Procedure

  1. Launch the Google Cloud Console.
  2. Click the drop-down menu to the right of Google Cloud.
  3. From the pop-up menu, click NEW PROJECT.
  4. From the New Project window, enter a name for your new project.
  5. Check Organization. Click the drop-down menu to change the organization, if necessary.
  6. Confirm the Location of your parent organization or folder. Click Browse to search for and change this value, if necessary.
  7. Click CREATE to create your new Google Cloud project.

Create a Google Cloud storage bucket to import and store objects such as virtual machine (VM) images.

Procedure

  1. Log in to the Google cloud console:

    # gcloud auth login
  2. Create a storage bucket:

    # gsutil mb gs://<example_bucket_name>
    注意

    Alternatively, you can use the Google Cloud Console to create a bucket. For details, see Create a bucket.

  3. Specify the image name that you want to create, the existing bucket name, and the name of the image:

    # *gcloud compute images create my-image-name --source-uri gs://__<example_bucket_name>__/disk.raw.tar.gz*
    注意

    Alternatively, you can use the Google Cloud Console to create an image. See Creating, deleting, and deprecating custom images for more information.

  4. Optional: Find the image in the Google Cloud Console.

    1. Click the Navigation menu to the left of the Google Cloud Console banner.
    2. Select Compute Engine and then Images.
  5. Run the qemu-img command to convert your qcow2 image to the raw format:

    # qemu-img convert -f qcow2 -O raw rhel-10.0-sample.qcow2 disk.raw
  6. Compress the image:

    # tar --format=oldgnu -Sczf disk.raw.tar.gz disk.raw
  7. Upload the image to the existing bucket:

    # gsutil cp disk.raw.tar.gz gs://<example_bucket_name>
    注意

    Upload could take a few minutes.

  8. From the Google Cloud home screen, click the collapsed menu icon and select Storage and then select Browser.
  9. Click the name of your bucket where disk.raw.tar.gz is now listed.

    注意

    You can also upload your image by using the Google Cloud Console. To do so, click the bucket name and then click Upload files.

To configure a GCE VM instance from an image, use the Google Cloud Console.

Procedure

  1. From the Google Cloud Console Dashboard page, click the Navigation menu to the left of the Google Cloud Console banner and select Compute Engine and then select Images.
  2. Select your image.
  3. Click Create Instance.
  4. On the Create an instance page, enter a Name for your instance.
  5. Choose a Region and Zone.
  6. Choose a Machine configuration that meets or exceeds the requirements of your workload.
  7. Ensure that Boot disk specifies the name of your image.
  8. Optional: Under Firewall, select Allow HTTP traffic or Allow HTTPS traffic.
  9. Click Create.
  10. Find your image under VM instances.
  11. Click the Navigation menu to the left of the Google Cloud Console banner and select Compute Engine and then select VM instances.

    注意

    Alternatively, you can use the gcloud compute instances create command to create a GCE VM instance from an image.

    # gcloud compute instances create myinstance3 --zone=us-central1-a --image test-iso2-image

    The example creates a VM instance named myinstance3 in zone us-central1-a based upon the existing image test-iso2-image. For details, see gcloud compute instances create.

  12. Use the ssh-keygen utility to generate an SSH key pair to use with GCE by using the public IP address:

    # ssh-keygen -t rsa -f ~/.ssh/google_compute_engine.pub
  13. From the Google Cloud Console Dashboard page, click the Navigation menu to the left of the Google Cloud Console banner and select Compute Engine and then select Metadata.
  14. Click SSH Keys and then click Edit.
  15. Enter the output generated from the ~/.ssh/google_compute_engine.pub file and click Save.
  16. Connect to the instance:

    # ssh -i ~/.ssh/google_compute_engine <username>@<instance_external_ip>
    注意

    Or, you can run the gcloud compute config-ssh command to populate the config file with aliases for instances. The aliases allow simple SSH connections by instance name. For details, see gcloud compute config-ssh.

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部