How to use QEMU
h
CodeLongAndPros (1539)

How to emulate a x64, i386, or aarch64 computer

This is not a repl.it based tutorial, but it's related to some other topics like How a CPU works and How to make an operating system. QEMU will run on repl, but there's little CPU or RAM for it. I would use TC Linux if you have to have a go at it.

You'll first have to have QEMU installed.

Installation

I use Arch, so that's the only one that's correct.
If any of you replitors have a Ubuntu, Debain. Fedora, RHEL, CentOS, Gentoo, or SuSE system, tell me if it failed.

Arch Linux: sudo pacman -S qemu qemu-arch-extra
Debian/Ubuntu based: sudo apt install qemu qemu-kvm
Fedora dnf install @virtualization
Gentoo: emerge --ask app-emulation/qemu
SUSE: zypper install qemu
RHEL/CentOS: yum install qemu-kvm

For Mac users:

Homebrew: brew install qemu

Ports: sudo port install qemu

For Wandows users (Bleech):

Download and run this
No checksum for you!

Ok. now that you've got QEMU, let's fly!

Emulating a 64 bit system

Download the Manjaro XFCE iso, SHA1 checksum c44a2984aa2fada53c1db8c6b919b45152780489.

Create this directory structure:

qemu
└── manjaro

cd to qemu/manjaro

Let's make a 20Gb disk for manjaro:
qemu-img create -f qcow2 manjaro.img 20G

To break down the command:

qemu-img is the command, create is the verb, -f means format, qcow2 is the format, manjaro.img is the name of the file, and 20G is the size

Your qemu directory should look like this:

.qemu
└── manjaro
    └── manjaro.img

Now, move the manjaro ISO to qemu/manjaro and rename it to manjaro.iso

Now let's run qemu-system-x64_64 -m 2048 -net nic -net user -enable-kvm -hda manjaro.img -cdrom manjaro.iso -boot cda

To break it down:

  • m: Memory 2048M = 2G
  • net nic -net user: Enable networking
  • enable-kvm: Enable kvm
  • hda: set hard disk to manjaro.img
  • cdrom: set cd to manjaro.iso
  • boot: cda: set boot to:
    - Hard disk
    - CDROM
    - Floppy
    Now, let's run it.

You should see the grub screen:

After it loads, select 'Launch installer' and follow it through:

.

There you go, you've got Manjaro Linux running on a x64 emulator!

You can swap qemu-system-x86_64 with qemu-system-{arch} for other archs.
For example:

  • qemu-system-i386
  • qemu-system-aarch64
  • qemu-system-sparc

To run an app compiled for aarch64, use qemu-aarch64 {program} to run it.

That's all, for now!

This post has been locked
You are viewing a single comment. View All
Highwayman (1442)

👌

oh yeah? Well I’m running on a custom Mach! I have a wireless trackpad!
@DynamicSquid