QEMU
QEMU (quick emulator) is a virtualization software to emulate hardware of a computer.
Contents
Installation
apt install qemu-system
Image creation
qemu-img create -f qcow2 debian10.qcow2 60G
CLI options
The configuration is specified using command line interface (CLI) options.
There is no configuration file.
Example
qemu-system-x86_64 \
-machine accel=kvm \
-m 2048 \
-cdrom debian-10.0.0-amd64-DVD-1.iso \
-display gtk,gl=on \
-vga virtio \
-audio pa,model=hda \
-nic user,model=e1000 \
debian10.qcow2
KVM
The kernel-based virtual machine (KVM) significantly accelerates the virtualization.
On the host, virtualization support needs to be enabled in BIOS settings.
-machine accel=kvm
RAM size for guest
-m
megs
Image to install guest OS
-cdrom
file
Video output on host
-display
type
type | Description |
---|---|
none | Do not display video output |
gtk | Display video output in a GTK window |
sdl | Display video output via SDL |
egl-headless | Offload all OpenGL operations to a local DRI device |
curses | Display video output via curses |
spice-app | |
dbus |
Video card for guest
-vga
type
type | Description | Comment |
---|---|---|
none | Disable VGA card | |
std | Standard VGA card with Bochs VBE extensions | Default; Works well for Windows XP and Windows 7 |
cirrus | Cirrus Logic GD5446 Video card | |
vmware | VMWare SVGA-II compatible adapter | |
qxl | QXL paravirtual graphic card | |
virtio | Virtio VGA card | Needed for GL acceleration; Works well for Linux |
GL acceleration
-display gtk,gl=on -vga=virtio
Unfortunately,-display gtk,gl=on
does not work with NVIDIA proprietary drivers.
The display stays black. Tested combinations:- qemu 3.1.0 and nvidia-driver 440.82
- qemu 4.1.0 and nvidia-driver 390.132
-display sdl,gl=on -vga=virtio
Audio output on host and sound card for guest
-audio driver=
driver
,model=
model
driver | Description | Comment |
---|---|---|
none | Discard all audio outputs | |
alsa | ALSA | Only on Linux |
oss | OSS | Available on Unix-like systems |
pa | PulseAudio | |
sdl | SDL | |
sndio | SNDIO | Available on OpenBSD |
spice | Send audio through SPICE | |
wav | Write a WAV file | |
dbus | ||
jack |
model | Description | Comment |
---|---|---|
ac97 | Intel 82801AA AC97 Audio | |
adlib | Yamaha YM3812 (OPL2) | |
cs4231a | CS4231A | |
es1370 | ENSONIQ AudioPCI ES1370 | Works well for Windows XP |
gus | Gravis Ultrasound GF1 | |
hda | Intel HD Audio | |
sb16 | Creative Sound Blaster 16 |
User-mode network
-nic user
Description | IPv4 |
---|---|
Guest | 10.0.2.15 |
Gateway / DHCP server | 10.0.2.2 |
DNS server | 10.0.2.3 |
SMB server (optional) | 10.0.2.4 |
Restrict network access
-nic user,restrict=on
Share directory via SMB
-nic user,smb=
dir
Host port forwarding to guest
-nic user,hostfwd=tcp::
hostport
-:
guestport
Network card for guest
-nic user,model=
modelname
modelname | Description | Comment |
---|---|---|
e1000 | Intel Gigabit Ethernet | Default |
e1000-82544gc | ||
e1000-82545em | ||
e1000e | ||
i82550 | Intel 8255x 10/100 Mbps Ethernet | |
i82551 | ||
i82557a | ||
i82557b | ||
i82557c | ||
i82558a | ||
i82558b | ||
i82559a | ||
i82559b | ||
i82559c | ||
i82559er | ||
i82562 | Intel Fast Ethernet Controller | |
i82801 | ||
ne2k_pci | NE2000 | Works well for Windows XP |
pcnet | AMD Ethernet Card | |
pvrdma | ||
rtl8139 | Realtek Fast Ethernet | Works well for Windows 7 |
rulip | ||
virtio-net-pci | ||
virtio-net-pci-non-transitional | ||
virtio-net-pci-transitional | ||
vmxnet3 |
Use image read-only
-snapshot
Key combinations
Ctrl-Alt-g | Release mouse pointer |
Ctrl-Alt-f | Toggle full screen |
Ctrl-Alt-u | Restore the screen's unscaled size |
Ctrl-Alt-2 | Switch to QEMU console |
Ctrl-Alt-1 | Switch to guest display |
External links for further information
CONTENT.html | source | 2023-06-14 | 9.8 KB |