歡迎您光臨本站 註冊首頁

通過Cobbler實現自動化安裝FreeBSD

←手機掃碼閱讀     火星人 @ 2014-03-03 , reply:0

通過Cobbler實現自動化安裝FreeBSD

1. 掛載FreeBSD鏡像mount -t iso9660 -o loop FreeBSD-8.3-RELEASE-amd64-disc1.iso  /mnt2. 導入鏡像文件到Cobblercobbler import --name=FreeBSD-8.3 --arch=x86_64 --path=/mnt
我們在導入過程中可能會提示TASK FAILEDhttp://www.xiaoyinzei.com/wp-content/uploads/2012/09/import_freebsd_error.jpg

可以忽略

3. 修改loader.confecho 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.conf4. 掛載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 /mnt5. 建立自動安裝配置文件install.cfgcd /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
EOF6. 將install.cfg合併到mfsrootcd ~
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 start8. 更改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;

ignore client-updates;
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                   "/images/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";
        #end if
        #if $iface.netmask:
        option subnet-mask $iface.netmask;
        #end if
        #if $iface.gateway:
        option routers $iface.gateway;
        #end if
        #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";
        #end if
        ## 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 for9. 同步Cobbler配置cobbler sync現在就可以通過網路自動安裝FreeBSD系統了
《解決方案》

支持一下,很不錯的分享

[火星人 ] 通過Cobbler實現自動化安裝FreeBSD已經有638次圍觀

http://coctec.com/docs/service/show-post-589.html