FreeBSD Guest Notes: Difference between revisions
Jump to navigation
Jump to search
Line 15: | Line 15: | ||
==Install FreeBSD== | ==Install FreeBSD== | ||
* Power on the VM. | * Power on the VM. | ||
* It should boot to the FreeBSD 9. | * It should boot to the FreeBSD 9.1-RELEASE-amd64 DVD ISO. | ||
* System Components: Add "src". | * System Components: Add "src". | ||
* Disks: Guided, use entire disk. | * Disks: Guided, use entire disk. | ||
* Network: Use ipv4 only (unless you also use ipv6). | * Network: Use ipv4 only (unless you also use ipv6). | ||
* Services: Add ntpd. | * Services: Add ntpd. | ||
* This should leave you with FreeBSD 9 installed on the 32GB primary drive. | * This should leave you with FreeBSD 9.1-RELEASE installed on the 32GB primary drive. | ||
* Shut down the VM after installation. | * Shut down the VM after installation. | ||
* Remove the ISO from the VM's optical drive (set to empty). | * Remove the ISO from the VM's optical drive (set to empty). | ||
* Verify the VM's boot order is set to the primary hard disk first. | * Verify the VM's boot order is set to the primary hard disk first. | ||
==First Boot== | ==First Boot== | ||
* Power on the VM and log in. | * Power on the VM and log in. |
Revision as of 01:15, 16 July 2013
Tweaks and tips for better performance with FreeBSD on KVM.
- Note: This has been tested with FreeBSD 9.0-RELEASE and 9.1-RELEASE (and patch levels). Some steps have been removed as they have been deprecated in newer FreeBSD versions.
Create VM
- Download the FreeBSD 9.1-RELEASE-amd64 DVD ISO (from here) and transfer it to your VM server.
- Create a new VM:
- CPU: dual-socket or dual-core
- IMPORTANT: As of current PVE releases, you may need to set your CPU to qemu64 rather than kvm64 for FreeBSD to be able to boot.
- RAM: 2GB (minimum)
- Network: Intel e1000 (bridged)
- Create a 32GB primary disk (scsi, qcow2)
- Add FreeBSD 9.1-RELEASE-amd64 DVD ISO as an optical drive (scsi).
- CPU: dual-socket or dual-core
Install FreeBSD
- Power on the VM.
- It should boot to the FreeBSD 9.1-RELEASE-amd64 DVD ISO.
- System Components: Add "src".
- Disks: Guided, use entire disk.
- Network: Use ipv4 only (unless you also use ipv6).
- Services: Add ntpd.
- This should leave you with FreeBSD 9.1-RELEASE installed on the 32GB primary drive.
- Shut down the VM after installation.
- Remove the ISO from the VM's optical drive (set to empty).
- Verify the VM's boot order is set to the primary hard disk first.
First Boot
- Power on the VM and log in.
- Set the time:
ntpdate -s pool.ntp.org
- Update the system:
freebsd-update fetch freebsd-update install
- Reboot
Update Ports Tree
Updating your ports tree will ensure that any ports you attempt to install will have the latest patches and download URLs.
- Update the ports tree using portsnap:
portsnap fetch portsnap extract
- After the first run of portsnap, you can use the following command to perform later updates:
portsnap fetch update
Enable Virtio
- Install virtio-kmod:
cd /usr/ports/emulators/virtio-kmod && make clean install
- When prompted on each required package, accept defaults and OK.
- Add the following to
/boot/loader.conf
:- Note: You may have to create this file.
virtio_load="YES" virtio_pci_load="YES" virtio_blk_load="YES" if_vtnet_load="YES" virtio_balloon_load="YES"
- Enable virtio for disk by changing your
/etc/fstab
entries to use the vtbd prefix. Example:
# Device Mountpoint FStype Options Dump Pass# /dev/vtbd0p2 / ufs rw 1 1 /dev/vtbd0p3 none swap sw 0 0
- Enable virtio for network by changing the
ifconfig_em0="DHCP"
line in/etc/rc.conf
to:
ifconfig_vtnet0="DHCP"
- Shutdown the VM
shutdown -p now
- Change VM's network and disk hardware to use virtio.
- Power on the VM.
- Verify that virtio is loading:
kldstat Id Refs Address Size Name 1 12 0xffffffff80200000 11cdab0 kernel 2 5 0xffffffff813ce000 4ca0 virtio.ko 3 1 0xffffffff813d3000 5880 virtio_pci.ko 4 1 0xffffffff813d9000 5010 virtio_blk.ko 5 1 0xffffffff813df000 aeb0 if_vtnet.ko 6 1 0xffffffff813ea000 3210 virtio_balloon.ko
Update Installed Ports
It is a good idea to keep your installed ports up to date. This section shows you how to do so.
- IMPORTANT: It is recommended practice to understand how port updates will impact your system. Some port updates can change the way the program works and can break the function of your machine. It is wise to do a full backup of your VM before updating installed ports.
- Install portmaster:
cd /usr/ports/ports-mgmt/portmaster && make clean install
- Run portmaster:
- Note: This step actually updates the installed ports on your system to their current versions. If you run into any errors, you will need to correct them and re-run portmaster to pick up where it left off.
portmaster -a
External Links
- How to upgrade FreeBSD 8.2 to FreeBSD 9.0 with Virtio - contains useful information on setting up virtio on freebsd 9.
- FreshPorts virtio-kmod page.
- FreeBSD Handbook - Portsnap: a Ports Collection Update Tool
- freebsd.org - Port description for ports-mgmt/portmaster