KVM/QEMU
簡介
QEMU為Fabrice Bellard開發的開源硬體模擬器軟體,支援模擬x86、ARM、SPARC、RISC-V、MIPS各種架構的電腦。
Home: QEMU
Installation
- Ubuntu安裝QEMU/KVM和Virt Manager虛擬機管理員 · Ivon的部落格 (ivonblog.com)
- How to Install and Use Qemu on Ubuntu (itsfoss.com)
- EmuGUI + QEMU,Windows系統安裝虛擬機軟體 · Ivon的部落格 (ivonblog.com)
- Setting Up Virtual Machines with QEMU, KVM, and Virt-Manager on Debian/Ubuntu - LinuxConfig
- How to run virtual machines with virt-manager - Fedora Magazine
- How to Install KVM on Fedora 37/36 Step-by-Step
- Virtualization Deployment and Administration Guide | Red Hat Product Documentation
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
/usr/local/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
- How To Use QEMU From the Linux Command-Line | Baeldung on Linux
- A Comprehensive Guide to Using QEMU from the Linux Command-Line — nixFAQ
- Chapter 20. Managing Guest Virtual Machines with virsh | Red Hat Product Documentation
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