运维自动化之Cobbler系统安装使用详解[good]
2017-03-09 17:42
766 查看
一、简介
Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows。该工具使用python开发,小巧轻便(才15k行python代码),使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP、DNS、以及yum仓库、构造系统ISO镜像。
Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用。
Cobbler客户端Koan支持虚拟机安装和操作系统重新安装,使重装系统更便捷。
二、cobbler提供的功能
使用Cobbler,您无需进行人工干预即可安装机器。Cobbler设置一个PXE引导环境(它还可使用yaboot支持PowerPC),并控制与安装相关的所有方面,比如网络引导服务(DHCP和TFTP)与存储库镜像。当希望安装一台新机器时,Cobbler可以:
使用一个以前定义的模板来配置DHCP服务(如果启用了管理DHCP)
将一个存储库(yum或rsync)建立镜像或解压缩一个媒介,以注册一个新操作系统
在DHCP配置文件中为需要安装的机器创建一个条目,并使用您指定的参数(IP和MAC地址)
在TFTFP服务目录下创建适当的PXE文件
重新启动DHCP服务以反映更改
重新启动机器以开始安装(如果电源管理已启用)
Cobbler支持众多的发行版:RedHat、Fedora、CentOS、Debian、Ubuntu和SuSE。当添加一个操作系统(通常通过使用ISO文件)时,Cobbler知道如何解压缩合适的文件并调整网络服务,以正确引导机器。
Cobbler可使用kickstart模板。基于RedHat或Fedora的系统使用kickstart文件来自动化安装流程。通过使用模板,您就会拥有基本的kickstart模板,然后定义如何针对一种配置文件或机器配置而替换其中的变量。例如,一个模板可能包含两个变量$domain和$machine_name。在Cobbler配置中,一个配置文件指定domain=mydomain.com,并且每台使用该配置文件的机器在machine_name变量中指定其名称。该配置文件中的所有机器都使用相同的kickstart安装且针对domain=mydomain.com进行配置,但每台机器拥有其自己的机器名称。您仍然可以使用kickstart模板在不同的域中安装其他机器并使用不同的机器名称。
为了协助管理系统,Cobbler可通过fencescripts连接到各种电源管理环境。Cobbler支持apc_snmp、bladecenter、bullpap、drac、ether_wake、ilo、integrity、ipmilan、ipmitool、lpar、rsa、virsh和wti。要重新安装一台机器,可运行rebootsystemfoo命令,而且Cobbler会使用必要的凭据和信息来为您运行恰当的fencescripts(比如机器插槽数)。
除了这些特性,还可使用一个配置管理系统(CMS)。您有两种选择:该工具内的一个内部系统,或者集成一个现有的外部CMS,比如Chef或Puppet。借助内部系统,您可以指定文件模板,这些模板会依据配置参数进行处理(与kickstart模板的处理方式一样),然后复制到您指定的位置。如果必须自动将配置文件部署到特定机器,那么此功能很有用。
使用koan客户端,Cobbler可从客户端配置虚拟机并重新安装系统。我不会讨论配置管理和koan特性,因为它们不属于本文的介绍范畴。但是,它们是值得研究的有用特性。
Cobbler设计模式:
*1*发行版(distro):表示一个操作系统。它承载了内核和initrd的信息,以及内核参数等其他数据。
*2*存储库(repository):保存一个yum或rsync存储库镜像信息。
*3*配置文件(profile):包含一个发行版(distro)、一个kickstart文件以及可能的存储库(repository)
还包含更多特定的内核参数及其他数据。
*4*系统(system):表示要配给的机器,它包含一个配置文件或一个镜像,还包含IP和MAC地址、
电源管理(地址、凭据、类型)以及更专业的数据等信息。
*5*镜像(image):可替换一个包含不属于此类别的文件发行版对象,(例如:无法分为内核和initrd的对象)
Cobbler服务集成以下:
Cobbler设计模式:
Cobbler运行流程:
三、安装配置
CobblerUnits软件包:
CobblerUnits配置:
1.安装方式
cobbler可以手动编译安装,也可以基于yum源的安装,如果需要通过yum源安装,则需要配置epel源,epel源可以通过下载官方给的epel源的目录来实现安装https://fedoraproject.org/wiki/EPEL
[root@node1~]#yuminstallcobblercobbler-webpykickstartdebmirror-y
2.检查配置文件,需要在cobblerd和httpd启动的情况下检查
[root@node1~]#cobblercheck
Thefollowingarepotentialconfigurationitemsthatyoumaywanttofix:
1:The'server'fieldin/etc/cobbler/settingsmustbesettosomethingotherthanlocalhost,orkickstartingfeatureswillnotwork.ThisshouldbearesolvablehostnameorIPforthebootserverasreachablebyallmachinesthatwilluseit.
2:ForPXEtobefunctional,the'next_server'fieldin/etc/cobbler/settingsmustbesettosomethingotherthan127.0.0.1,andshouldmatchtheIPofthebootserveronthePXEnetwork.
3:somenetworkboot-loadersaremissingfrom/var/lib/cobbler/loaders,youmayrun'cobblerget-loaders'todownloadthem,or,ifyouonlywanttohandlex86/x86_64netbooting,youmayensurethatyouhaveinstalleda*recent*versionofthesyslinuxpackageinstalledandcanignorethismessageentirely.Filesinthisdirectory,shouldyouwanttosupportallarchitectures,shouldincludepxelinux.0,menu.c32,elilo.efi,andyaboot.The'cobblerget-loaders'commandistheeasiestwaytoresolvetheserequirements.
4:change'disable'to'no'in/etc/xinetd.d/rsync
5:commentout'dists'on/etc/debmirror.confforproperdebiansupport
6:commentout'arches'on/etc/debmirror.confforproperdebiansupport
7:Thedefaultpasswordusedbythesampletemplatesfornewlyinstalledmachines(default_password_cryptedin/etc/cobbler/settings)isstillsetto'cobbler'andshouldbechanged,try:"opensslpasswd-1-salt'random-phrase-here''your-password-here'"togeneratenewone
8:fencingtoolswerenotfound,andarerequiredtousethe(optional)powermanagementfeatures.installcmanorfence-agentstousethem
如上个问题的解决办法为:
1.修改/etc/cobbler/settings文件的server参数的值为提供cobbler服务的主机对应的ip地址
2.修改/etc/cobbler/settings文件的next_server参数的值为提供PXE服务的主机的对应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,或者执行“chkconfigrsyncon”
5.注释/etc/dedmirror.conf文件中的“@dists="sid";”一行
6.注释/etc/dedmirror.conf文件中的“@arches="i386";”一行
7.执行“opensslpasswd-1-salt$(opensslrand-hex4)”生成密码,并用其替换/etc/cobbler/settings文件中default_password_crypted参数
8.安装cam和fance-agents来实现电源管理
通过cobblerget-loaders同步文件:
[root@node1~]#cobblerget-loaders
taskstarted:2014-04-23_212251_get_loaders
taskstarted(id=DownloadBootloaderContent,time=WedApr2321:22:512014)
downloadinghttp://www.cobblerd.org/loaders/READMEto/var/lib/cobbler/loaders/README
downloadinghttp://www.cobblerd.org/loaders/COPYING.eliloto/var/lib/cobbler/loaders/COPYING.elilo
downloadinghttp://www.cobblerd.org/loaders/COPYING.yabootto/var/lib/cobbler/loaders/COPYING.yaboot
downloadinghttp://www.cobblerd.org/loaders/COPYING.syslinuxto/var/lib/cobbler/loaders/COPYING.syslinux
downloadinghttp://www.cobblerd.org/loaders/elilo-3.8-ia64.efito/var/lib/cobbler/loaders/elilo-ia64.efi
downloadinghttp://www.cobblerd.org/loaders/yaboot-1.3.14-12to/var/lib/cobbler/loaders/yaboot
downloadinghttp://www.cobblerd.org/loaders/pxelinux.0-3.86to/var/lib/cobbler/loaders/pxelinux.0
downloadinghttp://www.cobblerd.org/loaders/menu.c32-3.86to/var/lib/cobbler/loaders/menu.c32
downloadinghttp://www.cobblerd.org/loaders/grub-0.97-x86.efito/var/lib/cobbler/loaders/grub-x86.efi
downloadinghttp://www.cobblerd.org/loaders/grub-0.97-x86_64.efito/var/lib/cobbler/loaders/grub-x86_64.efi
四、配置及启动cobbler所依赖的各服务
cobbler的运行依赖于dhcp、tftp、rsync及dns服务,其中dhcp可由dhcpd(isc)提供,也可由dnsmasq提供;tftp可由tftp-server程序包提供,也可由cobbler功能提供,rsync有rsync程序包提供,dns可由bind提供,也可由dnsmasq提供
cobbler可自行管理这些服务中的部分甚至是全部,但需要配置/etc/cobbler/settings文件中的“manange_dhcp”、“manager_tftpd”、“manager_rsync”、“manager_dns”分别来进行定义,另外,由于各种服务都有着不同的实现方式,如若需要进行自定义,需要通过修改/etc/cobbler/modules.conf配置文件中各服务的模块参数的值来实现
本处通过独立管理。即不通过cobbler来管理这些服务
1.配置dhcp服务
定义好所需的“subnet”及其他参数,本处的配置如下:
[root@node1~]#cp/usr/share/doc/dhcp*/dhcpd.conf.sample/etc/dhcp/dhcpd.conf
编辑配置文件
optiondomain-name"wangfeng7399";
optiondomain-name-servers192.168.1.201;
default-lease-time43200;
max-lease-time86400;
log-facilitylocal7;
subnet192.168.1.0netmask255.255.255.0{
range192.168.1.210192.168.1.230
optionrouters192.168.1.253
}
next-server192.168.1.210;
filename="pxelinux.0";
2.配置tftpd服务
[root@node1~]#chkconfigtftpon
五、配置cobbler
CobblerCommands(常用使用命令参数)
cobbler的各主要组件间的关系如下图所示:
1.管理distro
是cobbler变得可用的第一步为定义distro,其可以通过为其指定外部的安装引导内核及ramdisk文件的方式实现。而如果已经有完成的安装树(如os的安装镜像)则推荐使用improt之间导入的方式进行:
[root@node1~]#mount/dev/cdrom/media
mount:blockdevice/dev/sr0iswrite-protected,mountingread-only
[root@node1~]#cobblerimport--name=centos6.5-x86-64--path=/media/
taskstarted:2014-04-23_214916_import
taskstarted(id=Mediaimport,time=WedApr2321:49:162014)
Foundacandidatesignature:breed=redhat,version=rhel6
Foundamatchingsignature:breed=redhat,version=rhel6
Addingdistrosfrompath/var/www/cobbler/ks_mirror/centos6.5-x86-64:
creatingnewdistro:centos6.5-64-x86_64
tryingsymlink:/var/www/cobbler/ks_mirror/centos6.5-x86-64->/var/www/cobbler/links/centos6.5-64-x86_64
creatingnewprofile:centos6.5-64-x86_64
associatingrepos
checkingforrsyncrepo(s)
checkingforrhnrepo(s)
checkingforyumrepo(s)
startingdescentinto/var/www/cobbler/ks_mirror/centos6.5-x86-64forcentos6.5-64-x86_64
processingrepoat:/var/www/cobbler/ks_mirror/centos6.5-x86-64
needtoprocessrepo/comps:/var/www/cobbler/ks_mirror/centos6.5-x86-64
lookingfor/var/www/cobbler/ks_mirror/centos6.5-x86-64/repodata/*comps*.xml
Keepingrepodataas-is:/var/www/cobbler/ks_mirror/centos6.5-x86-64/repodata
***TASKCOMPLETE***
列出所有的distro:
[root@node1~]#cobblerdistrolist
centos6.5-64-x86_64
如果有kickstart文件,也可以使用--kickstart=/path/to/kickstart_file进行导入,因此import会自动为导入的distro生成一个profile
2.管理profile
cobbler使用profile来为特定的需求类别提供锁需要安装的配置,即在distro的基础上通过提供kiskstart文件来生成一个特定的系统安装配置。distro的profile可以出现在pxe的引导菜单中作为安装的选择之一,关于kickstark文件的讲解可以移步本人的相关博客http://wangfeng7399.blog.51cto.com/3518031/1369553,不出就不再做详细说明:
[root@node1~]#cobblerprofileadd--name=centos6.5-x86_64--distro=centos6.5-64-x86_64kickstart=/root/anaconda-ks.cfg
列出当前系统上的profile:
[root@node1~]#cobblerprofilelist
centos6.5-64-x86_64
centos6.5-x86_64
删除一个profile:
[root@node1~]#cobblerprofileremove--name=centos6.5-64-x86_64
3.重启服务及同步数据到响应的目录
[root@node1~]#servicecobblerdrestart
Stoppingcobblerdaemon:[OK]
Startingcobblerdaemon:[OK]
[root@node1~]#cobblersync
taskstarted:2014-04-23_220652_sync
taskstarted(id=Sync,time=WedApr2322:06:522014)
runningpre-synctriggers
cleaningtrees
removing:/var/www/cobbler/images/centos6.5-64-x86_64
removing:/var/lib/tftpboot/pxelinux.cfg/default
removing:/var/lib/tftpboot/grub/images
removing:/var/lib/tftpboot/grub/efidefault
removing:/var/lib/tftpboot/images/centos6.5-64-x86_64
removing:/var/lib/tftpboot/s390x/profile_list
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
中间省去N行
receivedonstderr:
runningshelltriggersfrom/var/lib/cobbler/triggers/sync/post/*
runningpythontriggersfrom/var/lib/cobbler/triggers/change/*
runningpythontriggercobbler.modules.scm_track
runningshelltriggersfrom/var/lib/cobbler/triggers/change/*
***TASKCOMPLETE***
4.测试
可以看到我们定制的系统启动页面,开始安装系统
系统安装成功,登陆系统
六、使用cobbler_web
cobbler_web支持多种认证方式,如authn_configfil、authn_ldap或authn_pam等,默认为authn_denyall,即拒绝所有用户登陆。下面说明两种能认证用户登录cobbler_web的方式
1.使用authn_pam模块认证cobbler_web用户
首先修改modules中的[authentication]段中的module参数的值为authn_pam,接着设定系统用户,并为用户设定密码,而后将设定的系统用户添加至cobbler_web的admin组中,修改/etc/cobbler/users.conf文件,将设定的用户添加为admin参数的值即可。
2.使用authn_configfile模块认证cobbler_web用户
首先修改modules中的[authentication]段中的module参数的值为authn_configfile,接着创建其认证文件/etc/cobbler/users.digest,并添加所需要的用户即可。需要注意的是,添加第一用户时,需要为htdigest命令使用“-c”选项,后续添加其他用户则不能再使用。
本处使用的为authn_pam
[root@node1~]#vi/etc/cobbler/modules.conf
[authentication]
module=authn_pam
[root@node1~]#useraddwangfeng7399
[root@node1~]#passwdwangfeng7399
Changingpasswordforuserwangfeng7399.
Newpassword:
Retypenewpassword:
passwd:allauthenticationtokensupdatedsuccessfully.
[root@node1~]#vi/etc/cobbler/users.conf
[admins]
admin="wangfeng7399"
完全可以手动添加,这也不为记不住命令而发愁了!
http://os.51cto.com/art/201405/439670.htm
Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows。该工具使用python开发,小巧轻便(才15k行python代码),使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP、DNS、以及yum仓库、构造系统ISO镜像。
Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用。
Cobbler客户端Koan支持虚拟机安装和操作系统重新安装,使重装系统更便捷。
二、cobbler提供的功能
使用Cobbler,您无需进行人工干预即可安装机器。Cobbler设置一个PXE引导环境(它还可使用yaboot支持PowerPC),并控制与安装相关的所有方面,比如网络引导服务(DHCP和TFTP)与存储库镜像。当希望安装一台新机器时,Cobbler可以:
使用一个以前定义的模板来配置DHCP服务(如果启用了管理DHCP)
将一个存储库(yum或rsync)建立镜像或解压缩一个媒介,以注册一个新操作系统
在DHCP配置文件中为需要安装的机器创建一个条目,并使用您指定的参数(IP和MAC地址)
在TFTFP服务目录下创建适当的PXE文件
重新启动DHCP服务以反映更改
重新启动机器以开始安装(如果电源管理已启用)
Cobbler支持众多的发行版:RedHat、Fedora、CentOS、Debian、Ubuntu和SuSE。当添加一个操作系统(通常通过使用ISO文件)时,Cobbler知道如何解压缩合适的文件并调整网络服务,以正确引导机器。
Cobbler可使用kickstart模板。基于RedHat或Fedora的系统使用kickstart文件来自动化安装流程。通过使用模板,您就会拥有基本的kickstart模板,然后定义如何针对一种配置文件或机器配置而替换其中的变量。例如,一个模板可能包含两个变量$domain和$machine_name。在Cobbler配置中,一个配置文件指定domain=mydomain.com,并且每台使用该配置文件的机器在machine_name变量中指定其名称。该配置文件中的所有机器都使用相同的kickstart安装且针对domain=mydomain.com进行配置,但每台机器拥有其自己的机器名称。您仍然可以使用kickstart模板在不同的域中安装其他机器并使用不同的机器名称。
为了协助管理系统,Cobbler可通过fencescripts连接到各种电源管理环境。Cobbler支持apc_snmp、bladecenter、bullpap、drac、ether_wake、ilo、integrity、ipmilan、ipmitool、lpar、rsa、virsh和wti。要重新安装一台机器,可运行rebootsystemfoo命令,而且Cobbler会使用必要的凭据和信息来为您运行恰当的fencescripts(比如机器插槽数)。
除了这些特性,还可使用一个配置管理系统(CMS)。您有两种选择:该工具内的一个内部系统,或者集成一个现有的外部CMS,比如Chef或Puppet。借助内部系统,您可以指定文件模板,这些模板会依据配置参数进行处理(与kickstart模板的处理方式一样),然后复制到您指定的位置。如果必须自动将配置文件部署到特定机器,那么此功能很有用。
使用koan客户端,Cobbler可从客户端配置虚拟机并重新安装系统。我不会讨论配置管理和koan特性,因为它们不属于本文的介绍范畴。但是,它们是值得研究的有用特性。
Cobbler设计模式:
Cobbler服务集成以下:
*1*发行版(distro):表示一个操作系统。它承载了内核和initrd的信息,以及内核参数等其他数据。 *2*存储库(repository):保存一个yum或rsync存储库镜像信息。 *3*配置文件(profile):包含一个发行版(distro)、一个kickstart文件以及可能的存储库(repository) 还包含更多特定的内核参数及其他数据。 *4*系统(system):表示要配给的机器,它包含一个配置文件或一个镜像,还包含IP和MAC地址、 电源管理(地址、凭据、类型)以及更专业的数据等信息。 *5*镜像(image):可替换一个包含不属于此类别的文件发行版对象,(例如:无法分为内核和initrd的对象) |
Cobbler运行流程:
*1*DHCP服务分配IP地址 *2*Client(获取IP地址、Next_serverIP地址) *3*Next_server(获取启动内核、initrd等文件) *4*tftp(PXE引导文件、启动Cobbler选择界面) *5*kickstart(确定加载项,根据NFS,httpd,ftp等共享) |
cobbler工作流[详细解释]
cobbler为server端,裸机为client端 |
CobblerUnits软件包:
*cobbler |
*1*安装cobbler,依据cobblercheck检查结果,对settings主配置文件,进行相关修正设置; |
cobbler可以手动编译安装,也可以基于yum源的安装,如果需要通过yum源安装,则需要配置epel源,epel源可以通过下载官方给的epel源的目录来实现安装
[root@node1~]#yuminstallcobblercobbler-webpykickstartdebmirror-y
2.检查配置文件,需要在cobblerd和httpd启动的情况下检查
[root@node1~]#cobblercheck
Thefollowingarepotentialconfigurationitemsthatyoumaywanttofix:
1:The'server'fieldin/etc/cobbler/settingsmustbesettosomethingotherthanlocalhost,orkickstartingfeatureswillnotwork.ThisshouldbearesolvablehostnameorIPforthebootserverasreachablebyallmachinesthatwilluseit.
2:ForPXEtobefunctional,the'next_server'fieldin/etc/cobbler/settingsmustbesettosomethingotherthan127.0.0.1,andshouldmatchtheIPofthebootserveronthePXEnetwork.
3:somenetworkboot-loadersaremissingfrom/var/lib/cobbler/loaders,youmayrun'cobblerget-loaders'todownloadthem,or,ifyouonlywanttohandlex86/x86_64netbooting,youmayensurethatyouhaveinstalleda*recent*versionofthesyslinuxpackageinstalledandcanignorethismessageentirely.Filesinthisdirectory,shouldyouwanttosupportallarchitectures,shouldincludepxelinux.0,menu.c32,elilo.efi,andyaboot.The'cobblerget-loaders'commandistheeasiestwaytoresolvetheserequirements.
4:change'disable'to'no'in/etc/xinetd.d/rsync
5:commentout'dists'on/etc/debmirror.confforproperdebiansupport
6:commentout'arches'on/etc/debmirror.confforproperdebiansupport
7:Thedefaultpasswordusedbythesampletemplatesfornewlyinstalledmachines(default_password_cryptedin/etc/cobbler/settings)isstillsetto'cobbler'andshouldbechanged,try:"opensslpasswd-1-salt'random-phrase-here''your-password-here'"togeneratenewone
8:fencingtoolswerenotfound,andarerequiredtousethe(optional)powermanagementfeatures.installcmanorfence-agentstousethem
如上个问题的解决办法为:
1.修改/etc/cobbler/settings文件的server参数的值为提供cobbler服务的主机对应的ip地址
2.修改/etc/cobbler/settings文件的next_server参数的值为提供PXE服务的主机的对应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,或者执行“chkconfigrsyncon”
5.注释/etc/dedmirror.conf文件中的“@dists="sid";”一行
6.注释/etc/dedmirror.conf文件中的“@arches="i386";”一行
7.执行“opensslpasswd-1-salt$(opensslrand-hex4)”生成密码,并用其替换/etc/cobbler/settings文件中default_password_crypted参数
8.安装cam和fance-agents来实现电源管理
通过cobblerget-loaders同步文件:
[root@node1~]#cobblerget-loaders
taskstarted:2014-04-23_212251_get_loaders
taskstarted(id=DownloadBootloaderContent,time=WedApr2321:22:512014)
downloading
downloading
downloading
downloading
downloading
downloading
downloading
downloading
downloading
downloading
四、配置及启动cobbler所依赖的各服务
cobbler的运行依赖于dhcp、tftp、rsync及dns服务,其中dhcp可由dhcpd(isc)提供,也可由dnsmasq提供;tftp可由tftp-server程序包提供,也可由cobbler功能提供,rsync有rsync程序包提供,dns可由bind提供,也可由dnsmasq提供
cobbler可自行管理这些服务中的部分甚至是全部,但需要配置/etc/cobbler/settings文件中的“manange_dhcp”、“manager_tftpd”、“manager_rsync”、“manager_dns”分别来进行定义,另外,由于各种服务都有着不同的实现方式,如若需要进行自定义,需要通过修改/etc/cobbler/modules.conf配置文件中各服务的模块参数的值来实现
本处通过独立管理。即不通过cobbler来管理这些服务
1.配置dhcp服务
定义好所需的“subnet”及其他参数,本处的配置如下:
[root@node1~]#cp/usr/share/doc/dhcp*/dhcpd.conf.sample/etc/dhcp/dhcpd.conf
编辑配置文件
optiondomain-name"wangfeng7399";
optiondomain-name-servers192.168.1.201;
default-lease-time43200;
max-lease-time86400;
log-facilitylocal7;
subnet192.168.1.0netmask255.255.255.0{
range192.168.1.210192.168.1.230
optionrouters192.168.1.253
}
next-server192.168.1.210;
filename="pxelinux.0";
2.配置tftpd服务
[root@node1~]#chkconfigtftpon
五、配置cobbler
CobblerCommands(常用使用命令参数)
**Import
**Sync
**Reposync
**BuildISO(使用发行版、配置文件、制作出系统镜像)
**CommandLineSearch
**Replication
**ValidataKickstart
**ACLSetup
cobbler的各主要组件间的关系如下图所示:
1.管理distro
是cobbler变得可用的第一步为定义distro,其可以通过为其指定外部的安装引导内核及ramdisk文件的方式实现。而如果已经有完成的安装树(如os的安装镜像)则推荐使用improt之间导入的方式进行:
[root@node1~]#mount/dev/cdrom/media
mount:blockdevice/dev/sr0iswrite-protected,mountingread-only
[root@node1~]#cobblerimport--name=centos6.5-x86-64--path=/media/
taskstarted:2014-04-23_214916_import
taskstarted(id=Mediaimport,time=WedApr2321:49:162014)
Foundacandidatesignature:breed=redhat,version=rhel6
Foundamatchingsignature:breed=redhat,version=rhel6
Addingdistrosfrompath/var/www/cobbler/ks_mirror/centos6.5-x86-64:
creatingnewdistro:centos6.5-64-x86_64
tryingsymlink:/var/www/cobbler/ks_mirror/centos6.5-x86-64->/var/www/cobbler/links/centos6.5-64-x86_64
creatingnewprofile:centos6.5-64-x86_64
associatingrepos
checkingforrsyncrepo(s)
checkingforrhnrepo(s)
checkingforyumrepo(s)
startingdescentinto/var/www/cobbler/ks_mirror/centos6.5-x86-64forcentos6.5-64-x86_64
processingrepoat:/var/www/cobbler/ks_mirror/centos6.5-x86-64
needtoprocessrepo/comps:/var/www/cobbler/ks_mirror/centos6.5-x86-64
lookingfor/var/www/cobbler/ks_mirror/centos6.5-x86-64/repodata/*comps*.xml
Keepingrepodataas-is:/var/www/cobbler/ks_mirror/centos6.5-x86-64/repodata
***TASKCOMPLETE***
列出所有的distro:
[root@node1~]#cobblerdistrolist
centos6.5-64-x86_64
如果有kickstart文件,也可以使用--kickstart=/path/to/kickstart_file进行导入,因此import会自动为导入的distro生成一个profile
2.管理profile
cobbler使用profile来为特定的需求类别提供锁需要安装的配置,即在distro的基础上通过提供kiskstart文件来生成一个特定的系统安装配置。distro的profile可以出现在pxe的引导菜单中作为安装的选择之一,关于kickstark文件的讲解可以移步本人的相关博客http://wangfeng7399.blog.51cto.com/3518031/1369553,不出就不再做详细说明:
[root@node1~]#cobblerprofileadd--name=centos6.5-x86_64--distro=centos6.5-64-x86_64kickstart=/root/anaconda-ks.cfg
列出当前系统上的profile:
[root@node1~]#cobblerprofilelist
centos6.5-64-x86_64
centos6.5-x86_64
删除一个profile:
[root@node1~]#cobblerprofileremove--name=centos6.5-64-x86_64
3.重启服务及同步数据到响应的目录
[root@node1~]#servicecobblerdrestart
Stoppingcobblerdaemon:[OK]
Startingcobblerdaemon:[OK]
[root@node1~]#cobblersync
taskstarted:2014-04-23_220652_sync
taskstarted(id=Sync,time=WedApr2322:06:522014)
runningpre-synctriggers
cleaningtrees
removing:/var/www/cobbler/images/centos6.5-64-x86_64
removing:/var/lib/tftpboot/pxelinux.cfg/default
removing:/var/lib/tftpboot/grub/images
removing:/var/lib/tftpboot/grub/efidefault
removing:/var/lib/tftpboot/images/centos6.5-64-x86_64
removing:/var/lib/tftpboot/s390x/profile_list
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
中间省去N行
receivedonstderr:
runningshelltriggersfrom/var/lib/cobbler/triggers/sync/post/*
runningpythontriggersfrom/var/lib/cobbler/triggers/change/*
runningpythontriggercobbler.modules.scm_track
runningshelltriggersfrom/var/lib/cobbler/triggers/change/*
***TASKCOMPLETE***
4.测试
可以看到我们定制的系统启动页面,开始安装系统
系统安装成功,登陆系统
六、使用cobbler_web
cobbler_web支持多种认证方式,如authn_configfil、authn_ldap或authn_pam等,默认为authn_denyall,即拒绝所有用户登陆。下面说明两种能认证用户登录cobbler_web的方式
1.使用authn_pam模块认证cobbler_web用户
首先修改modules中的[authentication]段中的module参数的值为authn_pam,接着设定系统用户,并为用户设定密码,而后将设定的系统用户添加至cobbler_web的admin组中,修改/etc/cobbler/users.conf文件,将设定的用户添加为admin参数的值即可。
2.使用authn_configfile模块认证cobbler_web用户
首先修改modules中的[authentication]段中的module参数的值为authn_configfile,接着创建其认证文件/etc/cobbler/users.digest,并添加所需要的用户即可。需要注意的是,添加第一用户时,需要为htdigest命令使用“-c”选项,后续添加其他用户则不能再使用。
本处使用的为authn_pam
[root@node1~]#vi/etc/cobbler/modules.conf
[authentication]
module=authn_pam
[root@node1~]#useraddwangfeng7399
[root@node1~]#passwdwangfeng7399
Changingpasswordforuserwangfeng7399.
Newpassword:
Retypenewpassword:
passwd:allauthenticationtokensupdatedsuccessfully.
[root@node1~]#vi/etc/cobbler/users.conf
[admins]
admin="wangfeng7399"
完全可以手动添加,这也不为记不住命令而发愁了!
相关文章推荐
- 运维自动化之 Cobbler 系统安装使用详解
- 运维自动化之 Cobbler 系统安装使用详解
- 自动化运维平台之系统自动化安装Cobbler系统使用详解 推荐
- linux中运维自动化之Cobbler 系统安装使用详解
- 运维自动化之 Cobbler 系统安装使用详解
- Linux 运维自动化之Cobbler全自动安装Centos管理与使用详解 推荐
- 运维自动化之使用Cobbler自动化安装系统
- 运维自动化之Cobbler系统安装详解
- 运维自动化之Cobbler系统安装详解
- 运维自动化之使用Cobbler自动化安装系统与FAQ
- 运维自动化之Cobbler系统安装详解(1)
- 运维自动化之Cobbler系统安装详解(1)
- Linux 运维自动化之Cobbler安装与配置详解
- Linux 运维自动化之Cobbler的管理与使用详解
- 使用 Cobbler 自动化和管理系统安装
- ↑使用cobbler实现集群系统运维自动化↑
- CentOS 6.5自动化运维之基于cobbler服务的自动化安装操作系统详解
- 系统运维自动化---cobbler安装
- CentOS 6.5自动化运维之基于cobbler服务的自动化安装操作系统详解
- 使用 Cobbler 自动化和管理系统安装