Chapter 3. Deploying a RHEL image as a Google Compute Engine instance on GCP


To use a RHEL image on Google Cloud Platform (GCP), convert the image to a GCP-compatible format and deploy a VM from the image to run as an Google Compute Engine (GCE) VM. To create, customize, and deploy a RHEL image to GCE supported formats, you can use one of the following methods:

Note

For a list of Red Hat product certifications for GCP, see Red Hat on Google Cloud Platform.

Prerequisites

3.1. Available RHEL image types for public cloud

To deploy your RHEL virtual machine VM on a certified cloud service provider (CCSP), you can use a number of options. The following table lists the available image types, subscriptions, considerations, and sample scenarios for the image types.

Note

To deploy customized ISO images, you can use Red Hat Image Builder. With Image Builder, you can create, upload, and deploy these custom images specific to your chosen CCSP.

Table 3.1. Image options
Image typesSubscriptionsConsiderationsSample scenario

Deploy a Red Hat Golden Image

Use your existing Red Hat subscriptions

The subscriptions include the Red Hat product cost and support for Cloud Access images, while you pay the CCSP for all other instance costs

Select a Red Hat Golden Image on the CCSP. For details on Golden Images and how to access them on the CCSP, see the Red Hat Cloud Access Reference Guide

Deploy a custom image that you move to the CCSP

Use your existing Red Hat subscriptions

The subscriptions includes the Red Hat product cost and support for custom RHEL image, while you pay the CCSP for all other instance costs

Upload your custom image and attach your subscriptions

Deploy an existing RHEL based custom machine image

The custom machine images include a RHEL image

You pay the CCSP on an hourly basis based on a pay-as-you-go model. For this model, on-demand images are available on the CCSP marketplace. The CCSP provides support for these images, while Red Hat handles updates. The CCSP provides updates through the Red Hat Update Infrastructure (RHUI)

Select a RHEL image when you launch an instance on the CCSP cloud management console, or choose an image from the CCSP marketplace.

Important

You cannot convert an on-demand instance to a custom RHEL instance. For migrating from an on-demand image to a custom RHEL bring your own subscription (BYOS) image:

  • Create a new custom RHEL instance, then migrate data from your on-demand instance.
  • When your data migration is completed, terminate the on-demand instance to avoid additional billing.

3.2. Deploying a RHEL instance by using a custom base image

To manually configure a virtual machine (VM), first create a base (starter) image. Then, you can modify configuration settings and add the packages the VM requires to operate on the cloud. You can also make additional configuration changes for your specific application after you upload the image.

Creating a VM from a base image has the following advantages:

  • Fully customizable
  • High flexibility for any use case
  • Lightweight - includes only the operating system and the required runtime libraries

To create a custom base image of RHEL from an ISO image, you can use the command line interface (CLI) or the web console for creating and configuring VM.

Note

Vertify the following VM configurations.

  • ssh - ssh must be enabled to provide remote access to your VMs
  • dhcp - the primary virtual adapter should be configured for dhcp.

Prerequisites

  • You have enabled virtualization on the host machine.
  • For web console, ensure the following options:

    • You have not checked the Immediately Start VM option.
    • You have already changed the Memory size to your preferred settings.
    • You have changed the Model option under Virtual Network Interface Settings to virtio and vCPUs to the capacity settings for the VM.

Procedure

  1. Configure the Red Hat Enterprise Linux VM:

    1. To install from the command line (CLI), ensure that you set the default memory, network interfaces, and CPUs as per your requirement for the VM. For details, see Creating virtual machines by using the command line
    2. To install from the web console, see Creating virtual machines by using the web console
  2. When the installation starts:

    1. Create a root password.
    2. Create an administrative user account.
  3. After the installation completes, reboot the VM and log in to the root account.
  4. After logging in as root, you can configure the image.
  5. Register the VM and enable the RHEL repository:

    # subscription-manager register --auto-attach
    Copy to Clipboard

Verification

  • Verify that the cloud-init package is installed and enabled:

    # dnf install cloud-init
    # systemctl enable --now cloud-init.service
    Copy to Clipboard
  • Power down the VM.

3.3. Uploading and running a RHEL instance on GCP

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

3.3.1. Installing the Google Cloud SDK

You can use Google Cloud SDK to manage Google Cloud Platform (GCP) 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>
    Copy to Clipboard

    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>
    Copy to Clipboard

3.3.2. Creating a new project on GCP

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

Prerequisites

Procedure

  1. Launch the GCP Console.
  2. Click the drop-down menu to the right of Google Cloud Platform.
  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 GCP project.

3.3.3. Creating and uploading a RHEL image on Google Cloud Storage

Create a GCP storage bucket to import and store objects such as VM images.

Procedure

  1. Log in to the Google cloud console:

    # gcloud auth login
    Copy to Clipboard
  2. Create a storage bucket:

    # gsutil mb gs://<example-bucket-name>
    Copy to Clipboard
    Note

    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**
    Copy to Clipboard
    Note

    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 GCP 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
    Copy to Clipboard
  6. Compress the image:

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

    # gsutil cp disk.raw.tar.gz gs://<example-bucket-name>
    Copy to Clipboard
    Note

    Upload could take a few minutes.

  8. From the Google Cloud Platform 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.

    Note

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

3.3.4. Launching and connecting to a RHEL Google Compute Engine instance

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

Procedure

  1. From the GCP 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.

    Note

    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
    Copy to Clipboard

    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
    Copy to Clipboard
  13. From the GCP 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>
    Copy to Clipboard
    Note

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

3.4. Attaching Red Hat subscriptions

Using the subscription-manager command, you can register and attach your Red Hat subscription to a RHEL instance.

Prerequisites

Procedure

  1. Register your system:

    # subscription-manager register --auto-attach
    Copy to Clipboard
  2. Attach your subscriptions:

  3. Optional: To collect various system metrics about the instance in the Red Hat Hybrid Cloud Console, you can register the instance with Red Hat Insights.

    # insights-client register --display-name <display-name-value>
    Copy to Clipboard

    For information on further configuration of Red Hat Insights, see Client Configuration Guide for Red Hat Insights.

Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat