Skip to main content

KVM/QEMU

簡介

QEMU為Fabrice Bellard開發的開源硬體模擬器軟體,支援模擬x86、ARM、SPARC、RISC-V、MIPS各種架構的電腦。

Home: QEMU

Installation

Fedora

QEMU

sudo dnf update
sudo dnf install qemu

From QEMU's source files

# Install prerequisite rpms to build the source code
sudo dnf install pixman-devel gcc make git python38

# Download source code
wget https://download.qemu.org/qemu-9.1.0.tar.xz
tar xvJf qemu-9.1.0.tar.xz
cd qemu-9.1.0
mkdir build
cd build
../configure --target-list='ppc64-softmmu ppc-softmmu' --prefix=/opt/qemu
make
make install
/opt/qemu/bin/qemu-system-ppc64 --version
If you don not mentioned the  --target-list='ppc64-softmmu ppc-softmmu', it will build more than 50 machines emulator, and will take a longer time to compile. fore more info, type #../configure -h

KVM/QEMU/Virt-Manager

sudo dnf install -y qemu-kvm libvirt virt-install bridge-utils qemu virt-manager \
  libvirt-devel virt-top libguestfs-tools guestfs-tools libvirt-client libvirt-python

sudo systemctl start libvirtd
sudo systemctl enable libvirtd

sudo usermod -a -G libvirt $(whoami)
sudo usermod -a -G kvm $(whoami)
sudo usermod -a -G input $(whoami)
RedHat
# RHEL 7
yum install qemu-kvm libvirt
yum install virt-install libvirt-python virt-manager virt-install libvirt-client

# RHEL 8
yum module install virt
yum install virt-install virt-viewer
systemctl start libvirtd

## Verification
virt-host-validate

Command Line

    virsh

    Guest CPU Models

    # For x86
    virsh cpu-models x86_64
    
    # For PowerPC
    virsh cpu-models ppc64

    List the VMs

    sudo virsh list --all

    FAQ

    Operation not permitted
    qemu-system-ppc64: -net nic -net tap,script=no,ifname=tap0: could not configure /dev/net/tun (tap): Operation not permitted

    Solution:

    sudo setcap CAP_NET_ADMIN=ep /usr/bin/qemu-system-ppc64