I am using FreeBSD 11 amd64 r275582
and have tried on FreeBSD 10.1 amd64 Release and it appears
to work equally well.
Preliminary setup:
Install port grub2-bhyve
Allow needed kernel modules at boot time:
Edit: /boot/loader.conf
Add the following lines:
Edit: /etc/rc.conf
Add the following lines:
**Note -- change em0 to whatever your real network interface is
Make a sysctl change.
Enter this line to add to /etc/sysctl.conf
Reboot FreeBSD to allow changes to apply.
Create directories for virtual machines:
Download the Ubuntu install ISO file: ubuntu-14.10-server-amd64.iso. It can be found here: http://releases.ubuntu.com/14.04/.
Save ISO file to /u1/dist.
Create the map and OS image file:
Create the device map file:
Add these two lines to ubuntu.map
Start the Grub installer:
The Ubuntu Grub installer menu will appear.
The FreeBSD command prompt will appear.
Now start the installer:
The Ubuntu text installer will start.
The installer asks some basic questions. Watch out -- select "Guided - use entire disk".
Note: Select Guided - use entire disk
The default -- Guided -use entire disk and set up LVM
Caused Ubuntu to crash later on during boot. YMMV.
I did install the OpenSSH server so I could
Make sure to select
When Ubuntu completes the install you will see:
Then the FreeBSD shell prompt returns.
Need to stop the VM with this command:
To make the Ubuntu start up a single command create a small script.
Add the following lines to the file:
Save the file, and make it executable:
You should now be able to start the fresh Ubuntu install with this command:
Finally the Ubuntu text console prompt will appear:
You now be able to ssh or work from the text console on Ubuntu.
How to shut down the VM:
Log in to Ubuntu from console or ssh.
When the FreeBSD shell prompt appears:
and have tried on FreeBSD 10.1 amd64 Release and it appears
to work equally well.
Preliminary setup:
Install port grub2-bhyve
cd /usr/ports/sysutils/grub2-bhyve
make install clean
Allow needed kernel modules at boot time:
Edit: /boot/loader.conf
Add the following lines:
Code:
vmm_load="YES"
nmdm_load="YES"
if_bridge_load="YES"
if_tap_load="YES"
Edit: /etc/rc.conf
Add the following lines:
Code:
cloned_interfaces="bridge0 tap0"
ifconfig_bridge0="addm em0 addm tap0"
**Note -- change em0 to whatever your real network interface is
Make a sysctl change.
Enter this line to add to /etc/sysctl.conf
Code:
echo "net.link.tap.up_on_open=1" >> /etc/sysctl.conf
Reboot FreeBSD to allow changes to apply.
Create directories for virtual machines:
mkdir /u1
mkdir /u1/dist
mkdir /u1/ubuntu
Download the Ubuntu install ISO file: ubuntu-14.10-server-amd64.iso. It can be found here: http://releases.ubuntu.com/14.04/.
Save ISO file to /u1/dist.
Create the map and OS image file:
cd /u1/ubuntu
truncate -s 40G ubuntu.img
Create the device map file:
cd /u1/ubuntu
vi ubuntu.map
Add these two lines to ubuntu.map
Code:
(hd0) ./ubuntu.img
(cd0) /u1/dist/ubuntu-14.10-server-amd64.iso
Start the Grub installer:
cd /u1/ubuntu
grub-bhyve -m ubuntu.map -r cd0 -M 2048M ubuntu
The Ubuntu Grub installer menu will appear.
Code:
Press Enter to select "Install Ubuntu Server"
Now start the installer:
Code:
bhyve -c 2 -m 2048M -H -P -A -l com1,stdio \
-s 0:0,hostbridge -s 1:0,lpc \
-s 2:0,virtio-net,tap0 \
-s 3,ahci-cd,/u1/dist/ubuntu-14.10-server-amd64.iso \
-s 4,virtio-blk,ubuntu.img ubuntu
The Ubuntu text installer will start.
The installer asks some basic questions. Watch out -- select "Guided - use entire disk".
Note: Select Guided - use entire disk
The default -- Guided -use entire disk and set up LVM
Caused Ubuntu to crash later on during boot. YMMV.
I did install the OpenSSH server so I could
ssh
to Ubuntu.Make sure to select
Code:
YES -- Install the GRUB boot loader on a hard disk
When Ubuntu completes the install you will see:
Code:
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system reboot
[ 703.362711] reboot: Restarting system
Need to stop the VM with this command:
bhyvectl --destroy --vm=ubuntu
To make the Ubuntu start up a single command create a small script.
Code:
cd /u1/ubuntu
vi start_ubuntu.sh
Add the following lines to the file:
Code:
grub-bhyve -m ubuntu.map -r hd0,msdos1 -M 2048M ubuntu
bhyve -w -AI -H -P -s 0:0,hostbridge \
-s 1:0,lpc -s 2:0,virtio-net,tap0 \
-s 3:0,virtio-blk,./ubuntu.img \
-l com1,stdio -c 2 \
-m 2048M ubuntu
Save the file, and make it executable:
chmod +x start_ubuntu.sh
You should now be able to start the fresh Ubuntu install with this command:
./start_ubuntu.sh
Finally the Ubuntu text console prompt will appear:
Code:
Ubuntu 14.10 ubuntu ttyS0
ubuntu login:
How to shut down the VM:
Log in to Ubuntu from console or ssh.
sudo init 0
When the FreeBSD shell prompt appears:
Code:
bhyvectl --destroy --vm=ubuntu