Este conteúdo não está disponível no idioma selecionado.

Chapter 3. Deploying a Red Hat Enterprise Linux image as a Google Compute Engine instance on Google Cloud


To set up a deployment of Red Hat Enterprise Linux 9 (RHEL 9) on Google Cloud, you can deploy RHEL 9 as a Google Compute Engine (GCE) instance on Google Cloud.

Note

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

Important

You can create a custom VM from an ISO image, but Red Hat recommends that you use the Red Hat Image Builder product to create customized images for use on specific cloud providers. See Composing a Customized RHEL System Image for more information.

Prerequisites

  • You need a Red Hat Customer Portal account to complete the procedures in this chapter.
  • Create an account with Google Cloud to access the Google Cloud Console. See Google Cloud for more information.

3.1. Red Hat Enterprise Linux image options on Google Cloud

You can use multiple types of images for deploying RHEL 9 on Google Cloud. Based on your requirements, consider the following options that are optimal for your use case.

Expand
Table 3.1. Image options
Image optionSubscriptionsSample scenarioConsiderations

Deploy a Red Hat Gold Image.

Use your existing Red Hat subscriptions.

Select a Red Hat Gold Image on Google Cloud. For details on Gold Images and how to access them on Google Cloud.

The subscription includes the Red Hat product cost; you pay Google for all other instance costs. Red Hat provides support directly for custom RHEL images.

Deploy a custom image that you move to Google Cloud.

Use your existing Red Hat subscriptions.

Upload your custom image and attach your subscriptions.

The subscription includes the Red Hat product cost; you pay all other instance costs. Red Hat provides support directly for custom RHEL images.

Deploy an existing Google Cloud image that includes RHEL.

The Google Cloud images include a Red Hat product.

Choose a RHEL image when you launch an instance on the Google Cloud Compute Engine, or choose an image from the Google Cloud Marketplace.

You pay Google Cloud on an hourly basis according to the pay-as-you-go (PAYG) model. These images are on-demand images. Google Cloud offers support for on-demand images through a support agreement.

Note that you can create a custom image for Google Cloud by using Red Hat Enterprise Linux (RHEL) Image Builder. See Composing a Customized RHEL System Image for more information.

Important

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

  1. Create a new custom RHEL instance and migrate data from your on-demand instance.
  2. Cancel your on-demand instance after you migrate your data to avoid double billing.

Next steps

Installing the Google Cloud SDK

3.2. Understanding base images

To create a base VM from an ISO image, you can use preconfigured base images and their configuration settings.

3.2.1. Using a custom base image

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

3.2.2. Virtual machine configuration settings

Cloud VMs must have the following configuration settings.

Expand
Table 3.2. VM configuration settings
SettingRecommendation

ssh

ssh must be enabled to provide remote access to your VMs.

dhcp

The primary virtual adapter should be configured for dhcp.

3.3. Creating a base VM from an ISO image

To create a RHEL 9 base image from an ISO image, enable your host machine for virtualization and create a RHEL virtual machine (VM).

Prerequisites

3.3.1. Creating a base image from an ISO image

The following procedure lists the steps and initial configuration requirements for creating a custom ISO image. Once you have configured the image, you can use the image as a template for creating additional VM instances.

Prerequisites

Procedure

  1. Create and start a basic Red Hat Enterprise Linux (RHEL) VM. For instructions, see Creating virtual machines.

    1. Set the default memory and CPUs to the capacity you need for the VM and the virtual network interface to virtio.

      For example, the following command creates a kvmtest VM by using the rhel-9.0-aarch64-kvm.qcow2 image:

      # virt-install \
          --name kvmtest --memory 2048 --vcpus 2 \
          --disk rhel-9.0-aarch64-kvm.qcow2,bus=virtio \
          --import --os-variant=rhel9.0
    2. If you use the web console to create your VM, follow the procedure in Creating virtual machines using the web console, with these caveats:

      • Do not check Immediately Start VM.
      • Change your Memory size to your preferred settings.
      • Before you start the installation, ensure that you have changed Model under Virtual Network Interface Settings to virtio and change your vCPUs to the capacity settings you want for the VM.
  2. Review the following additional installation selection and modifications.

    • Select Minimal Install with the standard RHEL option.
    • For Installation Destination, select Custom Storage Configuration. Use the following configuration information to make your selections.

      • Ensure allocation of at least 500 MB and maximum 1 GB or more for /boot.
      • In the filesystem section, use the extended File System (XFS), ext4, or ext3 for both boot and root partitions.
    • On the Installation Summary screen, select Network and hostname. Switch Ethernet to ON.
  3. When the installation starts:

    • Create a root password.
    • Create an administrative user account.
  4. After installation is complete, reboot the VM.
  5. Log in to the root account to configure the VM.

3.4. Uploading the RHEL image to Google Cloud

To run your RHEL 9 instance on Google Cloud, you must upload your RHEL 9 image to Google Cloud.

3.4.1. Creating a new project on Google Cloud

To upload your Red Hat Enterprise Linux 9 image to Google Cloud, you must first create a new project on Google Cloud.

