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_64for 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
2222to 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!
Top comments (0)