This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
freebsd:bhyve [2016/12/06 14:46] tschulz |
freebsd:bhyve [2018/09/18 22:21] tschulz [FreeBSD Version] |
||
---|---|---|---|
Line 15: | Line 15: | ||
* add tap1, tap2, etc for more virtual machines | * add tap1, tap2, etc for more virtual machines | ||
<file bash /etc/rc.conf> | <file bash /etc/rc.conf> | ||
- | loned_interfaces="bridge0 tap0" | + | cloned_interfaces="bridge0 tap0" |
ifconfig_bridge0="addm re0 addm tap0" | ifconfig_bridge0="addm re0 addm tap0" | ||
</file> | </file> | ||
Line 60: | Line 60: | ||
- device.map file | - device.map file | ||
- raw drive image | - raw drive image | ||
+ | |||
+ | === Example device.map file === | ||
+ | <file> | ||
+ | (hd0) ./ubuntu-16.04.img | ||
+ | (cd0) ./ubuntu-16.04.1-server-amd64.iso | ||
+ | </file> | ||
+ | |||
+ | === Create drive image with: === | ||
+ | <file> | ||
+ | truncate -s 16G ubuntu-16.04.img | ||
+ | </file> | ||
+ | |||
+ | === Load Kernel and startvm === | ||
+ | <file> | ||
+ | screen | ||
+ | grub-bhyve -m device.map -r cd0 -M 1024M ubuntu-16.04 | ||
+ | bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc -s 2:0,virtio-net,tap0 -s 3:0,virtio-blk,./ubuntu-16.04.img -s 4:0,ahci-cd,./ubuntu-16.04.1-server-amd64.iso -l com1,stdio -c 4 -m 1024M ubuntu-16.04 | ||
+ | </file> | ||
+ | * As long as the Linux iso has a text mode installer it should install normally | ||
+ | === Destroy VM === | ||
+ | <file> | ||
+ | bhyvectl --destroy --vm=ubuntu-16.04 | ||
+ | </file> | ||
+ | |||
+ | |||
+ | |||
Line 72: | Line 98: | ||
==== run.sh ==== | ==== run.sh ==== | ||
* The following script loads the kernel, starts the VM, and kills the VM after a ACPI shutdown | * The following script loads the kernel, starts the VM, and kills the VM after a ACPI shutdown | ||
+ | |||
+ | ==== Linux Version ==== | ||
<file bash> | <file bash> | ||
#!/bin/sh | #!/bin/sh | ||
Line 87: | Line 115: | ||
bhyvectl --destroy --vm=${VMNAME} | bhyvectl --destroy --vm=${VMNAME} | ||
</file> | </file> | ||
+ | |||
+ | ==== FreeBSD Version ==== | ||
+ | <file bash> | ||
+ | #!/bin/sh | ||
+ | |||
+ | CONSOLE="-l com1,stdio" | ||
+ | VMNAME="bsd_emby" | ||
+ | DISKFILE="./emby.img" | ||
+ | DISKIMAGE="-s 3:0,virtio-blk,./emby.img" | ||
+ | RAM="1024M" | ||
+ | CPUS="4" | ||
+ | TAPDEV="tap1" | ||
+ | NETWORK="-s 2:0,virtio-net,${TAPDEV}" | ||
+ | |||
+ | cd /vol4/byhve/bsd_emby | ||
+ | bhyveload -m ${RAM} -d ${DISKFILE} ${VMNAME} | ||
+ | bhyve -A -H -P -s 0:0,hostbridge -s 1:0,lpc ${NETWORK} ${DISKIMAGE} ${CONSOLE} | ||
+ | bhyvectl --destroy --vm=${VMNAME} | ||
+ | </file> | ||
+ | |||