Install FreeBSD 8.1 as a Virtual Machine in KVM on Ubuntu 10.10

Install KVM and libvirt:

sudo apt-get install kvm virtinst libvirt-bin

If you also want the graphical helpers (viewer via vnc and a manager of the installed virtual machines) install:

sudo apt-get install virt-viewer virt-manager

Now set up the connection to the local KVM hypervisor:

sudo virsh connect qemu:///system

Get the installation DVD (for amd64):

sudo mkdir -p /var/kvm/cd-images
sudo mkdir -p /var/kvm/installation-disks
cd /kvm/cd-images
wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/ISO-IMAGES/8.1/FreeBSD-8.1-RELEASE-amd64-dvd1.iso.gz
gunzip FreeBSD-8.1-RELEASE-amd64-dvd1.iso.gz

You can use the graphical user interface virt-manager to set up the system or do it on the command line:

sudo virt-install \
--name freebsd \
--ram 512 \
--vcpus=1 \
--os-type unix \
--hvm \
--cdrom=/var/kvm/cd-images/FreeBSD-8.1-RELEASE-amd64-dvd1.iso \
--network=bridge:br0,model=ne2k_pci,mac=00:00:00:00:00:07 \
--vnc \
--disk path=/var/kvm/installation-disks/freebsd8.1.img,size=12

Explanation of the parameters:

  • --name sets the name for the virtual machine
  • --ram specifies how much ram you want to assign to the new virtual machine
  • --vcpus sets the number of available virtual cpu cores
  • --os-type specifies the type of guest os for the new vm (freebsd is a unix)
  • --hvm tells libvirt (virsh) to create the vm with software virtualization
  • --cdrom specifies the ISO image to install from
  • --network
    The network is set up using the bridge br0. The virtual network interface is set to the model ne2k_pci which is OK for FreeBSD (for a list of all supported models runqemu -net nic,model=? /dev/null)
  • --vnc will make the virtual machine start a vnc server to access its display using virt-viewer -n vmname
  • --disk is the specifiaction of the hard disk image file to install to (size=12 lets the command create a 12 GiB image)

Now continue the installation on the VNC viewer using virt-viewer -n freebsd.

Start the virtual machine using:

sudo virsh start freebsd

If it does not shut down properly itself (and it doesn’t at this time due to a bug in seabios, see this ), you might have to force a shutdown (“cut power”):

sudo virsh destroy freebsd

If you are annoyed by virt-viewer capturing (and not releasing) your mouse pointer, then you might want to connect using a virtual terminal. To set it up, execute the following commands on the FreeBSD host as described in the manual:

echo 'console="comconsole"' >> /boot/loader.conf

And then change in /etc/ttys the line ttyu0 "/usr/libexec/getty std.9600" dialup off secure to ttyu0 "/usr/libexec/getty std.9600" vt100 on secure.

To list all virtual machines:

virsh list --all
## or
sudo virsh --connect qemu:///system list --all
Advertisements

Setting up a PPTP VPN Server in FreeBSD

Setting up a PPTP VPN Server in FreeBSD

If you want to run a PPTP (Point to Point Tunneling Protocol) server on FreeBSD, there are a couple of solutions available. The option discussed here is using the MPD port for just such a service. The current version of MPD we use here at Section6 is 3.8. This of course may vary as to the date of your ports tree.

Continue reading

Postfix and Google’s SMTP Server

The above sources will give you a detailed description of what you need to do (including creating a certificate, in case you don’t have one already), I’m just going to list the essential parts here. As a prerequisite, you need a Gmail account, as Google’s SMTP server requires you to authorize before allowing you to relay anything.

Continue reading

Running MediaWiki on FreeBSD

This installation guide assumes you are installing on the local machine (localhost) and that you are logged in as the superuser (root). Also, these instructions have been tested to work with FreeBSD 8.0+, PHP 5.2/5.3, MySQL 5.0/5.1, Apache 2.2, and MediaWiki 1.13 (or later). Other software versions might require slightly different steps. Instructions for older versions of FreeBSD are below.

Continue reading