linux实现cobbler

Cobbler 可以用来快速建立 Linux 网络安装环境,它已将 Linux 网络安装的技术门槛,从大专以上文化水平,成功降低到初中以下,连补鞋匠都能学会

网络安装服务器套件 Cobbler(补鞋匠)从前,我们一直在做装机民工这份很有前途的职业。自打若干年前 Red Hat 推出了 Kickstart,此后我们顿觉身价倍增。不再需要刻了光盘一台一台地安装 Linux,只要搞定 PXEDHCPTFTP,还有那满屏眼花缭乱不知所云的 Kickstart 脚本,我们就可以像哈里波特一样,轻点魔棒,瞬间安装上百台服务器。这一堆花里胡哨的东西可不是一般人都能整明白的,没有大专以上学历,通不过英语四级,根本别想玩转。总而言之,这是一份多么有前途,多么有技术含量的工作啊。很不幸,Red Hat 最新(Cobbler项目最初在2008年左右发布)发布了网络安装服务器套件 Cobbler(鞋匠),它已将 Linux 网络安装的技术门槛,从大专以上文化水平,成功降低到初中以下,连补鞋匠都能学会。对于我们这些在装机领域浸淫多年,经验丰富,老骥伏枥,志在千里的民工兄弟们来说,不啻为一个晴天霹雳。


实验环境

centos-5.8


实验软件

cobbler httpd rsync tftp-server xinetd dhcppython-ctypes cman* pykickstart

ed patch perl perl-Compress-Zlib perl-Cwdperl-Digest-MD5

epel-release-5-4.noarch.rpm

debmirror-20090807-1.el5.noarch.rpm


软件安装

rpm -ivh epel-release-5-4.noarch.rpm

rpm -ivh debmirror-20090807-1.el5.noarch.rpm

yum install cobbler httpd rsync tftp-serverxinetd dhcp python-ctypes -y

yum install -y cman* pykickstart

yum install ed patch perlperl-Compress-Zlib perl-Cwd perl-Digest-MD5 -y

service iptables stop

chkconfig iptables off

cobbler check     检测cobbler运行的问题
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, 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-loaders are missingfrom /var/lib/cobbler/loaders, you may run ‘cobbler get-loaders‘ to downloadthem, or, if you only want to handle x86/x86_64 netbooting, you may ensure thatyou have installed a *recent* version of the syslinux package installed and canignore this message entirely.  Files inthis directory, should you want to support all architectures, should includepxelinux.0, menu.c32, elilo.efi, and yaboot. The ‘cobbler get-loaders‘ commandis the easiest way to resolve these requirements.

4 : change ‘disable‘ to ‘no‘ in/etc/xinetd.d/rsync

5 : since iptables may be running, ensure69, 80/443, and 25151 are unblocked

6 : debmirror package is not installed, itwill be required to manage debian deployments and repositories

7 : ksvalidator was not found, installpykickstart

8 : The default password used by the sampletemplates 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

9 : fencing tools were not found, and arerequired to use the (optional) power management features. install cman orfence-agents to use them

Restart cobblerd and then run ‘cobblersync‘ to apply changes.


vim /etc/httpd/conf.d/wsgi.conf

#LoadModule wsgi_module modules/mod_wsgi.so找到

LoadModulewsgi_module modules/mod_wsgi.so 改为


vim /etc/cobbler/settings

next_server: 127.0.0.1 找到

next_server: 192.168.0.102 改为cobbler服务器的ip地址


server: 127.0.0.1   找到

server: 192.168.0.102   改为cobbler服务器ip地址


manage_dhcp: 0  找到

manage_dhcp: 1  改为1 1为开启 0为关闭)


manage_rsync: 0  找到

manage_rsync: 0  改为1 1为开启 0为关闭)


vim /etc/xinetd.d/tftp

disable  = yes 找到

disable   = no  改为


vim /etc/xinetd.d/rsync

disable  = yes  找到

