User Tools

Site Tools


bhyve:management

This is an old revision of the document!


bhyve Management

VM Verwaltung

Befehle zur VM Verwaltung:

  • vm list - Listet alle VMs auf.
  • vm info <vm> - Zeigt Infos zu einer spezifischen VM.
  • vm start/stop <vm> - Startet/stoppt die VM.
  • vm poweroff <vm> - Schaltet VM hart aus, anstatt nur ein ACPI Shutdown zu senden
  • vm configure <vm> - Öffnet die Datei mit den Einstellungen der VM.
  • vm console <vm> - Öffnet (attach) die tmux Konsole der VM (detach mit ctrl-b + d).

Erstelle VM

Als Beispiel wird eine FreeBSD VM erstellt.

# vm create freebsd

Die Einstellungen werden standardmäßig aus /usr/local/share/examples/vm-bhyve/default.conf übernommen und können angepasst werden.

# vm configure freebsd

Starte die VM mit einer ISO zur Installation.

# vm install freebsd /tmp/FreeBSD-13.0-RELEASE-amd64.iso

Öffne für die Installation die tmux Konsole.

# vm console freebsd

Ubuntu Server 20.04

# vm create -s 64G ubuntu20
# vm configure ubuntu20

Setze loader auf uefi.

loader="uefi"
cpu=2
memory=2G
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"

Installation starten.

# vm install ubuntu20 /tmp/ubuntu-20.04.4-live-server-amd64.iso
# vm console ubuntu20

Um die Installation über die Konsole verfolgen zu können, drücke e beim Boot-Prompt. Verändere

setparams 'Install Ubuntu Server'

     setgfxpayload=keep
     linux /casper/vmlinuz quiet ---
     initrd /casper/initrd

zu

setparams 'Install Ubuntu Server'

     setgfxpayload=keep
     linux /casper/vmlinuz vga=normal console=tty0 console=ttyS0,115200n8 ---
     initrd /casper/initrd

OpenBSD 7.2

# vm create -s 128G openbsd72
# vm configure openbsd72

Setze loader auf grub und füge Zeilen hinzu.

loader="grub"
cpu=4
memory=4G
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
grub_install0="kopenbsd -h com0 /7.2/amd64/bsd.rd"
grub_run0="kopenbsd -h com0 -r sd0a /bsd"
bhyve_options="-w"

Installiere OpenBSD.

# vm install openbsd72 /tmp/openbsd72.iso
# vm console openbsd72

NetBSD 9.3

# vm create -s 128G netbsd93
# vm configure netbsd93

Setze loader auf grub und füge Zeilen hinzu.

loader="grub"
cpu=4
memory=4G
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
grub_install0="knetbsd -h -r cd0a /netbsd"
grub_run0="knetbsd -h -r dk0 /netbsd"
bhyve_options="-w"

Installiere NetBSD.

# vm install netbsd93 /tmp/NetBSD-9.3-amd64.iso
# vm console netbsd93

Windows 11

Verwende Windows config template. Muss eventl. vorher kopiert werden.

# cp /usr/local/share/examples/vm-bhyve/windows.conf /zroot/vm/.templates/
# vm create -t windows -s 64G windows11
# vm configure windows11

Passe config leicht an. graphics ermöglicht die Nutzung von VNC für eine graphische Konsole. graphics_wait hält die VM solange an, bis ein VNC Client sich verbunden hat.

loader="uefi"
graphics="yes"
graphics_wait="yes"
vnc_password="irgendein Passwort"
xhci_mouse="yes"
cpu=2
memory=4G
ahci_device_limit="8"
network0_type="e1000"
network0_switch="public"
disk0_type="ahci-hd"
disk0_name="disk0.img"
utctime="no"

Starte Installation.

# vm install windows11 /tmp/Win11_English_x64v1.iso
# vm list

Die Liste der VMs zeigt den VNC Port (z. B. 5900). Starte VNC Client mit der IP-Adresse des bhyve Servers und dem angezeigten Port (z. B. 10.0.1.213:5900). Führe Windows Installation durch.

Um die virtio verwenden zu können, lade die Treiber für Windows hier über die Stable virtio-win ISO herunter. Binde die ISO durch Doppelklick ein und starte Installation durch öffnen der Datei virtio-win-gt-x64.msi. Wähle bei der Installation nur die virtio Treiber aus, nicht die qemu Treiber. Fahre Windows herunter.

# vm configure windows11

Kommentiere graphics_wait aus, verändere network0_type zu virtio-net.

loader="uefi"
graphics="yes"
#graphics_wait="yes"
...
network0_type="virtio-net"
...
bhyve/management.1668013532.txt.gz · Last modified: by msvoelker