How to Add Custom Oracle Linux Images to Google Cloud (GCP)
Google Cloud doesn’t ship Oracle Linux by default, so you have to roll up your sleeves and do it yourself.
GCP Compute Engine & Images: A Quick Intro
Google Cloud’s Compute Engine is a powerful virtual machine (VM) hosting service that lets you spin up instances in the blink of an eye. Normally, you choose from Google’s prebuilt images—Ubuntu, Debian, Red Hat, etc.—but Oracle Linux? Not in the default lineup.
That’s where custom images come in. They allow you to bring your own OS configurations into GCP, ensuring consistency across environments. The process involves:
- Getting an Oracle Linux image (OVA format).
- Uploading it to Google Cloud Storage.
- Importing it into Compute Engine.
- Creating a reusable image from it.
Now, let’s get to the fun part—actually doing it.
Step 1: Get Your Oracle Linux OVA Image
Oracle conveniently provides ready-to-use images for Oracle Linux. You can download them from:
For this example, we’ll use Oracle Linux 9.5:
|
This OVA file is basically a pre-packaged VM image, containing everything needed to run Oracle Linux in a virtualized environment.
Step 2: Upload the Image to Google Cloud Storage
Before you can use the image in GCP, you need to upload it to a Cloud Storage bucket.
You can check your buckets with
|
You can use gcloud in case you need to switch the project
|
If you don’t have a bucket ready yet, create it:
|
Now, upload the OVA file:
|
Depending on your internet speed, you might want to grab a coffee. Or two.
Step 3: Import the Image into Compute Engine
Once the OVA file is in Google Cloud Storage, we can import it as a Compute Engine VM. Google’s gcloud CLI makes this process easy:
Documentation: gcloud
|
Some important flags here:
-
--project=<gcp_project>
: Adjust to your project id -
--source-uri
: The location of your OVA file. -
--os=rhel-9-byol
: Google doesn’t have anoracle-linux
flag, but since Oracle Linux is binary-compatible with RHEL, this works just fine. -
--machine-type
: Adjust this if required, but the system will be deleted after we captured the image. -
--subnet and --zone
: Might by different in your environment. Check on existing VMs if you are not sure.
This step might take a few minutes while Google processes and imports the image—perfect time for a quick shower! 😉
Step 4: Shut Down the VM
Once your VM is up and running, you can make any necessary modifications before shutting it down to convert its disk into a reusable image.
Documentation: gcloud
|
Step 5: Create a Custom Image from the Disk
Now comes the grand finale: turning the VM’s disk into a reusable custom image.
Documentation: gcloud
|
Once completed, this custom image can be used to launch new instances on GCP anytime, without having to re-import the OVA.
Step 6: Copy the Image to a Different Project (optional)
If you need to use your custom Oracle Linux image in another Google Cloud project, you can easily copy it over. This ensures consistency across environments without having to repeat the import process.
Run the following command to duplicate the image into a different project:
|
Once completed, the image will be available in the destination project, ready to launch instances just like in the original project.
Final Thoughts
Congratulations! You’ve successfully imported an Oracle Linux image into Google Cloud and created a reusable VM image. Now you can spin up Oracle Linux instances whenever you need, all while enjoying the flexibility and scalability of GCP.