FreeBSD in VirtualBox
Virtualization offers a great opportunity to run different operating systems on your computer. You don’t need incredible hardware to make it work – any recent AMD or Intel CPU with VT-x or AMD-V support will do.
Sun (now Oracle) VirtualBox is one of the most popular commercial and open source VMMs. It offers both a dual-licensed commercial version and an OSE edition that’s natively ported to FreeBSD.
There are a number of requirements that must be met to run FreeBSD in VirtualBox. Most notably, the computer must have a supported processor. You can find the current list of supported processors for each version of FreeBSD on the hardware compatibility page.
The FreeBSD host system should have enough memory and hard disk space to host one or more virtual machines. Depending on the size of the VM and the complexity of the operating system, this may require 256-384MB of RAM and 6+GB of hard disk space.
The FreeBSD VirtualBox port includes the Guest Additions suite of programs which enable a variety of features in a guest operating system. These include mouse pointer integration (making it easy to switch between the host and a guest) and faster video rendering. These require a recent version of the VirtualBox software and have not yet been fully tested on FreeBSD. If you encounter problems with these programs, refer to the Known Issues section below for further troubleshooting steps.
The FreeBSD bhyve port is a free virtualisation solution that can run desktop-style operating systems such as BSD, Haiku, Linux, OS/2, Solaris and Windows. A decent experience requires a modern processor (with SSE3 or better) with adequate RAM and hard disk space – for example, running a single desktop-style guest OS may require 256-384MB of RAM and 6+GB of space.
When installing the VM, make sure to choose “Bridged Networking”. This allows the VM to take a packet off the real NIC, read it and put its own reply back on the Ethernet network at the same layer as it was received from the Host.
The VM will ask for a virtual optical disc file – navigate to the file and click “Start”. After the installation is complete, the system will automatically reboot. When the reboot is finished, a window will appear with options to set up keyboard mapping. Choose standard mapping or your own to proceed.
During the installation process you will be asked to create an administrator user. Do so. You will also get lots of popups with important tips – read them.
Once this is done, you can start the VM and install your chosen OS. When you are finished you should be able to boot up the VM from the VMM GUI and run it just as you would any other OS.
One thing to note is that bhyve on FreeBSD doesn’t have VRDE support (on the virtualbox-ose side) so you can’t access the console unless you use a vnc client on a defined port. This is a little annoying and will probably be fixed in the future.
Another thing to note is that bhyve doesn’t allow for bridge mode over the em0 interface like it does with Xen or KVM. This will likely change in the future, but for now you’ll need to manually alias the VM’s nic to an IP on the Host server.
If you run a VMware virtual machine, the Guest Additions suite can provide useful features such as mouse pointer integration (allowing you to move the mouse between host and guest without using a special key combination) and faster video rendering in Windows guests. To install the Guest Additions, go to the Oracle VM VirtualBox download page and click the download link for your operating system.
In the VirtualBox application, click the Storage section in the lower right corner of the window. In the IDE Secondary Device 0 line, you should see two options: one is a new hard disk that VirtualBox created for the system and has a square blue hard drive icon, and the other is your FreeBSD download that has a light blue disk icon.
To resolve this problem, you must remove the old hard disk from your virtual machine by clicking the IDE Secondary Device 0 menu in the VirtualBox application and selecting “Remove Disc”. Then you can create a new hard disk for your VM and use the new disk.