天天看點

cobbler基礎安裝

epel源安裝

rpm -ivh epel-release-6-8.noarch.rpm

yum -y install cobbler httpd rsync tftp-server xinetd dhcp cobbler-web koan pykickstart* fence-agents* debmirror syslinux

$$$$$$$$$$$啟動cobbler服務

/etc/init.d/cobblerd start

$$$$$$$$啟動httpd服務

/etc/init.d/httpd start

$$$$$$$$$$檢測

cobbler check

$$$$$$$$$$$$$問題1:

Traceback (most recent call last):

  File "/usr/bin/cobbler", line 36, in <module>

    sys.exit(app.main())

  File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 657, in main

    rc = cli.run(sys.argv)

  File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 270, in run

    self.token         = self.remote.login("", self.shared_secret)

  File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__

    return self.__send(self.__name, args)

  File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request

    verbose=self.__verbose

  File "/usr/lib64/python2.6/xmlrpclib.py", line 1253, in request

    return self._parse_response(h.getfile(), sock)

  File "/usr/lib64/python2.6/xmlrpclib.py", line 1392, in _parse_response

    return u.close()

  File "/usr/lib64/python2.6/xmlrpclib.py", line 838, in close

    raise Fault(**self._stack[0])

xmlrpclib.Fault: <Fault 1: "<class 'cobbler.cexceptions.CX'>:'login failed'">

$$$$$$$$$$$$解決方法:

service cobblerd restart

cobbler get-loaders

$$$$$$$$$$$$$$$$$$$問題2:

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 : 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. 

4 :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/.*"

5 : change 'disable' to 'no' in /etc/xinetd.d/rsync

    change 'disable' to 'no' in /etc/xinetd.d/tftp

6 : comment out 'dists' on /etc/debmirror.conf for proper debian support 

    comment out 'arches' on /etc/debmirror.conf for proper debian support

7 :since iptables may be running, ensure 69, 80, and 25151 are unblocked

