Running Linux in QEMU for Testing on IBM PowerPC (or x86)
I recently had the chance to work on an IBM Power 6 system running Linux—a first for me. While I’ve spent years working with x86 and ARM systems, PowerPC architecture was uncharted territory until now.
The need came up during a project involving a critical application where we had to validate compatibility with Power architecture. Rather than using the actual hardware (and tying it up), I fired up a QEMU virtual machine on my MacBook Pro M3 to simulate the environment.
Surprisingly, it worked beautifully: fast to build, simple to configure, and perfect for quick app validation.
💡 Pro Tip: This tutorial uses
qemu-system-x86_64
for demo purposes, but the same steps apply for PowerPC—just swap inqemu-system-ppc
.
Absolutely! Here's a Table of Contents you can include at the top of your Dev.to article. It’s formatted for Markdown and uses anchor-style links that are compatible with Dev.to’s automatic heading linking.
📚 Table of Contents
- Introduction
- 🔍 Why Build a Custom QCOW2 Image?
- 🛠 Step 1: Create a Blank QCOW2 Disk
- 🚀 Step 2: Boot the Ubuntu ISO with Your QCOW2 Disk
- 🔁 Step 3: Reboot into the Installed System
- 🧠 Final Thoughts
- 🔗 Resources
If you're a developer or systems engineer looking to test Linux on different architectures or just need a portable virtual machine for experimentation, this guide will walk you through creating a QEMU VM from an ISO file and a blank QCOW2 disk.
🔍 Why Build a Custom QCOW2 Image?
Sure, many Linux distributions offer prebuilt QCOW2 cloud images, but sometimes you need more control.
For instance:
- You’re installing a specialized stack like ROS 2 on Ubuntu.
- You want to simulate a different CPU architecture.
- You're building a portable development lab on your laptop.
Whatever the case, starting from an ISO gives you a flexible and consistent VM environment.
🛠 Step 1: Create a Blank QCOW2 Disk
Start by creating a 40GB disk in QCOW2 format:
qemu-img create -f qcow2 ubuntu-ros2.qcow2 40G
Why QCOW2?
QCOW2 is a smart choice for virtualization:
- Supports snapshots
- Saves disk space through compression
- Lightweight and portable
🚀 Step 2: Boot the Ubuntu ISO with Your QCOW2 Disk
Now, boot your ISO using QEMU and attach the new disk. This command launches a VM with:
- 4 GB RAM
- 2 vCPUs
- Boot from ISO
- Port forwarding from host port
2222
to VM SSH port22
qemu-system-x86_64 \
-m 4G \
-smp 2 \
-boot d \
-cdrom ubuntu-22.04.iso \
-drive file=ubuntu-ros2.qcow2,format=qcow2 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-device e1000,netdev=net0 \
-display default,show-cursor=on
Breakdown of the Command
Flag | Purpose |
---|---|
-m 4G |
Allocates 4GB of memory |
-smp 2 |
Uses 2 CPU cores |
-boot d |
Boots from CD-ROM (ISO) |
-cdrom |
Path to your Ubuntu ISO |
-drive |
Your blank QCOW2 disk |
-netdev / -device
|
Sets up networking + SSH forwarding |
-display |
Shows the VM window with a visible cursor |
Once the Ubuntu installer boots, walk through the installation and select your new disk.
🔁 Step 3: Reboot into the Installed System
After the install is complete, power down the VM. Now restart it, this time booting from the QCOW2 disk directly:
qemu-system-x86_64 \
-m 4G \
-smp 2 \
-drive file=ubuntu-ros2.qcow2,format=qcow2 \
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
-device e1000,netdev=net0 \
-display default,show-cursor=on
🔒 Security Tip: If you're planning to SSH into the VM, set up your public SSH key and secure your user account.
🧠 Final Thoughts
Whether you're testing for PowerPC compatibility, building custom environments for embedded systems, or just geeking out with virtualization, QEMU is an incredibly versatile tool.
It gives you a high degree of flexibility:
- No need for dedicated servers
- Easily simulate alternate architectures
- Keep your workflows portable and reproducible
With just a few commands, you’ve set up a clean, isolated Linux environment that’s ready for development, debugging, or deployment testing.
🔗 Resources
Have questions about Linux or virtualization? Drop a comment or reach out—always happy to chat!