一、安裝環境
centos 5.4
關掉iptables 關掉 selinux selinux 導致tftp的目錄無法訪問 pxe停止在引導介面
二、cobbler使用目錄及檔案
cobbler相關配置檔案 /etc/cobbler
cobbler資料儲存目錄 /var/www/cobbler
dhcp配置檔案 /etc/dhcpd.conf
dhcp租期快取檔案 /var/lib/dhcpd/dhcpd.leases
pxe配置檔案 /tftpboot/pxelinux.cfg/default
三、安裝cobbler
# rpm -ivh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# yum -y install tftp-server httpd dhcp yum-utils
# yum -y install cobbler
# yum -y install cman
yum-utils 編譯安裝 make && make install
四、修改配置檔案
1.修改cobbler配置檔案
# vi /etc/cobbler/settings
[code]
server: `192.168.1.3` #cobbler伺服器地址
next_server: `192.168.1.3`
manage_dhcp: 1
[/code]
2.更改tftp啟動方式
# vi /etc/xinetd.d/tftp
[code]
disable = no #預設開啟tftp
[/code]
3.編輯dhcp配置模板
# vi /etc/cobbler/dhcp.template 改為相應的網段和ip
subnet 192.168.2.0 netmask 255.255.255.0 {
option routers 192.168.2.5;
option domain-name-servers 192.168.2.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.2.100 192.168.2.254;
filename “/pxelinux.0”;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}
五、匯入CentOS 光碟映像檔案
# mkdir /home/CentOS
# mount /home/src/CentOS-5.4-x86_64-bin-DVD.iso /home/CentOS/ -o loop
#cobbler import –path=/home/CentOS –name=CentOS5.4_x86_64
# cobbler sync 應用配置模板
六、cobbler check 根據提示解決問題
例如:
#2: Must enable selinux boolean to enable Apache and web services components, run: setsebool -P httpd_can_network_connect true
Nice to see that it has good instructions for selinux
#3: you need to set some SELinux content rules to ensure cobbler works correctly in your SELinux environment, run the following: /usr/sbin/semanage fcontext -a -t public_content_t “/var/lib/tftpboot/.*” && /usr/sbin/semanage fcontext -a -t public_content_t “/var/www/cobbler/p_w_picpaths/.*”
Detailed command to enable http server to reed content from /var/www/cobbler and have tfpboot find its files
#4: service cobblerd is not running
Obviously this isn`t running because we did not start it yet
#5: change `disable` to `no` in /etc/xinetd.d/tftp
#6: service httpd is not running
#7: since iptables may be running, ensure 69 (dhcp), 80(http), 25150(cobbler api), and 25151(cobbler api R/W) are unblocked 關閉防火牆
#8: reposync is not installed, need for cobbler reposync, install/upgrade yum-utils?
Easy to solve with: yum install yum-utils
#9: yumdownloader is not installed, needed for cobbler repo add with –rpm-list parameter, install/upgrade yum-utils? 安裝yum-utils
#10: fencing tools were not found, and are required to use the (optional) power management features. install cman to use them 安裝cman
七、啟動cobbler服務
service dhcpd start
service httpd start
service xinetd restart
service cobbler start
八、kickstart配置檔案例項
# vi /etc/cobbler/sample.ks
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth –useshadow –enablemd5
# System bootloader configuration
bootloader –location=mbr
# Partition clearing information
clearpart –all –initlabel
# Use text mode install
text
# Firewall configuration
firewall –disable
# Run the Setup Agent on first boot
firstboot –enabled
# System keyboard
keyboard us
# System language
lang en_US
# Use network installation
url –url=$tree
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza
# Network information
network –bootproto=dhcp –device=eth0 –onboot=on
# Reboot after installation
reboot
#Root password
rootpw –iscrypted $1$65XOJkdK$SA2J.kVLiTZ6V1GAhFl/Z1
# SELinux configuration
selinux –disabled
# Do not configure the X Window System
skipx
# System timezone
timezone Asia/Shanghai
# Install OS instead of upgrade
install
# Clear the Master Boot Record
zerombr
# Magically figure out how to partition this thing
#SNIPPET::main_partition_select
part / –asprimary –bytes-per-inode=4096 –fstype=”ext3″ –grow –size=1
part swap –asprimary –bytes-per-inode=4096 –fstype=”swap” –size=2048
part /boot –asprimary –bytes-per-inode=4096 –fstype=”ext3″ –size=100
%pre
$kickstart_start
#SNIPPET::pre_partition_select
%packages
@server-cfg
@development-tools
@base
@development-libs
@system-tools
@admin-tools
certmaster
func
%post
chkconfig NetworkManager off
chkconfig NetworkManagerDispatcher off
chkconfig acpid off
chkconfig anacron off
chkconfig atd off
chkconfig autofs off
chkconfig avahi-daemon off
chkconfig avahi-dnsconfd off
chkconfig bluetooth off
chkconfig conman off
chkconfig cups off
chkconfig dhcdbd off
chkconfig dund off
chkconfig firstboot off
chkconfig funcd on
chkconfig gpm off
chkconfig haldaemon off
chkconfig hidd off
chkconfig httpd off
chkconfig ibmasm off
chkconfig ip6tables off
chkconfig ipmi off
chkconfig iptables off
chkconfig irda off
chkconfig irqbalance off
chkconfig kdump off
chkconfig kudzu off
chkconfig lvm2-monitor off
chkconfig mcstrans off
chkconfig mdmpd off
chkconfig microcode_ctl off
chkconfig multipathd off
chkconfig netconsole off
chkconfig netfs off
chkconfig netplugd off
chkconfig nfs off
chkconfig nfslock off
chkconfig nscd off
chkconfig ntpd off
chkconfig oddjobd off
chkconfig pand off
chkconfig pcscd off
chkconfig portmap off
chkconfig psacct off
chkconfig rdisc off
chkconfig restorecond off
chkconfig rpcgssd off
chkconfig rpcidmapd off
chkconfig rpcsvcgssd off
chkconfig saslauthd off
chkconfig sendmail off
chkconfig setroubleshoot off
chkconfig winbind off
chkconfig wpa_supplicant off
chkconfig xfs off
chkconfig ypbind off
chkconfig yum-updatesd off
chkconfig certmaster on
chkconfig funcd on
cat >> EOFM > /etc/func/minion.conf
[main]
log_level = INFO
acl_dir = /etc/func/minion-acl.d
EOFM
cat >> EOCM > /etc/certmaster/minion.conf
[main]
certmaster = node3.le8le.com
log_level = DEBUG
cert_dir = /etc/pki/certmaster
EOCM
cat >> EODM > /etc/hosts
192.168.1.3 node3.le8le.com
EODM
$yum_config_stanza
SNIPPET::post_install_kernel_options
$kickstart_done
[/code]
九、利用cobbler重灌系統
# rpm -Uhv koan-1.2.5-1.el5.noarch.rpm
# koan -server=192.168.1.3 -list-profiles
# koan -replace-self -server=192.168.1.3 -profile=CentOS_5.2-i386
# reboot