Vnx-rootfsfreebsd

 Create the filesystem disk image: qemu-img create -f qcow2 root_fs_freebsd-base.qcow2 5GB Get FreeBSD installation CD. For example: wget ftp://ftp.rediris.es/mirror/FreeBSD/ISO-IMAGES-i386/8.1/FreeBSD-8.1-RELEASE-i386-disc1.iso cp FreeBSD-8.1-RELEASE-i386-disc1.iso /almacen/iso Create a libvirt XML definition (root_fs_freebsd.xml) containing the virtual machine description:  Freebsd 524288  1    hvm    /usr/bin/kvm     <source file='/almacen/iso/FreeBSD-8.1-RELEASE-i386-disc1.iso'/> <target dev='hdb'/> <interface type='network'> <source network='default'/> <graphics type='vnc'/> Note: change "source file=" lines to whatever fits your case (use full paths).

Start the virtual machine with:</li> virsh create root_fs_freebsd.xml Access virtual machine console with:</li> virt-viewer freebsd Follow FreeBSD installation menus to install a basic system with DHCP configured in the network interface, a user named "vnx", and after that:</li> <ul> Install VNX autoconfiguration daemon to:</li> /usr/sbin/vnxdaemon.pl chown root:wheel /usr/sbin/vnxdaemon.pl chmod 555 /usr/sbin/vnxdaemon.pl /etc/rc.d/vnxdaemon chown root:wheel /etc/rc.d/vnxdaemon chmod 555 /etc/rc.d/vnxdaemon Install bash and change package repository:</li> pkg_add -r bash pw usermod root -s /usr/local/bin/bash pw usermod vnx -s /usr/local/bin/bash echo "export PACKAGEROOT=ftp://ftp.es.freebsd.org" > ~/.bash_profile Install perl and XML::DOM library:</li> pkg_add -r perl p5-libxml-enno Disable DHCP on network interface by editing the /etc/rc.conf file and commenting the following line:</li> ifconfig_re0="DHCP" Optional: allow root login thorugh ssh by editing /etc/ssh/sshd_config file:</li> PermitRootLogin yes Optional: set locales according to your preferences in /etc/profile:</li> export LANG=es_ES.UTF-8 export LC_ALL=es_ES.UTF-8 Optional: add gnome window manager with:</li> <ul> Install packages needed:</li> pkg_add -r xorg-minimal gnome2-lite gdm Add the following line to /etc/rc.conf:</li> gname_enable="YES" Add the following line to /etc/fstab:</li> proc   /proc   procfs  rw      0       0 Disable the screensaver and change keyboard configuration in "System->Keyboard" menu.</li> </ul> Optional: reduce the boot timeout from 10 seconds to, for example, 3 seconds. Edit /boot/loader.conf and add:</li> autoboot_delay="3" Optional: give vnx user (or whatever one you have created during installation) permissions tu su root:</li> pw usermod vnx -G wheel <li>Optional: if you have installed gnome, you can add automatic login following the instructions in:</li> http://www.freebsd.org/gnome/docs/faq2.html#q23 <li>Stop the machine with:</li> halt -p </ul> </ul>

Note: after installing gnome, you probaly will get the following error message on the console: acd0: FAILURE - unknown CMD (0x03) ILLEGAL REQUEST asc=0x20 ascq=0x00 To eliminate them you can execute: hal-disable-polling --device /dev/acd0

Installing additional software
To install additional software or modify your root file system, you just have to start it as described above and: <ul> <li>Configure network interface with:</li> dhclient re0 <li>Install new packages using "pkg_add -r ..." commands or using "sysinstall" utility. For example, to install apache web server:</li> pkg_add -r apache22 <li>Stop de virtual machine with:</li> halt -p </ul>