1. 挂載freebsd鏡像
mount -t iso9660 -o loop freebsd-8.3-release-amd64-disc1.iso /mnt
2. 導入鏡像檔案到cobbler
cobbler import --name=freebsd-8.3 --arch=x86_64 --path=/mnt
我們在導入過程中可能會提示task failed

可以忽略
3. 修改loader.conf
echo vfs.root.mountfrom=\"ufs:/dev/md0\" >> /var/www/cobbler/ks_mirror/freebsd-8.3-x86_64/boot/loader.conf
echo vfs.root.mountfrom.options=\"rw\" >> /var/www/cobbler/ks_mirror/freebsd-8.3-x86_64/boot/loader.conf
4. 挂載mfsroot.gz
将/var/www/cobbler/ks_mirror/freebsd-8.3-x86_64/boot/mfsroot.gz拷貝到一台freebsd機器上後,執行如下指令
gzip -d mfsroot.gz
mdconfig -atvnode -f mfsroot
mount /dev/md0 /mnt
5. 建立自動安裝配置檔案install.cfg
cd /mnt
cat > install.cfg < < eof
debug=yes
noninteractive=yes
noconfirm=yes
nowarn=yes
disk=mfid0
partition=all
bootmanager=standard
diskpartitioneditor
mfid0s1-1=ufs 0 /
disklabeleditor
trydhcp=yes
netdev=bce0
hostname=tfreebsd
distsetminimum
nfs=1.1.1.1:/var/www/cobbler/ks_mirror/freebsd-8.3-x86_64
mediasetnfs
installcommit
shutdown
eof
6. 将install.cfg合并到mfsroot
cd ~
umount /mnt
mdconfig -d -u0
gzip mfsroot
再通過網絡傳輸到cobbler伺服器覆寫原/var/www/cobbler/ks_mirror/freebsd-8.3-x86_64/boot/目錄下的mfsroot.gz檔案
7. 安裝配置nfs伺服器
# 預設freebsd的網絡引導程式pxeboot隻支援nfs,如果想支援tftp需要自行重新編譯這個程式
yum install -y nfs-utils
echo "/var/www/cobbler/ks_mirror/freebsd-8.3-x86_64 *(ro,root_squash)" > /etc/exports
/etc/init.d/rpcbind start
/etc/init.d/nfs start
8. 更改cobbler的dhcp模闆檔案dhcp.template
# ******************************************************************
# cobbler managed dhcpd.conf file
#
# generated from cobbler dhcp.conf template ($date)
# do not make changes to /etc/dhcpd.conf. instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
ddns-update-style interim;
ignore client-updates;
deny unknown-clients;
allow booting;
allow bootp;
set vendorclass = option vendor-class-identifier;
subnet 192.168.2.0 netmask 255.255.255.0 {
option routers 192.168.2.1;
option domain-name-servers 192.168.2.12;
option subnet-mask 255.255.255.0;
# range dynamic-bootp 192.168.2.235 192.168.2.236;
# filename "/pxelinux.0";
filename "/p_w_picpaths/freebsd-8.3-x86_64/pxeboot";
option root-path "192.168.2.134:/var/www/cobbler/ks_mirror/freebsd-8.3-x86_64";
default-lease-time 21600;
max-lease-time 43200;
group pxe {
next-server 192.168.2.134;
host test{
hardware ethernet 11:11:11:11:11:11;
fixed-address 192.168.2.235;
}
}
}
#for dhcp_tag in $dhcp_tags.keys():
## group could be subnet if your dhcp tags line up with your subnets
## or really any valid dhcpd.conf construct ... if you only use the
## default dhcp tag in cobbler, the group block can be deleted for a
## flat configuration
# group for cobbler dhcp tag: $dhcp_tag
group {
#for mac in $dhcp_tags[$dhcp_tag].keys():
#set iface = $dhcp_tags[$dhcp_tag][$mac]
host $iface.name {
hardware ethernet $mac;
#if $iface.ip_address:
fixed-address $iface.ip_address;
#end if
#if $iface.hostname:
option host-name "$iface.hostname";
#if $iface.netmask:
option subnet-mask $iface.netmask;
#if $iface.gateway:
option routers $iface.gateway;
#if $iface.enable_gpxe:
if exists user-class and option user-class = "gpxe" {
filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner";
} else {
filename "undionly.kpxe";
}
#else
filename "$iface.filename";
## cobbler defaults to $next_server, but some users
## may like to use $iface.system.server for proxied setups
next-server $next_server;
## next-server $iface.next_server;
}
#end for
#end for
9. 同步cobbler配置
cobbler sync