Cobbler由python語言開發,是對PXE和Kickstart以及DHCP的封裝。融合不少特性,提供了CLI和Web的管理形式。更加方便的實行網絡安裝,。同時,Cobbler也提供了API接口,使用其它語言也很容易作擴展。它不緊能夠安裝物理機,同時也支持kvm、xen虛擬化、Guest OS的安裝。更多的是它還能結合Puppet等集中化管理軟件,實現自動化的管理。python
Cobbler 提供如下服務集成:linux
* PXE 服務支持web
* DHCP 服務管理shell
* DNS 服務管理vim
* 電源管理centos
* Kickstart 服務支持瀏覽器
* yum 倉庫管理緩存
Cobbler 的配置結構基於一組註冊的對象。每一個對象表示一個與另外一個實體相關聯的實體(該對象指向另外一個對象,或者另外一個對象指向該對象)。當一個對象指向另外一個對象時,它就繼承了被指向對象的數據,並可覆蓋或添加更多特定信息。如下對象類型的定義爲:bash
發行版:表示一個操做系統。它承載了內核和 initrd 的信息,以及內核參數等其餘數據。 服務器
配置文件:包含一個發行版、一個 kickstart 文件以及可能的存儲庫,還包含更多特定的內核參數等其餘數據。
系統:表示要配給的機器。它包含一個配置文件或一個鏡像,還包含 IP 和 MAC 地址、電源管理(地址、憑據、類型)以及更爲專業的數據等信息。
存儲庫:保存一個 yum 或 rsync 存儲庫的鏡像信息。
鏡像:可替換一個包含不屬於此類別的文件的發行版對象(例如,沒法分爲內核和 initrd 的對象)。
基於註冊的對象以及各個對象之間的關聯,Cobbler知道如何更改文件系統以反映具體配置。由於系統配置的內部是抽象的,因此您能夠僅關注想要執行的操做。下面是Cobbler各對象之間的關係圖,
Server端:
· 第一步,啓動Cobbler服務
· 第二步,進行Cobbler錯誤檢查,執行cobbler check命令
· 第三步,進行配置同步,執行cobbler sync命令
· 第四步,複製相關啓動文件文件到TFTP目錄中
· 第五步,啓動DHCP服務,提供地址分配
· 第六步,DHCP服務分配IP地址
· 第七步,TFTP傳輸啓動文件
· 第八步,Server端接收安裝信息
· 第九步,Server端發送ISO鏡像與Kickstart文件
Client端:
· 第一步,客戶端以PXE模式啓動
· 第二步,客戶端獲取IP地址
· 第三步,經過TFTP服務器獲取啓動文件
· 第四步,進入Cobbler安裝選擇界面
· 第五步,客戶端肯定加載信息
· 第六步,根據配置信息準備安裝系統
· 第七步,加載Kickstart文件
· 第八步,傳輸系統安裝的其它文件
· 第九步,進行安裝系統
[root@Cobbler~]# rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm Retrievinghttp://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm warning:/var/tmp/rpm-tmp.PiRbIQ: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY Preparing... ########################################### [100%] 1:epel-release ########################################### [100%]
[root@Cobbler~]# service iptables stop [root@Cobbler~]# chkconfig iptables off [root@Cobbler~]# service iptables status iptables: Firewall is notrunning. [root@Cobbler~]# chkconfig --list | grep iptables iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off [root@Cobbler~]# getenforce Disabled 補充:禁用selinux的方法: setenfore 0 臨時禁用 sed -i '/SELINUX=/d'/etc/selinux/config && echo"SELINUX=disabled">> /etc/selinux/config 永久禁用,重啓生效
[root@Cobbler~]# yum -y install httpd rsync tftp-server xinetd dhcp cman pykickstart debmirror [root@Cobbler~]# yum -y install cobbler cobbler-web 過程當中可能會報錯: [root@Cobbler ~]# yum -y installhttpd rsync tftp-server xinetd dhcp cmanpykickstart debmirror Loaded plugins: fastestmirror Loading mirror speeds fromcached hostfile Error: Cannot retrieve metalinkfor repository: epel. Please verify its path and try again 解決:把epel.repo中的mirrorlist註釋掉,並啓用baseurl [root@Cobbler~]# egrep "baseurl|mirrorlist" /etc/yum.repos.d/epel.repo #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch #baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch #baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch [root@Cobbler~]#sed -i's/#baseurl/baseurl/g' /etc/yum.repos.d/epel.repo [root@Cobbler~]#sed -i ''s/mirrorlist/#mirrorlist/g/etc/yum.repos.d/epel.repo [root@Cobbler~]# egrep "baseurl|mirrorlist" /etc/yum.repos.d/epel.repo baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch/debug #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch baseurl=http://download.fedoraproject.org/pub/epel/6/SRPMS #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch
[root@Cobbler~]# cobbler check The following are potentialconfiguration items that you may want to fix: 1 : The 'server' field in/etc/cobbler/settings must be set to something other than localhost, orkickstarting features will not work. This should be a resolvable hostname or IP for the boot server asreachable 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 otherthan 127.0.0.1, and should match the IP of the boot server on the PXE network. 3 : some network boot-loadersare missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' todownload them, or, if you only want to handle x86/x86_64 netbooting, you mayensure that you have installed a *recent* version of the syslinux packageinstalled 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 'cobblerget-loaders' command is the easiest way to resolve these requirements. 4 : change 'disable' to 'no'in /etc/xinetd.d/rsync 5 : comment out 'dists' on/etc/debmirror.conf for proper debian support 6 : comment out 'arches' on/etc/debmirror.conf for proper debian support 7 : The default password usedby the sample templates for newly installed machines (default_password_cryptedin /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:在settings裏面設置server 的IP 2:在settings裏面設置next_server的IP 3:若是當前節點能夠訪問互聯網,執行「cobblerget-loader」命令下載pxelinux.0,menu.c32,elilo.efi, 或yaboot文件,不然,須要安裝syslinux程序包,然後複製/usr/share/syslinux/中的pxelinux.0,menu.c32等文件至/var/lib/cobbler/loaders目錄中 4:把/etc/xinetd.d/rsync中的disable的值改成no 5: 註釋/etc/dedmirror.conf文件中的「@dists="sid";」一行 6: 註釋/etc/dedmirror.conf文件中的「@arches="i386";」一行 7: 執行「openssl passwd -1 -salt$(openssl rand -hex 4)」生成密碼,並用其替換/etc/cobbler/settings文件中default_password_crypted參數
下面開始在配置過程當中解決上面的報錯
[root@Cobbler~]# sed -i -e 's/= yes/= no/g' /etc/xinetd.d/rsync [root@Cobbler~]# sed -i '/disable/c\\tdisable\t\t\t= no' /etc/xinetd.d/tftp [root@Cobbler~]# grep "disable" /etc/xinetd.d/rsync /etc/xinetd.d/tftp /etc/xinetd.d/rsync: disable = no /etc/xinetd.d/tftp: disable = no
[root@Cobbler~]# sed -i "s/manage_dhcp: 0/manage_dhcp: 1/g" /etc/cobbler/settings [root@Cobbler~]# sed -i "s/manage_rsync: 0/manage_rsync: 1/g" /etc/cobbler/settings [root@Cobbler ~]# sed -i"s/next_server: 127.0.0.1/next_server: 192.168.255.10/g"/etc/cobbler/settings [root@Cobbler~]# sed -i "s/server:127.0.0.1/server: 192.168.255.10/g" /etc/cobbler/settings [root@Cobbler~]# egrep "manage_dhcp|manage_rsync|server:|next_server"/etc/cobbler/settings manage_dhcp:1 #啓用cobbler對dhcp的管理 manage_rsync:1 #啓用cobbler對rsync的管理 next_server:192.168.255.10 #指定next_server的地址 server:192.168.255.10 #指定cobbler的服務器的ip
[root@Cobbler~]# sed -i "s/@dists/#@dists/g" /etc/debmirror.conf [root@Cobbler~]# sed -i "s/@arches/#@arches/g" /etc/debmirror.conf [root@Cobbler~]# egrep "@dists|@arches" /etc/debmirror.conf #@dists="sid"; #@arches="i386";
subnet192.168.255.0 netmask 255.255.255.0 { option routers 192.168.255.10; option domain-name-servers 192.168.255.10; option subnet-mask 255.255.255.0; range dynamic-bootp 192.168.255.100 192.168.255.254; default-lease-time 21600; max-lease-time 43200; next-server $next_server;
[root@Cobbler~]# openssl passwd -1 -salt 'cobbler'"123.com" $1$cobbler$rK3/2t1JZHrwohtqCqcmg. [root@Cobbler ~]# sed -i'/default_password_crypted/c\default_password_crypted:\"$1$cobbler$rK3/2t1JZHrwohtqCqcmg.\"' /etc/cobbler/settings [root@Cobbler~]# grep "default_password_crypted" /etc/cobbler/settings default_password_crypted:"$1$cobbler$rK3/2t1JZHrwohtqCqcmg."
[root@Cobbler~]# /etc/init.d/httpd start Startinghttpd: httpd: apr_sockaddr_info_get() failed for Cobbler httpd:Could not reliably determine the server's fully qualified domain name, using127.0.0.1 for ServerName [ OK ] [root@Cobbler~]# /etc/init.d/xinetd start Startingxinetd: [ OK ] [root@Cobbler~]# /etc/init.d/cobblerd start Startingcobbler daemon: [ OK ] [root@Cobbler~]# /sbin/chkconfig httpd on [root@Cobbler~]# /sbin/chkconfig dhcpd on [root@Cobbler~]# /sbin/chkconfig xinetd on [root@Cobbler~]# /sbin/chkconfig cobblerd on [root@Cobbler~]# service dhcpd start Startingdhcpd: [FAILED] dhcp啓動失敗,緣由是沒有同步cobbler的配置,如今cobbler還沒接管dhcp,執行cobblerrsync以後就能夠
[root@Cobbler~]# cobbler get-loaders task started:2015-06-01_170259_get_loaders task started (id=DownloadBootloader Content, time=Mon Jun 117:02:59 2015) path/var/lib/cobbler/loaders/README already exists, not overwriting existingcontent, use --force if you wish to update path/var/lib/cobbler/loaders/COPYING.elilo already exists, not overwriting existingcontent, use --force if you wish to update path/var/lib/cobbler/loaders/COPYING.yaboot already exists, not overwritingexisting content, use --force if you wish to update path/var/lib/cobbler/loaders/COPYING.syslinux already exists, not overwritingexisting content, use --force if you wish to update path/var/lib/cobbler/loaders/elilo-ia64.efi already exists, not overwritingexisting content, use --force if you wish to update path/var/lib/cobbler/loaders/yaboot already exists, not overwriting existingcontent, use --force if you wish to update path/var/lib/cobbler/loaders/pxelinux.0 already exists, not overwriting existingcontent, use --force if you wish to update path/var/lib/cobbler/loaders/menu.c32 already exists, not overwriting existingcontent, use --force if you wish to update path/var/lib/cobbler/loaders/grub-x86.efi already exists, not overwriting existingcontent, use --force if you wish to update path/var/lib/cobbler/loaders/grub-x86_64.efi already exists, not overwritingexisting content, use --force if you wish to update *** TASK COMPLETE ***
[root@Cobbler~]# service cobblerd restart Stoppingcobbler daemon: [ OK ] Startingcobbler daemon: [ OK ] [root@Cobbler~]# cobbler sync taskstarted: 2015-06-01_170502_sync taskstarted (id=Sync, time=Mon Jun 117:05:02 2015) runningpre-sync triggers cleaningtrees removing:/var/lib/tftpboot/grub/p_w_picpaths copyingbootloaders tryinghardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0 tryinghardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32 tryinghardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot tryinghardlink /var/lib/cobbler/loaders/grub-x86.efi ->/var/lib/tftpboot/grub/grub-x86.efi tryinghardlink /var/lib/cobbler/loaders/grub-x86_64.efi ->/var/lib/tftpboot/grub/grub-x86_64.efi copyingdistros to tftpboot copyingp_w_picpaths generatingPXE configuration files generatingPXE menu structure renderingDHCP files generating/etc/dhcp/dhcpd.conf renderingTFTPD files generating/etc/xinetd.d/tftp cleaninglink caches renderingRsync files runningpost-sync triggers runningpython triggers from /var/lib/cobbler/triggers/sync/post/* runningpython trigger cobbler.modules.sync_post_restart_services running:dhcpd -t -q receivedon stdout: receivedon stderr: running:service dhcpd restart receivedon stdout: Starting dhcpd: [ OK ] receivedon stderr: runningshell triggers from /var/lib/cobbler/triggers/sync/post/* runningpython triggers from /var/lib/cobbler/triggers/change/* runningpython trigger cobbler.modules.scm_track runningshell triggers from /var/lib/cobbler/triggers/change/* ***TASK COMPLETE *** 同步完成沒報錯以後,如今從新啓動dhcp,發現能夠正常啓動了 [root@Cobbler~]# service dhcpd restart Shuttingdown dhcpd: [ OK ] Startingdhcpd: [ OK ] 最後執行cobblercheck從新檢查一下,沒有報錯 [root@Cobbler~]# cobbler check Noconfiguration problems found. Allsystems go. 此時cobbler已經安裝配置完成,下面開始進行導入鏡像等管理操做
cobblercheck #檢查cobbler配置
cobbler sync #同步配置到dhcp/pxe和數據目錄
cobbler list #列出全部的cobbler元素
cobbler import #導入安裝的系統鏡像
cobbler report #列出各元素的詳細信息
cobbler distro #查看導入的發行版系統信息
cobbler profile #查看配置信息
cobbler system #查看添加的系統信息
cobbler reposync #同步yum倉庫到本地
每一個命令若是不熟悉參數可使用 --help來幫助 如:
[root@Cobbler ~]# cobbler--help
usage
=====
cobbler<distro|profile|system|repo|p_w_picpath|mgmtclass|package|file> ...
[add|edit|copy|getks*|list|remove|rename|report] [options|--help]
cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validateks|version|signature|get-loaders|hardlink>[options|--help]
[root@Cobbler ~]# cobblerimport --help
Usage: cobbler [options]
Options:
-h, --help show this help message and exit
--arch=ARCH OS architecture being imported
--breed=BREED the breed being imported
--os-version=OS_VERSION
the version beingimported
--path=PATH local path or rsync location
--name=NAME name, ex 'RHEL-5'
--available-as=AVAILABLE_AS
tree is here, don'tmirror
--kickstart=KICKSTART_FILE
assign this kickstartfile
--rsync-flags=RSYNC_FLAGS
pass additional flagsto rsync
查看幫助信息
[root@Cobbler~]# cobbler import --help
Usage:cobbler [options]
Options:
-h, --help show this help message and exit
--arch=ARCH OS architecture being imported
--breed=BREED the breed being imported
--os-version=OS_VERSION the version being imported
--path=PATH local path or rsync location
--name=NAME name, ex 'RHEL-5'
--available-as=AVAILABLE_AS tree is here, don't mirror
--kickstart=KICKSTART_FILE assign this kickstart file
--rsync-flags=RSYNC_FLAGS pass additional flags to rsync
如今開始導入:
掛載鏡像文件到/media下
[root@Cobbler~]# mount /dev/cdrom /media/ mount:block device /dev/sr0 is write-protected, mounting read-only
導入鏡像
[root@Cobbler~]# cobbler import --path=/media --name=CentOS6.4 --arch=x86_64 taskstarted: 2015-06-01_172716_import taskstarted (id=Media import, time=Mon Jun 117:27:16 2015) Founda candidate signature: breed=redhat, version=rhel6 Founda matching signature: breed=redhat, version=rhel6 Addingdistros from path /var/www/cobbler/ks_mirror/CentOS6.4-x86_64: creatingnew distro: CentOS6.4-x86_64 tryingsymlink: /var/www/cobbler/ks_mirror/CentOS6.4-x86_64 ->/var/www/cobbler/links/CentOS6.4-x86_64 creatingnew profile: CentOS6.4-x86_64 associatingrepos checkingfor rsync repo(s) checkingfor rhn repo(s) checkingfor yum repo(s) startingdescent into /var/www/cobbler/ks_mirror/CentOS6.4-x86_64 for CentOS6.4-x86_64 processingrepo at : /var/www/cobbler/ks_mirror/CentOS6.4-x86_64 need toprocess repo/comps: /var/www/cobbler/ks_mirror/CentOS6.4-x86_64 lookingfor /var/www/cobbler/ks_mirror/CentOS6.4-x86_64/repodata/*comps*.xml Keepingrepodata as-is :/var/www/cobbler/ks_mirror/CentOS6.4-x86_64/repodata ***TASK COMPLETE ***
查看導入的鏡像:
[root@Cobbler~]# cobbler distro list CentOS6.4-x86_64 [root@Cobbler~]# cobbler list distros: CentOS6.4-x86_64 profiles: CentOS6.4-x86_64 systems: repos: p_w_picpaths: mgmtclasses: packages: files:
Kickstart的模版文件在/var/lib/cobbler/kickstarts中,在導入鏡像的時候不指定kickstart文件,就會使用默認的模版文件,如今咱們拷貝 一份,進行自定義修改
[root@Cobbler~]# cd /var/lib/cobbler/kickstarts [root@Cobblerkickstarts]# cp sample.ks centos6.4x86_64.cfg [root@Cobbler kickstarts]# cobbler profile edit --name=CentOS6.4-x86_64--kickstart=/var/lib/cobbler/kickstarts/centos6.4x86_64.cfg
默認的kickstart文件sampl.ks註釋:
#platform=x86, AMD64, or Intel EM64T # System authorization information auth --useshadow --enablemd5 #用戶登陸認證 # System bootloader configuration bootloader --location=mbr #mbr引導 # Partition clearing information clearpart --all --initlabel#默認清除因此分區 # Use text mode install text #默認以文本模式安裝 # Firewall configuration firewall --enabled #防火牆默認開啓 # 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 thekickstart profile, include them here. $yum_repo_stanza #默認的yum倉庫 # Network information $SNIPPET('network_config') # Reboot after installation reboot #安裝完成後重啓 #Root password rootpw --iscrypted $default_password_crypted #密碼是咱們/etc/cobbler/settings設置密碼 # SELinux configuration selinux --disabled #默認關閉selinux # Do not configure the X Window System skipx #默認沒有安裝圖形界面 # System timezone timezone America/New_York #默認時區是美國/紐約 # Install OS instead of upgrade install #定義的是安裝系統而不是升級系統 # Clear the Master Boot Record zerombr #默認清空全部的mbr # Allow anaconda to partition the system as needed autopart #默認自動分區 #下面就是Cobbler自定執行的一些腳本,我就不解釋了。 %pre $SNIPPET('log_ks_pre') $SNIPPET('kickstart_start') $SNIPPET('pre_install_network_config') # Enable installation monitoring $SNIPPET('pre_anamon') %packages $SNIPPET('func_install_if_enabled') $SNIPPET('puppet_install_if_enabled') %post $SNIPPET('log_ks_post') # 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('puppet_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 $SNIPPET('kickstart_done') # End final steps
自定義的centos6.4x86_64.cfg文件
auth --useshadow --enablemd5 bootloader--location=mbr clearpart--all --initlabel text firewall--enabled firstboot--disable keyboardus langen_US url--url=$tree $yum_repo_stanza $SNIPPET('network_config') reboot rootpw--iscrypted $default_password_crypted selinux--disabled skipx timezone Asia/Shanghai install zerombr autopart part/boot --fstype="ext4" --size=200 partswap --fstype="swap" --size=4096 part /--fstype="ext4" --grow --size=1 %pre $SNIPPET('log_ks_pre') $SNIPPET('kickstart_start') $SNIPPET('pre_install_network_config') $SNIPPET('pre_anamon') %packages $SNIPPET('func_install_if_enabled') $SNIPPET('puppet_install_if_enabled') @base @chinese-support @development @system-admin-tools %post--nochroot $SNIPPET('log_ks_post_nochroot') %end %post $SNIPPET('log_ks_post') $yum_config_stanza $SNIPPET('post_install_kernel_options') $SNIPPET('post_install_network_config') $SNIPPET('func_register_if_enabled') $SNIPPET('puppet_register_if_enabled') $SNIPPET('download_config_files') $SNIPPET('koan_environment') $SNIPPET('redhat_register') $SNIPPET('cobbler_register') $SNIPPET('post_anamon') $SNIPPET('kickstart_done')
[root@Cobbler~]# service cobblerd restart Stoppingcobbler daemon: [ OK ] Startingcobbler daemon: [ OK ] [root@Cobbler~]# cobbler check Noconfiguration problems found. All systemsgo. [root@Cobbler~]# cobbler sync taskstarted: 2015-06-01_175813_sync taskstarted (id=Sync, time=Mon Jun 117:58:13 2015) runningpre-sync triggers cleaningtrees removing:/var/www/cobbler/p_w_picpaths/CentOS6.4-x86_64 removing:/var/lib/tftpboot/pxelinux.cfg/default removing:/var/lib/tftpboot/grub/grub-x86.efi removing:/var/lib/tftpboot/grub/efidefault removing:/var/lib/tftpboot/grub/p_w_picpaths removing:/var/lib/tftpboot/grub/grub-x86_64.efi removing:/var/lib/tftpboot/p_w_picpaths/CentOS6.4-x86_64 removing:/var/lib/tftpboot/s390x/profile_list copyingbootloaders tryinghardlink /var/lib/cobbler/loaders/grub-x86.efi ->/var/lib/tftpboot/grub/grub-x86.efi tryinghardlink /var/lib/cobbler/loaders/grub-x86_64.efi ->/var/lib/tftpboot/grub/grub-x86_64.efi copyingdistros to tftpboot copyingfiles for distro: CentOS6.4-x86_64 tryinghardlink /var/www/cobbler/ks_mirror/CentOS6.4-x86_64/p_w_picpaths/pxeboot/vmlinuz-> /var/lib/tftpboot/p_w_picpaths/CentOS6.4-x86_64/vmlinuz tryinghardlink /var/www/cobbler/ks_mirror/CentOS6.4-x86_64/p_w_picpaths/pxeboot/initrd.img-> /var/lib/tftpboot/p_w_picpaths/CentOS6.4-x86_64/initrd.img copyingp_w_picpaths generatingPXE configuration files generatingPXE menu structure copyingfiles for distro: CentOS6.4-x86_64 tryinghardlink /var/www/cobbler/ks_mirror/CentOS6.4-x86_64/p_w_picpaths/pxeboot/vmlinuz-> /var/www/cobbler/p_w_picpaths/CentOS6.4-x86_64/vmlinuz tryinghardlink /var/www/cobbler/ks_mirror/CentOS6.4-x86_64/p_w_picpaths/pxeboot/initrd.img-> /var/www/cobbler/p_w_picpaths/CentOS6.4-x86_64/initrd.img Writingtemplate files for CentOS6.4-x86_64 renderingDHCP files generating/etc/dhcp/dhcpd.conf renderingTFTPD files generating/etc/xinetd.d/tftp processingboot_files for distro: CentOS6.4-x86_64 cleaninglink caches renderingRsync files runningpost-sync triggers runningpython triggers from /var/lib/cobbler/triggers/sync/post/* runningpython trigger cobbler.modules.sync_post_restart_services running:dhcpd -t -q receivedon stdout: receivedon stderr: running:service dhcpd restart receivedon stdout: Shutting down dhcpd: [ OK ] Startingdhcpd: [ OK ] receivedon stderr: runningshell triggers from /var/lib/cobbler/triggers/sync/post/* runningpython triggers from /var/lib/cobbler/triggers/change/* runningpython trigger cobbler.modules.scm_track runningshell triggers from /var/lib/cobbler/triggers/change/* ***TASK COMPLETE ***
下面客戶機就能夠開機從網卡啓動進行裝系統了。
1.生成hash密碼
支持兩種不一樣類型的密碼: sha1passmypassword 或 opensslpasswd -1 -salt sXiKzkus mypassword 我這裏選擇後者 [root@Cobblercobbler]# openssl passwd -1 -salt cobbler cobbler $1$cobbler$M6SE55xZodWc9.vAKLJs6.
2.編輯配置文件pxedefault.template,添加以下紅色部分
[root@Cobblercobbler]# vim /etc/cobbler/pxe/pxedefault.template
DEFAULTmenu
PROMPT0
MENUTITLE Cobbler | http://www.cobblerd.org/
MENU MASTERPASSWD $1$cobbler$M6SE55xZodWc9.vAKLJs6.
TIMEOUT200
TOTALTIMEOUT6000
ONTIMEOUT$pxe_timeout_profile
LABELlocal
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT -1
$pxe_menu_items
MENUend
3.編輯pxeprofile文件,添加下面內容
[root@Cobblercobbler]# vim /etc/cobbler/pxe/pxeprofile.template
LABEL$profile_name
MENU PASSWD
kernel $kernel_path
$menu_label
$append_line
ipappend 2
4.從新檢查配置,並同步使其生效
[root@Cobblercobbler]# cobbler check [root@Cobblercobbler]# cobbler sync
下次客戶端裝系統的時候,選擇系統菜單時就須要輸入密碼了
/etc/cobbler/settings #cobbler主配置文件
/etc/cobbler/dhcp.template #DHCP服務的配置模板
/etc/cobbler/tftpd.template #tftp服務的配置模板
/etc/cobbler/rsync.template #rsync服務的配置模板
/etc/cobbler/iso #iso模板配置文件
/etc/cobbler/pxe #pxe模板文件
/etc/cobbler/power #電源的配置文件
/etc/cobbler/users.conf #Web服務受權配置文件
/etc/cobbler/users.digest #用於web訪問的用戶名密碼配置文件
/etc/cobbler/dnsmasq.template #DNS服務的配置模板
/etc/cobbler/modules.conf #Cobbler模塊配置文件
/var/lib/cobbler/config #配置文件
/var/lib/cobbler/triggers #Cobbler命令
/var/lib/cobbler/kickstarts #默認存放kickstart文件
/var/lib/cobbler/loaders #存放的各類引導程序
/var/lib/dhcpd/dhcpd.leases #dhcp租期緩存文件
/tftpboot/pxelinux.cfg/default #pxe配置文件
/var/lib/cobbler/kickstarts_*.ks #ks模板文件
/var/www/cobbler/ks_mirror #導入的系統鏡像列表
/var/www/cobbler/p_w_picpaths #導入的系統鏡像啓動文件
/var/www/cobbler/repo_mirror #yum源存儲目錄
/var/log/cobbler/install.log #客戶端系統安裝日誌
/var/log/cobbler/cobbler.log #cobbler日誌
yuminstall cobbler-web -y
爲已存在的用戶cobbler重置密碼
htdigest/etc/cobbler/users.digest "Cobbler" cobbler
添加新用戶
htdigest/etc/cobbler/users.digest "Cobbler" your_newname
sed-i 's/authn_denyall/authn_configfile/g' /etc/cobbler/modules.conf
/etc/init.d/cobblerdrestart
/etc/init.d/httpdrestart
在瀏覽器上輸入http://cobber_ip/cobber_web打開web界面,輸入剛纔設置的用戶名和密碼,進入後臺
後臺界面:
下面開始導入鏡像:
選擇Import DVD,
在prefix項中要填寫導入光盤的名字,只有不與先前的名字衝突,這裏能夠隨意填。
在Arch項中選擇光盤的類型,是i386、x86_64、ai64等。
在Breed項中選擇系統的類型,CentOS、Debian、Ubuntu中的一種。
在Path項中填寫光盤或ISO鏡像包掛載的位置,路徑必定要填寫正確。
最後點擊 run開始導入,過程很慢,能夠經過日誌查看導入狀態
查看日誌中的導入狀態,能夠發現正在運行,第二個是以前用命令導入的,如今狀態爲complate完成
等到state狀態爲complate時,導入已完成
查看生成的distros,若生成剛導入的系統,表示沒問題,如沒有生成須要查看日誌,瞭解具體狀況
下面咱們開始配置kickstart文件。點擊kickstart template,在右邊點擊建立新的kickstart文件,填寫你準備好的kickstart內容便可
修改profile文件,讓剛導入的鏡像和剛建立的kickstart文件相關聯,選擇redhat6.4x86_64。點擊edit
修改kickstart的路徑,把剛纔咱們建立的kickstart的文件路徑寫進去,保存便可。
此就是cobbler簡單的web配置。