disable   = no  改为


openssl passwd -1 -salt ‘random-phrase-here‘ ‘123456‘ 此密码为root密码

$1$random-p$mzxQ/Sx848sXgvfwJCoZM0


vim /etc/cobbler/dhcp.template

subnet 192.168.1.0 netmask 255.255.255.0  dhcp分配网段

option routers             192.168.1.5;  dhcp 网关ip

option domain-name-servers 192.168.1.1;   域名服务器

option subnet-mask 255.255.255.0;子网掩码

range dynamic-bootp        192.168.1.100 192.168.1.254;  分配ip的地址段

一切配置遵从个人而定


vim /etc/cobbler/settings

default_password_crypted:"$1$mF86/UHC$WvcIcX2t6crBz2onWxyac." 找到

default_password_crypted: "$1$random-p$mzxQ/Sx848sXgvfwJCoZM0"  改为实际openssl生成的密码


vim /etc/debmirror.conf

@dists="sid";

@arches="i386";   找到着两行


#@dists="sid";

#@arches="i386";  使用#屏蔽


cobbler get-loaders

task started: 2014-04-15_140352_get_loaders

task started (id=Download BootloaderContent, time=Tue Apr 15 14:03:52 2014)

downloadinghttp://www.cobblerd.org/loaders/README to /var/lib/cobbler/loaders/README

downloadinghttp://www.cobblerd.org/loaders/COPYING.elilo to/var/lib/cobbler/loaders/COPYING.elilo

downloadinghttp://www.cobblerd.org/loaders/COPYING.yaboot to/var/lib/cobbler/loaders/COPYING.yaboot

downloadinghttp://www.cobblerd.org/loaders/COPYING.syslinux to/var/lib/cobbler/loaders/COPYING.syslinux

downloadinghttp://www.cobblerd.org/loaders/elilo-3.8-ia64.efi to/var/lib/cobbler/loaders/elilo-ia64.efi

downloadinghttp://www.cobblerd.org/loaders/yaboot-1.3.14-12 to/var/lib/cobbler/loaders/yaboot

downloadinghttp://www.cobblerd.org/loaders/pxelinux.0-3.61 to/var/lib/cobbler/loaders/pxelinux.0

downloadinghttp://www.cobblerd.org/loaders/menu.c32-3.61 to/var/lib/cobbler/loaders/menu.c32

downloadinghttp://www.cobblerd.org/loaders/grub-0.97-x86.efi to/var/lib/cobbler/loaders/grub-x86.efi

downloadinghttp://www.cobblerd.org/loaders/grub-0.97-x86_64.efi to/var/lib/cobbler/loaders/grub-x86_64.efi

*** TASK COMPLETE ***


[root@localhost ~]# cobbler sync

task started: 2014-04-15_151301_sync

task started (id=Sync, time=Tue Apr 1515:13:01 2014)

running pre-sync triggers

cleaning trees

removing: /tftpboot/pxelinux.cfg/default

removing: /tftpboot/grub/images

removing: /tftpboot/grub/efidefault

removing: /tftpboot/grub/grub-x86_64.efi

removing: /tftpboot/grub/grub-x86.efi

removing: /tftpboot/s390x/profile_list

copying bootloaders

trying hardlink/var/lib/cobbler/loaders/grub-x86_64.efi -> /tftpboot/grub/grub-x86_64.efi

trying hardlink/var/lib/cobbler/loaders/grub-x86.efi -> /tftpboot/grub/grub-x86.efi

copying distros to tftpboot

copying images

generating PXE configuration files

generating PXE menu structure

rendering DHCP files

generating /etc/dhcpd.conf

rendering TFTPD files

generating /etc/xinetd.d/tftp

cleaning link caches

rendering Rsync files

running post-sync triggers

