Ubuntu 24.04 installed with vm-bhyve after a bit of work
install packages
create the zfs datasets
rc.conf
kldload
only needed if you havent rebooted, and not needed after that
networking,
pinched the tips from vermaden
gateway enable
sysctl
set options permanently
copy templates
doas set up
edit doas.conf and add a rule for the vm command
change username to your username
start the vm service
only needed if you havent rebooted, and not needed after that
vm init
networking
change lagg0 to your network interface
fetch the iso
i found the vm iso command stopped downloading the iso part way through,
so instead i used fetch to download the iso
find the number of cpu's on your machine
edit the ubuntu template
i have set the cpu to 6 as i have 12 cpus
and the memory to 8G because i have 16G
im need a bit of power for the apps im going to be running
this is the important part of the config
if you dont have those two option you will be dumped into the grub prompt
and have to load some stuff manually which didnt work for me
create the vm
-t is the template name
-s is the size
ubuntu is the name of the vm
vm install
use the -f option to run the vm in the current terminal
just got everything installed
so i thought id share my notes so far
cerberus/freebsd/vm-bhyve.org at master · NapoleonWils0n/cerberus
cerberus code library. Contribute to NapoleonWils0n/cerberus development by creating an account on GitHub.
github.com
install packages
Code:
doas pkg install bhyve-firmware grub2-bhyve edk2-bhyve vm-bhyve-devel
create the zfs datasets
Code:
doas zfs create -o mountpoint=/vm zroot/vm
doas zfs create -o mountpoint=/vm/.iso zroot/vm/iso
doas zfs create -o mountpoint=/vm/.templates zroot/vm/templates
rc.conf
Code:
doas sysrc kld_list+="vmm nmdm"
doas sysrc vm_enable=YES
doas sysrc vm_dir="zfs:zroot/vm"
kldload
only needed if you havent rebooted, and not needed after that
Code:
doas kldload vmm nmdm
networking,
pinched the tips from vermaden
FreeBSD Bhyve Virtualization
The Bhyve FreeBSD hypervisor (called/spelled ‘beehive’ usually) was created almost 10 years ago. Right now it offers speed and features that other similar solutions provide – such…
vermaden.wordpress.com
gateway enable
Code:
doas sysrc gateway_enable=YES
sysctl
Code:
doas sysctl net.link.tap.up_on_open=1
doas sysctl net.inet.ip.forwarding=1
set options permanently
Code:
doas echo "net.link.tap.up_on_open=1" >> /etc/sysctl.conf
doas echo "net.inet.ip.forwarding=1" >> /etc/sysctl.conf
copy templates
Code:
doas cp -a /usr/local/share/examples/vm-bhyve /vm/.templates
doas set up
edit doas.conf and add a rule for the vm command
Code:
doas vi /usr/local/etc/doas.conf
change username to your username
Code:
# vm-bhyve
permit nopass :username cmd vm
start the vm service
only needed if you havent rebooted, and not needed after that
Code:
doas service vm start
vm init
Code:
doas vm init
networking
change lagg0 to your network interface
Code:
doas vm switch create public
doas vm switch add public lagg0
fetch the iso
i found the vm iso command stopped downloading the iso part way through,
so instead i used fetch to download the iso
Code:
doas fetch -o /vm/.iso/ubuntu-24.04.1-live-server-amd64.iso 'https://releases.ubuntu.com/24.04.1/ubuntu-24.04.1-live-server-amd64.iso'
find the number of cpu's on your machine
Code:
sysctl kern.sched.topology_spec
edit the ubuntu template
Code:
doas vi /vm/.templates/ubuntu.conf
i have set the cpu to 6 as i have 12 cpus
and the memory to 8G because i have 16G
im need a bit of power for the apps im going to be running
Code:
loader="grub"
cpu=6
memory=8G
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
grub_run_partition="2"
grub_run_dir="/grub"
this is the important part of the config
Code:
grub_run_partition="2"
grub_run_dir="/grub"
if you dont have those two option you will be dumped into the grub prompt
and have to load some stuff manually which didnt work for me
create the vm
Code:
doas vm create -t ubuntu -s 40G ubuntu
-t is the template name
-s is the size
ubuntu is the name of the vm
vm install
use the -f option to run the vm in the current terminal
Code:
doas vm install -f ubuntu ubuntu-24.04.1-live-server-amd64.iso
just got everything installed
so i thought id share my notes so far