Prerequisites

  • You must have an account with Google Cloud. If you do not, see Google Cloud for more information.

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.

    Note

    Once you have installed the Google Cloud SDK, you can use the gcloud projects create CLI command to create a project. For example:

    # gcloud projects create my-gcp-project3 --name project3

    The example creates a project with the project ID my-gcp-project3 and the project name project3. See gcloud project create for more information.

3.4.2. Installing the Google Cloud SDK

Many of the procedures to manage HA clusters on Google Cloud require the tools in the Google Cloud SDK.

Procedure

  1. Follow the Google Cloud instructions for downloading and extracting the Google Cloud SDK archive. See the Google Cloud document Quickstart for Linux for details.
  2. Follow the same instructions for initializing the Google Cloud SDK.

    Note

    Once you have initialized the Google Cloud SDK, you can use the gcloud CLI commands to perform tasks and obtain information about your project and instances. For example, you can display project information with the gcloud compute project-info describe --project <project-name> command.

3.4.3. Creating SSH keys for Google Cloud Compute Engine

Generate and register SSH keys with Google Compute Engine (GCE) so that you can SSH directly into an instance by using its public IP address.

Procedure

  1. Use the ssh-keygen command to generate an SSH key pair for use with GCE.

    # ssh-keygen -t rsa -f ~/.ssh/google_compute_engine
  2. 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.
  3. Click SSH Keys and then click Edit.
  4. Enter the output generated from the ~/.ssh/google_compute_engine.pub file and click Save.

    You can now connect to your instance by using standard SSH.

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

    Note that you can run the gcloud compute config-ssh command to display your config file with aliases for your instances. You can then connect to your instance by using the alias through SSH. For details, see gcloud compute config-ssh.

3.4.4. Creating a storage bucket in Google Cloud Storage

To import your RHEL 9 image to Google Cloud, you must first create a Google Cloud Storage Bucket.

Procedure

  1. If you are not already logged in to Google Cloud, log in with the following command.

    # gcloud auth login
  2. Create a storage bucket.

    # gsutil mb gs://bucket_name
    Note

    Alternatively, you can use the Google Cloud Console to create a bucket. See Create a bucket for information.

3.4.5. Converting and uploading your image to your Google Cloud Bucket

Before a local RHEL 9 image can be deployed in Google Cloud, you must first convert and upload the image to your Google Cloud Bucket. The following steps describe converting an qcow2 image to raw format and then uploading the image as a tar archive. However, using different formats is possible as well.

Procedure

  1. Run the qemu-img command to convert your image. The converted image must have the name disk.raw.

    # qemu-img convert -f qcow2 -O raw rhel-9.0-sample.qcow2 disk.raw
  2. Tar the image.

    # tar --format=oldgnu -Sczf disk.raw.tar.gz disk.raw
  3. Upload the image to the bucket you created previously. Upload could take a few minutes.

    # gsutil cp disk.raw.tar.gz gs://bucket_name
  4. From the Google Cloud home screen, click the collapsed menu icon and select Storage and then select Browser.
  5. Click the name of your bucket.

    The tarred image is listed under your bucket name.

    Note

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

3.4.6. Creating an image from the object in the Google Cloud bucket

Before you can create a GCE image from an object that you uploaded to your Google Cloud bucket, you must convert the object into a GCE image.

Procedure

  1. Run the following command to create an image for GCE. Specify the name of the image you are creating, the bucket name, and the name of the tarred image.

    # gcloud compute images create my-image-name --source-uri gs://my-bucket-name/disk.raw.tar.gz
    Note

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

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

3.4.7. Creating a Google Compute Engine instance from an image

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

Note

See Creating and starting a VM instance for more information about GCE VM instances and their configuration options.

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.

    Note

    These are the minimum configuration options necessary to create a basic instance. Review additional options based on your application requirements.

  10. Find your image under VM instances.
  11. From the Google Cloud Console Dashboard, 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 CLI command to create a GCE VM instance from an image. A simple example follows.

    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. See gcloud compute instances create for more information.

3.4.8. Connecting to your instance

Connect to your GCE instance by using its public IP address.

Procedure

  1. Ensure that your instance is running. The following command lists information about your GCE instance, including whether the instance is running, and, if so, the public IP address of the running instance.

    # gcloud compute instances list
  2. Connect to your instance by using standard SSH. The example uses the google_compute_engine key created earlier.

    # ssh -i ~/.ssh/google_compute_engine <user_name>@<instance_external_ip>
    Note

    Google Cloud offers a number of ways to SSH into your instance. See Connecting to instances for more information. You can also connect to your instance using the root account and password you set previously.

3.4.9. Attaching Red Hat subscriptions

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

Prerequisites

  • You must have enabled your subscriptions.

Procedure

  1. Register your system.

    # subscription-manager register
  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 Lightspeed.

    # insights-client register --display-name <display_name_value>

    For information about further configuration of Red Hat Lightspeed, see Client Configuration Guide for Red Hat Lightspeed.

Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2026 Red Hat
Voltar ao topo