/sbin/chkconfig httpd on /sbin/chkconfig dhcpd on /sbin/chkconfig xinetd on /sbin/chkconfig tftp on /sbin/chkconfig cobblerd on
4、檢查cobbler相關配置:
cobbler check
The following are potential configuration items that you may want to fix:
1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it. 2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network. 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 "/tftpboot/.*" && \ /usr/sbin/semanage fcontext -a -t public_content_t "/var/www/cobbler/images/.*" 4 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements. 5 : change 'disable' to 'no' in /etc/xinetd.d/tftp 6 : change 'disable' to 'no' in /etc/xinetd.d/rsync 7 : since iptables may be running, ensure 69, 80, and 25151 are unblocked 8 : debmirror package is not installed, it will be required to manage debian deployments and repositories 9 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
Restart cobblerd and then run 'cobbler sync' to apply changes.
修正上面錯誤: 1)、vi /etc/cobbler/settings server: 192.168.0.2 #設置cobbler server的IP地址 next-server: 192.168.0.2 #設置PXE server的IP地址 manage_dhcp: 1 #開啟管理DHCP服務 default_kickstart: /var/lib/cobbler/kickstarts/default.ks #設置默認的kickstart配置文件,此文件建議用system-config-kickstart(需要X環境)生成 2)、關閉防火牆和SElinux 3)、獲取啟動鏡像 cobbler get-loaders 4)、啟動tftp和rsync vi /etc/xinetd.d/tftp 將disable = yes改為:disable = no vi /etc/xinetd.d/rsync 將disable = yes改為:disable = no
重啟xinetd服務: /etc/init.d/xinetd restart 5)、修改DHCP模板,確保DHCP分配的地址和Cobbler在同一網段 vi /etc/cobbler/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;
allow booting; allow bootp;
ignore client-updates; set vendorclass = option vendor-class-identifier;
#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.subnet: option subnet-mask $iface.subnet; #end if #if $iface.gateway: option routers $iface.gateway; #end if 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
5、同步cobbler配置,使修改生效:
cobbler sync
6、掛載Linux安裝盤,生成安裝鏡像:
mount /dev/cdrom /mnt/ cobbler import --path=/mnt/ --name=CentOS-5-i386
# cat /var/lib/cobbler/kickstarts/webserver.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 --disable # 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 $SNIPPET('network_config') # Reboot after installation reboot
#Root password rootpw --iscrypted $default_password_crypted # SELinux configuration selinux --disabled # Do not configure the X Window System skipx # System timezone timezone --utc Asia/Shanghai # Install OS instead of upgrade install # Clear the Master Boot Record zerombr # Allow anaconda to partition the system as needed autopart clearpart --all --drives=sda --initlabel part /boot --fstype ext3 --size=128 part /usr --fstype ext3 --size=4192 part / --fstype ext3 --size=2048 part /var --fstype ext3 --size=2048 part /tmp --fstype ext3 --size=2048 part swap --size=2048 part /data0 --fstype ext3 --size=100 --grow
%post $SNIPPET('log_ks_post') kill_service_list='S00microcode_ctl S19rpcgssd S26hidd S11auditd S22messagebus S90xfs S12restorecond S28autofs S25bluetooth S95atd S05kudzu S25netfs S56cups S97yum-updatesd S06cpuspeed S13portmap S25pcscd S56rawdevices S98avahi-daemon S08ip6tables S14nfslock S26acpid S08iptables S15mdmonitor S26apmd S80sendmail S08mcstrans S18rpcidmapd S26haldaemon S85gpm S99smartd' for service in $kill_service_list do k_service=`echo $service |sed 's/^S/K/'` if [[ -f /etc/rc3.d/$service ]]; then mv /etc/rc3.d/$service /etc/rc3.d/$k_service fi done /sbin/chkconfig --level 345 puppet on /usr/sbin/puppetd --test
# Start yum configuration $yum_config_stanza # End yum configuration $SNIPPET('post_install_kernel_options') $SNIPPET('post_install_network_config') $SNIPPET('func_register_if_enabled') $SNIPPET('download_config_files') $SNIPPET('koan_environment') $SNIPPET('redhat_register') $SNIPPET('cobbler_register') # Enable post-install boot notification $SNIPPET('post_anamon') # Start final steps $kickstart_done # End final steps
參考: UserDocs: https://fedorahosted.org/cobbler/wiki/UserDocs Cobbler on Centos with Vmware: http://www.jedi.be/blog/2009/03/19/cobbler-on-centos-with-vmware/ Cobbler Documentation, examples and use of Cobbler Linux Provisioning System: http://openskill.info/topic.php?ID=201