Changeset View
Changeset View
Standalone View
Standalone View
documentation/content/en/books/handbook/virtualization/_index.adoc
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
[[virtualization-synopsis]] | [[virtualization-synopsis]] | ||||
== Synopsis | == Synopsis | ||||
Virtualization software allows multiple operating systems to run simultaneously on the same computer. Such software systems for PCs often involve a host operating system which runs the virtualization software and supports any number of guest operating systems. | Virtualization software allows multiple operating systems to run simultaneously on the same computer. Such software systems for PCs often involve a host operating system which runs the virtualization software and supports any number of guest operating systems. | ||||
After reading this chapter, you will know: | After reading this chapter, you will know: | ||||
* The difference between a host operating system and a guest operating system. | * The difference between a host operating system and a guest operating system. | ||||
* How to install FreeBSD on an Intel(R)-based Apple(R) Mac(R) computer. | * How to install FreeBSD as on follwing virtualization programs. | ||||
bcr: s/as on/on/
s/follwing/the following/
s/programs./platforms:/ | |||||
* How to install FreeBSD on Microsoft(R) Windows(R) with Virtual PC. | ** Parallels Desktop(Intel(R)-based Apple(R) macOS(R)) | ||||
* How to install FreeBSD as a guest in bhyve. | ** VMware Fusion(Intel(R)-based Apple(R) macOS(R)) | ||||
** VirtualBox(TM)(Microsoft(R) Windows(R), Intel(R)-based Apple(R) macOS(R), Linux) | |||||
** bhyve(FreeBSD) | |||||
* How to tune a FreeBSD system for best performance under virtualization. | * How to tune a FreeBSD system for best performance under virtualization. | ||||
Before reading this chapter, you should: | Before reading this chapter, you should: | ||||
* Understand the crossref:basics[basics,basics of UNIX(R) and FreeBSD]. | * Understand the crossref:basics[basics,basics of UNIX(R) and FreeBSD]. | ||||
* Know how to crossref:bsdinstall[bsdinstall,install FreeBSD]. | * Know how to crossref:bsdinstall[bsdinstall,install FreeBSD]. | ||||
* Know how to crossref:advanced-networking[advanced-networking,set up a network connection]. | * Know how to crossref:advanced-networking[advanced-networking,set up a network connection]. | ||||
* Know how to crossref:ports[ports,install additional third-party software]. | * Know how to crossref:ports[ports,install additional third-party software]. | ||||
[[virtualization-guest-parallels]] | [[virtualization-guest-parallelsdesktop]] | ||||
== FreeBSD as a Guest on Parallels for Mac OS(R) X | == FreeBSD as a Guest on Parallels Desktop for macOS(R) | ||||
Parallels Desktop for Mac(R) is a commercial software product available for Intel(R) based Apple(R) Mac(R) computers running Mac OS(R) 10.4.6 or higher. FreeBSD is a fully supported guest operating system. Once Parallels has been installed on Mac OS(R) X, the user must configure a virtual machine and then install the desired guest operating system. | Parallels Desktop for Mac(R) is a commercial software product available for Intel(R) based Apple(R) Mac(R) computers running macOS(R) 10.4.6 or higher. FreeBSD is a fully supported guest operating system. Once Parallels has been installed on macOS(R), the user must configure a virtual machine and then install the desired guest operating system. | ||||
[[virtualization-guest-parallels-install]] | [[virtualization-guest-parallelsdesktop-install]] | ||||
=== Installing FreeBSD on Parallels/Mac OS(R) X | === Installing FreeBSD on Parallels Desktop on Mac(R) | ||||
The first step in installing FreeBSD on Parallels is to create a new virtual machine for installing FreeBSD. Select [.guimenuitem]#FreeBSD# as the menu:Guest OS Type[] when prompted: | The first step in installing FreeBSD on Parallels is to create a new virtual machine for installing FreeBSD. Select [.guimenuitem]#FreeBSD# as the menu:Guest OS Type[] when prompted: | ||||
image::parallels-freebsd1.png[] | image::parallels-freebsd1.png[] | ||||
Choose a reasonable amount of disk and memory depending on the plans for this virtual FreeBSD instance. 4GB of disk space and 512MB of RAM work well for most uses of FreeBSD under Parallels: | Choose a reasonable amount of disk and memory depending on the plans for this virtual FreeBSD instance. 4GB of disk space and 512MB of RAM work well for most uses of FreeBSD under Parallels: | ||||
image::parallels-freebsd2.png[] | image::parallels-freebsd2.png[] | ||||
Show All 30 Lines | |||||
When the installation is finished, reboot into the newly installed FreeBSD virtual machine. | When the installation is finished, reboot into the newly installed FreeBSD virtual machine. | ||||
image::parallels-freebsd13.png[] | image::parallels-freebsd13.png[] | ||||
[[virtualization-guest-parallels-configure]] | [[virtualization-guest-parallels-configure]] | ||||
=== Configuring FreeBSD on Parallels | === Configuring FreeBSD on Parallels | ||||
After FreeBSD has been successfully installed on Mac OS(R) X with Parallels, there are a number of configuration steps that can be taken to optimize the system for virtualized operation. | After FreeBSD has been successfully installed on macOS(R) X with Parallels, there are a number of configuration steps that can be taken to optimize the system for virtualized operation. | ||||
[.procedure] | [.procedure] | ||||
. Set Boot Loader Variables | . Set Boot Loader Variables | ||||
+ | + | ||||
The most important step is to reduce the `kern.hz` tunable to reduce the CPU utilization of FreeBSD under the Parallels environment. This is accomplished by adding the following line to [.filename]#/boot/loader.conf#: | The most important step is to reduce the `kern.hz` tunable to reduce the CPU utilization of FreeBSD under the Parallels environment. This is accomplished by adding the following line to [.filename]#/boot/loader.conf#: | ||||
+ | + | ||||
[.programlisting] | [.programlisting] | ||||
.... | .... | ||||
kern.hz=100 | kern.hz=100 | ||||
.... | .... | ||||
+ | + | ||||
Without this setting, an idle FreeBSD Parallels guest will use roughly 15% of the CPU of a single processor iMac(R). After this change the usage will be closer to 5%. | Without this setting, an idle FreeBSD Parallels guest will use roughly 15% of the CPU of a single processor iMac(R). After this change the usage will be closer to 5%. | ||||
. Create a New Kernel Configuration File | . Create a New Kernel Configuration File | ||||
+ | + | ||||
All of the SCSI, FireWire, and USB device drivers can be removed from a custom kernel configuration file. Parallels provides a virtual network adapter used by the man:ed[4] driver, so all network devices except for man:ed[4] and man:miibus[4] can be removed from the kernel. | All of the SCSI, FireWire, and USB device drivers can be removed from a custom kernel configuration file. Parallels provides a virtual network adapter used by the man:ed[4] driver, so all network devices except for man:ed[4] and man:miibus[4] can be removed from the kernel. | ||||
. Configure Networking | . Configure Networking | ||||
+ | + | ||||
The most basic networking setup uses DHCP to connect the virtual machine to the same local area network as the host Mac(R). This can be accomplished by adding `ifconfig_ed0="DHCP"` to [.filename]#/etc/rc.conf#. More advanced networking setups are described in crossref:advanced-networking[advanced-networking,Advanced Networking]. | The most basic networking setup uses DHCP to connect the virtual machine to the same local area network as the host Mac(R). This can be accomplished by adding `ifconfig_ed0="DHCP"` to [.filename]#/etc/rc.conf#. More advanced networking setups are described in crossref:advanced-networking[advanced-networking,Advanced Networking]. | ||||
[[virtualization-guest-virtualpc]] | [[virtualization-guest-vmware]] | ||||
== FreeBSD as a Guest on Virtual PC for Windows(R) | == FreeBSD as a Guest on VMware Fusion for macOS(R) | ||||
Virtual PC for Windows(R) is a Microsoft(R) software product available for free download. See this website for the http://www.microsoft.com/windows/downloads/virtualpc/sysreq.mspx[system requirements]. Once Virtual PC has been installed on Microsoft(R) Windows(R), the user can configure a virtual machine and then install the desired guest operating system. | VMware Fusion for Mac(R) is a commercial software product available for Intel(R) based Apple(R) Mac(R) computers running macOS(R) 10.11 or higher. FreeBSD is a fully supported guest operating system. Once VMware Fusion has been installed on macOS(R), the user can configure a virtual machine and then install the desired guest operating system. | ||||
[[virtualization-guest-virtualpc-install]] | [[virtualization-guest-vmware-install]] | ||||
=== Installing FreeBSD on Virtual PC | === Installing FreeBSD on VMware Fusion | ||||
The first step in installing FreeBSD on Virtual PC is to create a new virtual machine for installing FreeBSD. Select [.guimenuitem]#Create a virtual machine# when prompted: | The first step is to start VMware Fusion which will load the Virtual Machine Library. Click [.guimenuitem]#+->New# to create the virtual machine: | ||||
image::virtualpc-freebsd1.png[] | image::vmware-freebsd01.png[width=35%] | ||||
Done Inline ActionsAre we expecting this to be completed and landed with this review? Otherwise, it might be better to remove this completely and track it by opening another PR in Bugzilla. ygy: Are we expecting this to be completed and landed with this review? Otherwise, it might be… | |||||
Done Inline ActionsI cannot understand what you mean. Do you mean that I should open another PR in Bugzilla to update images? minsoochoo0122_proton.me: I cannot understand what you mean. Do you mean that I should open another PR in Bugzilla to… | |||||
Done Inline ActionsThis review comment seems shifted since you updated the diff. I was commenting about the "TODO"s which you have already removed, so you may mark this comment as done. ygy: This review comment seems shifted since you updated the diff. I was commenting about the… | |||||
image::virtualpc-freebsd2.png[] | This will load the New Virtual Machine Assistant. Choose [.guimenuitem]#Create a custom virtual machine# and click [.guimenuitem]#Continue# to proceed: | ||||
Select [.guimenuitem]#Other# as the [.guimenuitem]#Operating system# when prompted: | image::vmware-freebsd02.png[width=45%] | ||||
image::virtualpc-freebsd3.png[] | Select [.guimenuitem]#Other# as the [.guimenuitem]#Operating System# and either [.guimenuitem]#FreeBSD X# or [.guimenuitem]#FreeBSD X 64-bit#, as the menu:Version[] when prompted: | ||||
Then, choose a reasonable amount of disk and memory depending on the plans for this virtual FreeBSD instance. 4GB of disk space and 512MB of RAM work well for most uses of FreeBSD under Virtual PC: | image::vmware-freebsd03.png[width=45%] | ||||
Done Inline ActionsSame question as above ygy: Same question as above | |||||
image::virtualpc-freebsd4.png[] | Choose the firmware(UEFI is recommended): | ||||
image::virtualpc-freebsd5.png[] | image::vmware-freebsd04.png[width=45%] | ||||
Save and finish the configuration: | Choose [.guimenuitem]#Create a new virtual disk# and click [.guimenuitem]#Continue#: | ||||
image::virtualpc-freebsd6.png[] | image::vmware-freebsd05.png[width=45%] | ||||
Select the FreeBSD virtual machine and click menu:Settings[], then set the type of networking and a network interface: | Check the configuration and click [.guimenuitem]#Finish#: | ||||
image::virtualpc-freebsd7.png[] | image::vmware-freebsd06.png[width=45%] | ||||
image::virtualpc-freebsd8.png[] | |||||
After the FreeBSD virtual machine has been created, FreeBSD can be installed on it. This is best done with an official FreeBSD CD/DVD or with an ISO image downloaded from an official FTP site. Copy the appropriate ISO image to the local Windows(R) filesystem or insert a CD/DVD in the CD drive, then double click on the FreeBSD virtual machine to boot. Then, click menu:CD[] and choose menu:Capture ISO Image...[] on the Virtual PC window. This will bring up a window where the CD-ROM drive in the virtual machine can be associated with an ISO file on disk or with the real CD-ROM drive. | |||||
image::virtualpc-freebsd9.png[] | |||||
image::virtualpc-freebsd10.png[] | |||||
Once this association with the CD-ROM source has been made, reboot the FreeBSD virtual machine by clicking menu:Action[] and menu:Reset[]. Virtual PC will reboot with a special BIOS that first checks for a CD-ROM. | |||||
image::virtualpc-freebsd11.png[] | |||||
In this case it will find the FreeBSD installation media and begin a normal FreeBSD installation. Continue with the installation, but do not attempt to configure Xorg at this time. | |||||
image::virtualpc-freebsd12.png[] | |||||
When the installation is finished, remember to eject the CD/DVD or release the ISO image. Finally, reboot into the newly installed FreeBSD virtual machine. | |||||
image::virtualpc-freebsd13.png[] | |||||
[[virtualization-guest-virtualpc-configure]] | |||||
=== Configuring FreeBSD on Virtual PC | |||||
After FreeBSD has been successfully installed on Microsoft(R) Windows(R) with Virtual PC, there are a number of configuration steps that can be taken to optimize the system for virtualized operation. | |||||
[.procedure] | |||||
. Set Boot Loader Variables | |||||
+ | |||||
The most important step is to reduce the `kern.hz` tunable to reduce the CPU utilization of FreeBSD under the Virtual PC environment. This is accomplished by adding the following line to [.filename]#/boot/loader.conf#: | |||||
+ | |||||
[.programlisting] | |||||
.... | |||||
kern.hz=100 | |||||
.... | |||||
+ | |||||
Without this setting, an idle FreeBSD Virtual PC guest OS will use roughly 40% of the CPU of a single processor computer. After this change, the usage will be closer to 3%. | |||||
. Create a New Kernel Configuration File | |||||
+ | |||||
All of the SCSI, FireWire, and USB device drivers can be removed from a custom kernel configuration file. Virtual PC provides a virtual network adapter used by the man:de[4] driver, so all network devices except for man:de[4] and man:miibus[4] can be removed from the kernel. | |||||
. Configure Networking | |||||
+ | |||||
The most basic networking setup uses DHCP to connect the virtual machine to the same local area network as the Microsoft(R) Windows(R) host. This can be accomplished by adding `ifconfig_de0="DHCP"` to [.filename]#/etc/rc.conf#. More advanced networking setups are described in crossref:advanced-networking[advanced-networking,Advanced Networking]. | |||||
[[virtualization-guest-vmware]] | |||||
== FreeBSD as a Guest on VMware Fusion for Mac OS(R) | |||||
VMware Fusion for Mac(R) is a commercial software product available for Intel(R) based Apple(R) Mac(R) computers running Mac OS(R) 10.4.9 or higher. FreeBSD is a fully supported guest operating system. Once VMware Fusion has been installed on Mac OS(R) X, the user can configure a virtual machine and then install the desired guest operating system. | |||||
[[virtualization-guest-vmware-install]] | |||||
=== Installing FreeBSD on VMware Fusion | |||||
The first step is to start VMware Fusion which will load the Virtual Machine Library. Click [.guimenuitem]#New# to create the virtual machine: | |||||
image::vmware-freebsd01.png[] | |||||
This will load the New Virtual Machine Assistant. Click [.guimenuitem]#Continue# to proceed: | |||||
image::vmware-freebsd02.png[] | |||||
Select [.guimenuitem]#Other# as the [.guimenuitem]#Operating System# and either [.guimenuitem]#FreeBSD# or [.guimenuitem]#FreeBSD 64-bit#, as the menu:Version[] when prompted: | |||||
image::vmware-freebsd03.png[] | |||||
Choose the name of the virtual machine and the directory where it should be saved: | Choose the name of the virtual machine and the directory where it should be saved: | ||||
image::vmware-freebsd04.png[] | image::vmware-freebsd07.png[width=45%] | ||||
Choose the size of the Virtual Hard Disk for the virtual machine: | Press command+E to open virtual machine settings and click [.guimenuitem]#CD/DVD#: | ||||
image::vmware-freebsd05.png[] | image::vmware-freebsd08.png[width=45%] | ||||
Choose the method to install the virtual machine, either from an ISO image or from a CD/DVD: | Choose FreeBSD ISO image or from a CD/DVD: | ||||
Done Inline ActionsThese lines (here and below) seem to miss ":"s at the end ygy: These lines (here and below) seem to miss ":"s at the end | |||||
image::vmware-freebsd06.png[] | image::vmware-freebsd09.png[width=45%] | ||||
Click [.guimenuitem]#Finish# and the virtual machine will boot: | Start the virtual machine: | ||||
image::vmware-freebsd07.png[] | image::vmware-freebsd10.png[width=25%] | ||||
Install FreeBSD as usual: | Install FreeBSD as usual: | ||||
image::vmware-freebsd08.png[] | image::vmware-freebsd11.png[width=25%] | ||||
Once the install is complete, the settings of the virtual machine can be modified, such as memory usage: | Once the install is complete, the settings of the virtual machine can be modified, such as memory usage and the number of CPUs the virtual machine will have access to: | ||||
[NOTE] | [NOTE] | ||||
==== | ==== | ||||
The System Hardware settings of the virtual machine cannot be modified while the virtual machine is running. | The System Hardware settings of the virtual machine cannot be modified while the virtual machine is running. | ||||
==== | ==== | ||||
image::vmware-freebsd09.png[] | image::vmware-freebsd12.png[width=45%] | ||||
The number of CPUs the virtual machine will have access to: | |||||
image::vmware-freebsd10.png[] | |||||
The status of the CD-ROM device. Normally the CD/DVD/ISO is disconnected from the virtual machine when it is no longer needed. | The status of the CD-ROM device. Normally the CD/DVD/ISO is disconnected from the virtual machine when it is no longer needed. | ||||
image::vmware-freebsd11.png[] | image::vmware-freebsd09.png[width=45%] | ||||
The last thing to change is how the virtual machine will connect to the network. To allow connections to the virtual machine from other machines besides the host, choose [.guimenuitem]#Connect directly to the physical network (Bridged)#. Otherwise, [.guimenuitem]#Share the host's internet connection (NAT)# is preferred so that the virtual machine can have access to the Internet, but the network cannot access the virtual machine. | The last thing to change is how the virtual machine will connect to the network. To allow connections to the virtual machine from other machines besides the host, choose [.guimenuitem]#Connect directly to the physical network (Bridged)#. Otherwise, [.guimenuitem]#Share the host's internet connection (NAT)# is preferred so that the virtual machine can have access to the Internet, but the network cannot access the virtual machine. | ||||
image::vmware-freebsd12.png[] | image::vmware-freebsd13.png[width=45%] | ||||
After modifying the settings, boot the newly installed FreeBSD virtual machine. | After modifying the settings, boot the newly installed FreeBSD virtual machine. | ||||
[[virtualization-guest-vmware-configure]] | [[virtualization-guest-vmware-configure]] | ||||
=== Configuring FreeBSD on VMware Fusion | === Configuring FreeBSD on VMware Fusion | ||||
After FreeBSD has been successfully installed on Mac OS(R) X with VMware Fusion, there are a number of configuration steps that can be taken to optimize the system for virtualized operation. | After FreeBSD has been successfully installed on macOS(R) X with VMware Fusion, there are a number of configuration steps that can be taken to optimize the system for virtualized operation. | ||||
[.procedure] | [.procedure] | ||||
. Set Boot Loader Variables | . Set Boot Loader Variables | ||||
+ | + | ||||
The most important step is to reduce the `kern.hz` tunable to reduce the CPU utilization of FreeBSD under the VMware Fusion environment. This is accomplished by adding the following line to [.filename]#/boot/loader.conf#: | The most important step is to reduce the `kern.hz` tunable to reduce the CPU utilization of FreeBSD under the VMware Fusion environment. This is accomplished by adding the following line to [.filename]#/boot/loader.conf#: | ||||
+ | + | ||||
[.programlisting] | [.programlisting] | ||||
.... | .... | ||||
kern.hz=100 | kern.hz=100 | ||||
.... | .... | ||||
+ | + | ||||
Without this setting, an idle FreeBSD VMware Fusion guest will use roughly 15% of the CPU of a single processor iMac(R). After this change, the usage will be closer to 5%. | Without this setting, an idle FreeBSD VMware Fusion guest will use roughly 15% of the CPU of a single processor iMac(R). After this change, the usage will be closer to 5%. | ||||
. Create a New Kernel Configuration File | . Create a New Kernel Configuration File | ||||
+ | + | ||||
All of the FireWire, and USB device drivers can be removed from a custom kernel configuration file. VMware Fusion provides a virtual network adapter used by the man:em[4] driver, so all network devices except for man:em[4] can be removed from the kernel. | All of the FireWire, and USB device drivers can be removed from a custom kernel configuration file. VMware Fusion provides a virtual network adapter used by the man:em[4] driver, so all network devices except for man:em[4] can be removed from the kernel. | ||||
. Configure Networking | . Configure Networking | ||||
+ | + | ||||
The most basic networking setup uses DHCP to connect the virtual machine to the same local area network as the host Mac(R). This can be accomplished by adding `ifconfig_em0="DHCP"` to [.filename]#/etc/rc.conf#. More advanced networking setups are described in crossref:advanced-networking[advanced-networking,Advanced Networking]. | The most basic networking setup uses DHCP to connect the virtual machine to the same local area network as the host Mac(R). This can be accomplished by adding `ifconfig_em0="DHCP"` to [.filename]#/etc/rc.conf#. More advanced networking setups are described in crossref:advanced-networking[advanced-networking,Advanced Networking]. | ||||
. Install drivers and open-vm-tools | |||||
+ | |||||
To run FreeBSD smoothly on VMWare, drivers should be installed: | |||||
+ | |||||
[source,shell] | |||||
.... | |||||
# pkg install xf86-video-vmware xf86-input-vmmouse open-vm-tools | |||||
.... | |||||
[[virtualization-guest-virtualbox]] | [[virtualization-guest-virtualbox]] | ||||
== FreeBSD as a Guest on VirtualBox(TM) | == FreeBSD as a Guest on VirtualBox(TM) | ||||
FreeBSD works well as a guest in VirtualBox(TM). The virtualization software is available for most common operating systems, including FreeBSD itself. | FreeBSD works well as a guest in VirtualBox(TM). The virtualization software is available for most common operating systems, including FreeBSD itself. | ||||
The VirtualBox(TM) guest additions provide support for: | The VirtualBox(TM) guest additions provide support for: | ||||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | |||||
[source,shell] | [source,shell] | ||||
.... | .... | ||||
# mount_vboxvfs -w myshare /mnt | # mount_vboxvfs -w myshare /mnt | ||||
.... | .... | ||||
[[virtualization-host-virtualbox]] | [[virtualization-host-virtualbox]] | ||||
== FreeBSD as a Host with VirtualBox(TM) | == FreeBSD as a Host with VirtualBox(TM) | ||||
VirtualBox(TM) is an actively developed, complete virtualization package, that is available for most operating systems including Windows(R), Mac OS(R), Linux(R) and FreeBSD. It is equally capable of running Windows(R) or UNIX(R)-like guests. It is released as open source software, but with closed-source components available in a separate extension pack. These components include support for USB 2.0 devices. More information may be found on the http://www.virtualbox.org/wiki/Downloads[Downloads page of the VirtualBox(TM) wiki]. Currently, these extensions are not available for FreeBSD. | VirtualBox(TM) is an actively developed, complete virtualization package, that is available for most operating systems including Windows(R), macOS(R), Linux(R) and FreeBSD. It is equally capable of running Windows(R) or UNIX(R)-like guests. It is released as open source software, but with closed-source components available in a separate extension pack. These components include support for USB 2.0 devices. More information may be found on the http://www.virtualbox.org/wiki/Downloads[Downloads page of the VirtualBox(TM) wiki]. Currently, these extensions are not available for FreeBSD. | ||||
[[virtualization-virtualbox-install]] | [[virtualization-virtualbox-install]] | ||||
=== Installing VirtualBox(TM) | === Installing VirtualBox(TM) | ||||
VirtualBox(TM) is available as a FreeBSD package or port in package:emulators/virtualbox-ose[]. The port can be installed using these commands: | VirtualBox(TM) is available as a FreeBSD package or port in package:emulators/virtualbox-ose[]. The port can be installed using these commands: | ||||
[source,shell] | [source,shell] | ||||
.... | .... | ||||
▲ Show 20 Lines • Show All 646 Lines • Show Last 20 Lines |
s/as on/on/
s/follwing/the following/
s/programs./platforms:/