QEMU
QEMU (quick emulator) is a virtualization software to emulate hardware of a computer.
In this tutorial, QEMU 3.1 was used on Debian 10.
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 \
-soundhw 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 |
---|---|
gtk | Display video output in a GTK window |
sdl | Display video output via SDL |
vnc | Start a VNC server |
curses | Display video output via curses |
egl-headless | Offload all OpenGL operations to a local DRI device |
none | Do not display video output |
Video card for guest
-vga
type
type | Description | Comment |
---|---|---|
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 |
none | Disable VGA card |
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
Sound card for guest
-soundhw
card
card | Description | Comment |
---|---|---|
hda | Intel HD Audio | |
es1370 | ENSONIQ AudioPCI ES1370 | Works well for Windows XP |
ac97 | Intel 82801AA AC97 Audio | |
cs4231a | CS4231A | |
gus | Gravis Ultrasound GF1 | |
adlib | Yamaha YM3812 (OPL2) | |
sb16 | Creative Sound Blaster 16 | |
pcspk | PC speaker |
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 | |
rocker | ||
rtl8139 | Realtek Fast Ethernet | Works well for Windows 7 |
virtio-net-pci | ||
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 | 2020-06-26 | 8.7 KB |