Difference between revisions of "Vnx-rootfsfreebsd"
Line 3: | Line 3: | ||
<ul> | <ul> | ||
<li>Create the filesystem disk image:</li> | <li>Create the filesystem disk image:</li> | ||
− | qemu-img create -f qcow2 | + | qemu-img create -f qcow2 vnx_rootfs_freebsd-base.qcow2 5GB |
<li>Get FreeBSD installation CD. For example:</li> | <li>Get FreeBSD installation CD. For example:</li> | ||
wget ftp://ftp.rediris.es/mirror/FreeBSD/ISO-IMAGES-i386/8.2/FreeBSD-8.2-RELEASE-i386-disc1.iso | wget ftp://ftp.rediris.es/mirror/FreeBSD/ISO-IMAGES-i386/8.2/FreeBSD-8.2-RELEASE-i386-disc1.iso | ||
cp FreeBSD-8.2-RELEASE-i386-disc1.iso /almacen/iso | cp FreeBSD-8.2-RELEASE-i386-disc1.iso /almacen/iso | ||
− | <li>Create a libvirt XML definition ( | + | <li>Create a libvirt XML definition (rootfs_freebsd.xml) containing the virtual machine description:</li> |
<pre> | <pre> | ||
<domain type='kvm'> | <domain type='kvm'> | ||
Line 27: | Line 27: | ||
<emulator>/usr/bin/kvm</emulator> | <emulator>/usr/bin/kvm</emulator> | ||
<disk type='file' device='disk'> | <disk type='file' device='disk'> | ||
− | <source file='/usr/share/vnx/filesystems/ | + | <source file='/usr/share/vnx/filesystems/vnx_rootfs_freebsd-base.qcow2'/> |
<target dev='hda'/> | <target dev='hda'/> | ||
<driver name="qemu" type="qcow2"/> | <driver name="qemu" type="qcow2"/> | ||
Line 51: | Line 51: | ||
<li>Start the virtual machine with:</li> | <li>Start the virtual machine with:</li> | ||
− | virsh create | + | virsh create rootfs_freebsd.xml |
<li>Access virtual machine console with:</li> | <li>Access virtual machine console with:</li> | ||
virt-viewer Freebsd | virt-viewer Freebsd | ||
<li>Follow FreeBSD installation menus to install a basic system with DHCP configured in the network interface and a user named "vnx".</li> | <li>Follow FreeBSD installation menus to install a basic system with DHCP configured in the network interface and a user named "vnx".</li> | ||
− | <li>Once the installation is finished, stop the machine and edit | + | <li>Once the installation is finished, stop the machine and edit rootfs_freebsd.xml file and comment the following line in cdrom disk specification: |
<pre> | <pre> | ||
<!--source file='/almacen/iso/FreeBSD-8.1-RELEASE-i386-disc1.iso'/--> | <!--source file='/almacen/iso/FreeBSD-8.1-RELEASE-i386-disc1.iso'/--> | ||
Line 113: | Line 113: | ||
http://www.freebsd.org/gnome/docs/faq2.html#q23 | http://www.freebsd.org/gnome/docs/faq2.html#q23 | ||
− | <li>Create a file /etc/ | + | <li>Create a file /etc/vnx_rootfs_version to store version number and informacion about modification:</li> |
<pre> | <pre> | ||
VER=v0.21 | VER=v0.21 | ||
Line 128: | Line 128: | ||
rm -f /root/.bash_history | rm -f /root/.bash_history | ||
while true; do | while true; do | ||
− | # Ask for a message to save in /etc/ | + | # Ask for a message to save in /etc/vnx_rootfs_version file |
− | echo "** Save a log message in /etc/ | + | echo "** Save a log message in /etc/vnx_rootfs_version file " |
echo -n "** describing the modifications done? " | echo -n "** describing the modifications done? " | ||
read -n 1 -p "[y/n] " answer | read -n 1 -p "[y/n] " answer | ||
Line 138: | Line 138: | ||
read logmsg | read logmsg | ||
DATE=`date` | DATE=`date` | ||
− | echo "MODDATE=$DATE" >> /etc/ | + | echo "MODDATE=$DATE" >> /etc/vnx_rootfs_version |
− | echo "MODDESC=$logmsg" >> /etc/ | + | echo "MODDESC=$logmsg" >> /etc/vnx_rootfs_version |
break;; | break;; | ||
[Nn]* ) break;; | [Nn]* ) break;; | ||
Line 184: | Line 184: | ||
<!--source file='/almacen/iso/FreeBSD-8.1-RELEASE-i386-disc1.iso'/--> | <!--source file='/almacen/iso/FreeBSD-8.1-RELEASE-i386-disc1.iso'/--> | ||
* Start the virtual machine (directly using virsh or the vnx_modify_rootfs utility): | * Start the virtual machine (directly using virsh or the vnx_modify_rootfs utility): | ||
− | /usr/share/vnx/bin/vnx_modify_rootfs | + | /usr/share/vnx/bin/vnx_modify_rootfs rootfs_freebsd.xml |
* Execute the update utility: | * Execute the update utility: | ||
/usr/share/vnx/bin/vnx_update_aced Freebsd /usr/share/vnx/aced/vnx-aced-lf-0.1b.tgz | /usr/share/vnx/bin/vnx_update_aced Freebsd /usr/share/vnx/aced/vnx-aced-lf-0.1b.tgz | ||
* Once the ace daemon is updated the virtual machine will be rebooted automatically. | * Once the ace daemon is updated the virtual machine will be rebooted automatically. |
Revision as of 13:42, 27 July 2011
How to create a Freebsd root-file-system for VNX
- Create the filesystem disk image:
qemu-img create -f qcow2 vnx_rootfs_freebsd-base.qcow2 5GB
wget ftp://ftp.rediris.es/mirror/FreeBSD/ISO-IMAGES-i386/8.2/FreeBSD-8.2-RELEASE-i386-disc1.iso cp FreeBSD-8.2-RELEASE-i386-disc1.iso /almacen/iso
<domain type='kvm'> <name>Freebsd</name> <memory>524288</memory> <vcpu>1</vcpu> <os> <type arch="i686">hvm</type> <boot dev='hd'/> <boot dev='cdrom'/> </os> <features> <pae/> <acpi/> <apic/> </features> <clock sync="localtime"/> <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> <source file='/usr/share/vnx/filesystems/vnx_rootfs_freebsd-base.qcow2'/> <target dev='hda'/> <driver name="qemu" type="qcow2"/> </disk> <disk type='file' device='cdrom'> <source file='/almacen/iso/FreeBSD-8.2-RELEASE-i386-disc1.iso'/> <target dev='hdb'/> </disk> <interface type='network'> <source network='default'/> </interface> <serial type="pty"> <target port="1"/> </serial> <console type="pty"> <target port="1"/> </console> <graphics type='vnc'/> </devices> </domain>
Note: change "source file=" lines to whatever fits your case (use full paths).
virsh create rootfs_freebsd.xml
virt-viewer Freebsd
<!--source file='/almacen/iso/FreeBSD-8.1-RELEASE-i386-disc1.iso'/-->
- Install bash and change package repository:
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
pkg_add -r perl p5-libxml-enno
ifconfig_re0="DHCP"
- From the host execute:
/usr/share/vnx/bin/vnx_update_aced Freebsd /usr/share/vnx/aced/vnx-aced-lf-0.1b.tgz
mount /cdrom /cdrom/install_vnxdaemon
ttyu0 "/usr/libexec/getty std.9600" dialup off secure
by:
ttyu0 "/usr/libexec/getty std.9600" vt100 on secure
echo "-Dh" > /boot.config echo 'boot_multicons="YES"' >> /boot/loader.conf echo 'boot_serial="YES"' >> /boot/loader.conf echo 'console="comconsole,vidconsole"' >> /boot/loader.conf
PermitRootLogin yes
export LANG=es_ES.UTF-8 export LC_ALL=es_ES.UTF-8
- Install packages needed:
pkg_add -r xorg-minimal gnome2-lite gdm detach xeyes xhost wmctrl
gnome_enable="YES"
proc /proc procfs rw 0 0
autoboot_delay="3"
pw usermod vnx -G wheel
http://www.freebsd.org/gnome/docs/faq2.html#q23
VER=v0.21 OS=FreeBSD 8.2 DESC=Basic FreeBSD 8.2 root filesystem without GUI
#!/usr/local/bin/bash # Delete /etc/resolv.conf rm -f /etc/resolv.conf # Clean command history rm -f /root/.bash_history while true; do # Ask for a message to save in /etc/vnx_rootfs_version file echo "** Save a log message in /etc/vnx_rootfs_version file " echo -n "** describing the modifications done? " read -n 1 -p "[y/n] " answer echo "" case $answer in [Yy]* ) echo "** Log message (1 line maximum):" read logmsg DATE=`date` echo "MODDATE=$DATE" >> /etc/vnx_rootfs_version echo "MODDESC=$logmsg" >> /etc/vnx_rootfs_version break;; [Nn]* ) break;; * ) echo "** Error: please answer 'y' or 'n'.";; esac done # Halt the system halt -p
chmod +x /usr/local/bin/vnx_halt
vnx_halt
If everything went well, your root filesystem will be ready to be used with VNX. You can make a simple test using the simple_freebsd.xml scenario distributed with VNX.
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:
- Configure network interface with:
dhclient re0
pkg_add -r apache22
halt -p
Updating ACE daemon
If you have a root filesystem with the autoconfiguration and command execution daemon (ACE) already installed, you can use the autoupdate functionallity to update the daemon to a newer version. Just follow this procedure:
- Edit the xml described above and comment the line defining the Freebsd iso file for the cdrom:
- Start the virtual machine (directly using virsh or the vnx_modify_rootfs utility):
/usr/share/vnx/bin/vnx_modify_rootfs rootfs_freebsd.xml
- Execute the update utility:
/usr/share/vnx/bin/vnx_update_aced Freebsd /usr/share/vnx/aced/vnx-aced-lf-0.1b.tgz
- Once the ace daemon is updated the virtual machine will be rebooted automatically.