8 : The default pass<a href="http://www.it165.net/edu/ebg/" target="_blank" class="keylink">word</a> used by the sample templates for newly installed machines (default_pass<a href="http://www.it165.net/edu/ebg/" target="_blank" class="keylink">word</a>_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.

9,debmirror package is not installed, it will be required to manage debian deployments and repositories

$$$$$$$$$$$$$$$$$$$$$上面這段資訊大意就是:

1,編輯/etc/cobbler/settings檔案,找到 server:選項,修改為适當的ip位址,本執行個體配置ip為:192.168.10.1

2,編輯/etc/cobbler/settings檔案,找到 next_server:選項,修改為适當的ip位址,本執行個體配置ip為:192.168.10.1

4,SELinux的設定。如果上面已經關閉了SELinux就不用管了,SELinux的設定。如果上面已經關閉了SELinux就不用管了

3,執行 cobbler get-loaders,系統将自動下載下傳loader程式,完成提示4的修複工作。

5,編輯/etc/xinetd.d/tftp檔案,将檔案中的disable字段的配置由yes改為no

   編輯/etc/xinetd.d/rsync檔案,将檔案中的disable字段的配置由yes改為no

6. 在/etc/debmirror.conf檔案中注釋dists和arches

7,在iptables中将69,80,25151端口打開。如果僅僅隻是在内部環境中使用,建議直接将防火牆關掉

9,提示說debmirror沒安裝。如果不是安裝 debian之類的系統,此提示可以忽略,如果需要安裝,下載下傳位址為:

http://rpmfind.net/linux/rpm2html/search.php?query=debmirror

CentOS 6使用RHEL 5的包就可以。

8,修改cobbler使用者的預設密碼,可以使用如下指令生成密碼,并使用生成後的密碼替換/etc/cobbler/settings    (default_password_crypted: )中的密碼。生成密碼指令:

openssl passwd -1 -salt '使用者' '密碼'

其中“random-phrase-here”為幹擾碼

$$$$$$$$$$$$$$$$$$$$$解決方案:

1.vim /etc/cobbler/settings

      server: 192.168.1.20

2.vim /etc/cobbler/settings

      next_server: 192.168.1.20

3.  cobbler get-loaders 

4.vim /etc/sysconfig/selinuc

      SELINUX=disabled

5. vim /etc/xinetd.d/rsync

      disable = no

   vim /etc/xinetd.d/tftp

   service xinetd start 

6.vim /etc/debmirror.conf

     #@dists="sid";

     #@arches="i386";

7./etc/init.d/iptables stop或

  iptables -F

  iptables -X

  /etc/init.d/iptables save

8. openssl passwd -1 -salt 'maishujie' '123456'

     $1$maishujie$MqApDf9CDu.SNuvbG/ju70

 vim /etc/cobbler/settings 

default_password_crypted: "$1$maishujie$MqApDf9CDu.SNuvbG/ju70"

9.忽略

如遇到其他問題根據錯誤提示解決

/etc/init.d/cobbler restart

cobbler sync

顯示No configuration problems found.  All systems go.及為正常

$$$$$$$$$$$$$$查詢啟動端口netstat -ntulp

######################cobbler的使用

vim /etc/cobbler/settings 

mange_dhcp: 1

mange_tftpd:1

pxe_just_once:1

$$$$$$$$$$$$$$$$$$$$定制dhcp模闆(Ifconfig eth0:0 192.168.10.254/24)

vi /etc/cobbler/dhcp.template

subnet 192.168.10.0 netmask 255.255.255.0 {

     option routers             192.168.10.254;

     option domain-name-servers 202.106.0.20;

     option subnet-mask         255.255.255.0;

     range dynamic-bootp        192.168.10.100 192.168.10.200;

     default-lease-time         21600;

     max-lease-time             43200;

     next-server                $next_server;

     class "pxeclients" {

          match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";

          if option pxe-system-type = 00:02 {

                  filename "ia64/elilo.efi";

          } else if option pxe-system-type = 00:06 {

                  filename "grub/grub-x86.efi";

          } else if option pxe-system-type = 00:07 {

                  filename "grub/grub-x86_64.efi";

          } else {

                  filename "pxelinux.0";

          }

     }

}

$$$$$$$$$$$$$$$$重新開機伺服器 /etc/init.d/cobbler restart

more /etc/dhcp/dhcpd.conf 驗證模闆更新

more /etc/xinetd.d/tftp

$$$$$$$$$$$建立目錄

yum -y install lrzsz

放置ios檔案目錄mkdir -pv /data/iso

     rz選擇iso檔案上傳

挂載目錄mkdir /data/sys/centos6.4_64

挂載 mount -o loop /data/iso/CentOS-6.4-x86_64-bin-DVD1.iso /data/centos6.4_64

ks檔案放置目錄mkdir /data/ks/centos6.4_64

       rz選擇ks檔案上傳

$$$$$$$$$$$$導入安裝檔案

 cobbler import --path=/data/sys/centos6.4_64/ --name=centos6.4_64 --kickstart=/data/ks/centos6.4_64/ks.cfg --arch=x86_64

顯示

task started: 2015-08-14_010049_import

task started (id=Media import, time=Fri Aug 14 01:00:49 2015)

Found a candidate signature: breed=redhat, version=rhel6

Found a matching signature: breed=redhat, version=rhel6

Adding distros from path /var/www/cobbler/ks_mirror/centos6.4_i386-x86_64:

creating new distro: centos6.4-x86_64

trying symlink: /var/www/cobbler/ks_mirror/centos6.4_i386-x86_64 -> /var/www/cobbler/links/centos6.4-x86_64

creating new profile: centos6.4-x86_64

associating repos

checking for rsync repo(s)

checking for rhn repo(s)

checking for yum repo(s)

starting descent into /var/www/cobbler/ks_mirror/centos6.4_i386-x86_64 for centos6.4-x86_64

processing repo at : /var/www/cobbler/ks_mirror/centos6.4_i386-x86_64

need to process repo/comps: /var/www/cobbler/ks_mirror/centos6.4_i386-x86_64

looking for /var/www/cobbler/ks_mirror/centos6.4_i386-x86_64/repodata/*comps*.xml

Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos6.4_i386-x86_64/repodata

*** TASK COMPLETE ***

從上面顯示資訊所知,cobbler會将鏡像中的拷貝到本地一份,放在/var/www/cobbler/ks_mirrors下的centos- 6.0-i386目錄下。同時會建立一個名字為centos-6.0-i386的一個釋出版本,以及一個名字為centos-6.0-i386的 profile檔案。

service xinetd restart 

$$$$$$$$$$$$$$$同步cobbler配置

# cobbler sync

ask started: 2011-08-11_170706_sync

task started (id=Sync, time=Thu Aug 11 17:07:06 2011)

running pre-sync triggers

cleaning trees

removing: /var/www/cobbler/images/centos-6.0-i386

removing: /var/lib/tftpboot/pxelinux.cfg/default

removing: /var/lib/tftpboot/grub/images

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

removing: /var/lib/tftpboot/grub/efidefault

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

removing: /var/lib/tftpboot/images/centos-6.0-i386

removing: /var/lib/tftpboot/s390x/profile_list

copying bootloaders

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

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

copying distros

copying files for distro: centos-6.0-i386

trying hardlink /var/www/cobbler/ks_mirror/centos-6.0-i386/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos-6.0-i386/vmlinuz

trying hardlink /var/www/cobbler/ks_mirror/centos-6.0-i386/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos-6.0-i386/initrd.img

trying hardlink /var/www/cobbler/ks_mirror/centos-6.0-i386/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos-6.0-i386/vmlinuz

trying hardlink /var/www/cobbler/ks_mirror/centos-6.0-i386/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos-6.0-i386/initrd.img

copying images

generating PXE configuration files

rendering DHCP files

generating /etc/dhcp/dhcpd.conf

cleaning link caches

generating PXE menu structure

running post-sync triggers

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

running python trigger cobbler.modules.sync_post_restart_services

running: dhcpd -t -q

received on stdout:

received on stderr:

running: /etc/rc.d/init.d/dhcpd restart

received on stdout: Shutting down dhcpd: [  OK  ]

Starting dhcpd: [  OK  ]

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

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

running python trigger cobbler.modules.scm_track

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

cobbler會自動進行初始化工作,移除已經存在的啟動項,然後根據模闆拷貝loader檔案。之後再生成pxe的配置檔案,生成dhcp的配置檔案,最後再重新開機dhcp服務。

至此,就可以使用虛拟機來測試cobbler安裝了。

本文轉自 msj0905 51CTO部落格,原文連結:http://blog.51cto.com/sky66/1685072