running python triggers from/var/lib/cobbler/triggers/sync/post/*

running python triggercobbler.modules.sync_post_restart_services

running: dhcpd -t -q

received on stdout:

received on stderr:

running: service dhcpd restart

received on stdout: Starting dhcpd: [  OK  ]


received on stderr:

running shell triggers from/var/lib/cobbler/triggers/sync/post/*

running python triggers from/var/lib/cobbler/triggers/change/*

running python triggercobbler.modules.scm_track

running shell triggers from/var/lib/cobbler/triggers/change/*

*** TASK COMPLETE ***


cobbler check

No configuration problemsfound.  All systems go.  看到这个提示就是说明配置正确


mkdir-p /system/centos5.8-i386

mount-o loop CentOS-5.8-i386-bin-DVD-1of2.iso /system/centos5.8-i386/

cobbler import --path=/system/centos5.8-i386/ --name=centos5.8-i386

taskstarted: 2014-04-15_152344_import

taskstarted (id=Media import, time=Tue Apr 15 15:23:44 2014)

Founda candidate signature: breed=redhat, version=rhel5

Founda matching signature: breed=redhat, version=rhel5

Addingdistros from path /var/www/cobbler/ks_mirror/centos5.8-i386:

creatingnew distro: centos5.8-xen-i386

tryingsymlink: /var/www/cobbler/ks_mirror/centos5.8-i386 ->/var/www/cobbler/links/centos5.8-xen-i386

creatingnew profile: centos5.8-xen-i386

creatingnew distro: centos5.8-i386

tryingsymlink: /var/www/cobbler/ks_mirror/centos5.8-i386 ->/var/www/cobbler/links/centos5.8-i386

creatingnew profile: centos5.8-i386

associatingrepos

checkingfor rsync repo(s)

checkingfor rhn repo(s)

checkingfor yum repo(s)

startingdescent into /var/www/cobbler/ks_mirror/centos5.8-i386 for centos5.8-xen-i386

processingrepo at : /var/www/cobbler/ks_mirror/centos5.8-i386

needto process repo/comps: /var/www/cobbler/ks_mirror/centos5.8-i386

lookingfor /var/www/cobbler/ks_mirror/centos5.8-i386/repodata/*comps*.xml

running:createrepo -c cache -s sha --groupfile/var/www/cobbler/ks_mirror/centos5.8-i386/repodata/comps.xml /var/www/cobbler/ks_mirror/centos5.8-i386

1877/2669- CentOS/jakarta-commons-collections-testframework-javadoc-3.2-2jpp.3.2669/2669- CentOS/java-1.6.0-openjdk-demo-1.6.0.0-1.24.1.10.4.el5.i386.rpm    

SavingPrimary metadata

Savingfile lists metadata

Savingother metadata


receivedon stderr: This option is deprecated


startingdescent into /var/www/cobbler/ks_mirror/centos5.8-i386 for centos5.8-i386

processingrepo at : /var/www/cobbler/ks_mirror/centos5.8-i386

needto process repo/comps: /var/www/cobbler/ks_mirror/centos5.8-i386

lookingfor /var/www/cobbler/ks_mirror/centos5.8-i386/repodata/*comps*.xml

***TASK COMPLETE ***


du-sh /var/www/cobbler/ks_mirror/centos5.8-i386/

3.7G    /var/www/cobbler/ks_mirror/centos5.8-i386/
du -sh /root/CentOS-5.8-i386-bin-DVD-1of2.iso

3.7G    /root/CentOS-5.8-i386-bin-DVD-1of2.iso


cobblerprofile edit --name=centos5.4-i686-x86_64 --kickstart=   制定ks.cfg路径


cobbler report

distros:

==========

Name                           : centos5.8-xen-i386

Architecture                   : i386

TFTPBoot Files                : {}

Breed                          : redhat

Comment                        :

FetchableFiles                : {}

Initrd                         :/var/www/cobbler/ks_mirror/centos5.8-i386/images/xen/initrd.img

Kernel                         :/var/www/cobbler/ks_mirror/centos5.8-i386/images/xen/vmlinuz

KernelOptions                 : {}

KernelOptions (Post Install)  : {}

KickstartMetadata             : {‘tree‘:‘http://@@http_server@@/cblr/links/centos5.8-xen-i386‘}

ManagementClasses             : []

OSVersion                     : rhel5

Owners                         : [‘admin‘]

RedHat Management Key         :<<inherit>>

RedHat Management Server      :<<inherit>>

TemplateFiles                 : {}


Name                           : centos5.8-i386

Architecture                   : i386

TFTPBoot Files                : {}

Breed                          : redhat

Comment                        :

FetchableFiles                : {}

Initrd                         :/var/www/cobbler/ks_mirror/centos5.8-i386/images/pxeboot/initrd.img

Kernel                         :/var/www/cobbler/ks_mirror/centos5.8-i386/images/pxeboot/vmlinuz

KernelOptions                 : {}

KernelOptions (Post Install)  : {}

KickstartMetadata             : {‘tree‘:‘http://@@http_server@@/cblr/links/centos5.8-i386‘}

ManagementClasses             : []

OSVersion                     : rhel5

Owners                         : [‘admin‘]

RedHat Management Key         : <<inherit>>

RedHat Management Server      :<<inherit>>

TemplateFiles                 : {}



profiles:

==========

Name                           : centos5.8-xen-i386

TFTPBoot Files                : {}

Comment                        :

DHCPTag                       : default

Distribution                   : centos5.8-xen-i386

EnablegPXE?                   : 0

EnablePXE Menu?               : 1

FetchableFiles                : {}

KernelOptions                 : {}

KernelOptions (Post Install)  : {}

Kickstart                      :/var/lib/cobbler/kickstarts/sample.ks

KickstartMetadata             : {}

ManagementClasses             : []

ManagementParameters          :<<inherit>>

NameServers                   : []

NameServers Search Path       : []

Owners                         : [‘admin‘]

ParentProfile                 :

Proxy                          :

RedHat Management Key         :<<inherit>>

RedHat Management Server      :<<inherit>>

Repos                          : []

ServerOverride                :<<inherit>>

TemplateFiles                 : {}

VirtAuto Boot                 : 1

VirtBridge                    : xenbr0

VirtCPUs                      : 1

VirtDisk Driver Type          : raw

VirtFile Size(GB)             : 5

VirtPath                      :

VirtRAM (MB)                  : 512

VirtType                      : xenpv


Name                           : centos5.8-i386

TFTPBoot Files                : {}

Comment                        :

DHCPTag                       : default

Distribution                   : centos5.8-i386

EnablegPXE?                   : 0

EnablePXE Menu?               : 1

FetchableFiles                : {}

KernelOptions                 : {}

KernelOptions (Post Install)  : {}

Kickstart                      : /var/lib/cobbler/kickstarts/sample.ks  

KickstartMetadata             : {}

ManagementClasses             : []

ManagementParameters          :<<inherit>>

NameServers                   : []

NameServers Search Path       : []

Owners                         : [‘admin‘]

ParentProfile                 :

Proxy                          :

RedHat Management Key         :<<inherit>>

RedHat Management Server      :<<inherit>>

Repos                          : []

ServerOverride                :<<inherit>>

TemplateFiles                 : {}

VirtAuto Boot                 : 1

VirtBridge                    : xenbr0

VirtCPUs                      : 1

VirtDisk Driver Type          : raw

VirtFile Size(GB)             : 5

VirtPath                      :

VirtRAM (MB)                  : 512

VirtType                      : kvm



systems:

==========


repos:

==========


images:

==========


mgmtclasses:

==========


packages:

==========


files:

==========


service cobblerd restart

service httpd restart

service httpd restart

到此位置服务端就配置完成了,下面演示如何配置客户端

客户端,启动项调整为网卡启动









本文出自 “mailfile” 博客,谢绝转载!

linux实现cobbler,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。