1. 程式人生 > 實用技巧 >CentOS+Cobbler安裝配置

CentOS+Cobbler安裝配置

系統資訊:CentOS release 6.5 (Final)

核心資訊:2.6.32-431.el6.x86_64


1.安裝epel;

[[email protected]apps]#wgethttp://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
[[email protected]apps]#rpm-ivhepel-release-6-8.noarch.rpm

2.安裝cobbler相關服務;

[[email protected]apps]#yuminstall-ycobblerhttpdtftp-serverxinetddhcprsync

3.啟動相關服務並且檢查配置;

[[email protected]~]#chkconfighttpdon
[[email protected]~]#chkconfigcobblerdon
[[email protected]~]#chkconfigxinetdon
[[email protected]apps]#/etc/init.d/cobblerdrestart
Stoppingcobblerdaemon:[OK]
Startingcobblerdaemon:[OK]
[[email protected]apps]#/etc/init.d/httpdrestart
Stoppinghttpd:[OK]
Startinghttpd:httpd:apr_sockaddr_info_get()failedforcobbler-server
httpd:Couldnotreliablydeterminetheserver'sfullyqualifieddomainname,using127.0.0.1forServerName
[OK]

[[email protected]apps]#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:debmirrorpackageisnotinstalled,itwillberequiredtomanagedebiandeploymentsandrepositories
6:ksvalidatorwasnotfound,installpykickstart
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

Restartcobblerdandthenrun'cobblersync'toapplychanges.

根據上面的提示我們一一進行解決:

1)編輯/etc/cobbler/settings檔案,找到server選項,修改成伺服器實際IP即可(384行左右)。

384 rver: 10.0.1.7

2)編輯/etc/cobbler/settings檔案,找到next_server選項,修改成伺服器實際IP即可(272行左右)。

272 xt_server: 10.0.1.7

3)執行cobbler get-loaders,系統自動下載loader程式,完成修復工作。

[[email protected] apps]# cobbler get-loaders

4)編輯/etc/xinetd.d/rsync,把檔案中disable欄位配置yes改成no

[[email protected] apps]# vim /etc/xinetd.d/rsync

service rsync

{

disable = no

flags = IPv6

socket_type = stream

wait = no

user = root

server = /usr/bin/rsync

server_args = --daemon

log_on_failure += USERID

}

5) 提示debmirror沒有安裝,如果不是debian之類的系統可以忽略。

6)提示需要安裝pykickstart

[[email protected] apps]# yum install -y pykickstart

7)修改cobbler預設密碼,並且更改/etc/cobbler/settings檔案。

[[email protected] apps]# openssl passwd -1 -salt 'random-phrase-here' '123456'

$1$random-p$mzxQ/Sx848sXgvfwJCoZM0
[[email protected] apps]# vim /etc/cobbler/settings 101行)

101 default_password_crypted:"$1$random-p$mzxQ/Sx848sXgvfwJCoZM0"

8)提示需要安裝cman

[[email protected] apps]# yum install -y cman

4.重啟cobbler並且檢查配置檔案。

[[email protected]apps]#/etc/init.d/cobblerdrestart
Stoppingcobblerdaemon:[OK]
Startingcobblerdaemon:[OK]
[[email protected]apps]#cobblercheck
Thefollowingarepotentialconfigurationitemsthatyoumaywanttofix:

1:debmirrorpackageisnotinstalled,itwillberequiredtomanagedebiandeploymentsandrepositories

Restartcobblerdandthenrun'cobblersync'toapplychanges.

5.匯入安裝檔案;

[[email protected]apps]#ls
CentOS-6.5-x86_64-bin-DVD1.isoepel-release-6-8.noarch.rpm
[[email protected]apps]#mount-oloop-tiso9660CentOS-6.5-x86_64-bin-DVD1.iso/mnt
[[email protected]apps]#cobblerimport--path=/mnt--name=CentOS-6.5-x86_64-bin-DVD1

6.配置DHCP服務;

編輯/etc/cobbler/settings修改242行為1如下:

[[email protected]apps]#vim/etc/cobbler/settings
242manage_dhcp:1

編輯/etc/cobbler/dhcp.template修改cobbler dhcp管理模板

[[email protected]apps]#vim/etc/cobbler/dhcp.template
修改如下內容:
subnet10.0.1.0netmask255.255.255.0{
optionrouters10.0.1.254;
optiondomain-name-servers202.106.0.20;
optionsubnet-mask255.255.255.0;
rangedynamic-bootp10.0.1.10010.0.1.120;
default-lease-time21600;
max-lease-time43200;
next-server$next_server;

[[email protected]apps]#/etc/init.d/xinetdrestart
Stoppingxinetd:[OK]
Startingxinetd:[OK]

7.同步cobbler配置;

[[email protected]apps]#cobblersync
taskstarted:2014-09-03_153036_sync
taskstarted(id=Sync,time=WedSep315:30:362014)
runningpre-synctriggers
cleaningtrees
removing:/var/www/cobbler/p_w_picpaths/CentOS-6.5-bin-DVD1-x86_64
removing:/var/lib/tftpboot/pxelinux.cfg/default
removing:/var/lib/tftpboot/grub/p_w_picpaths
removing:/var/lib/tftpboot/grub/grub-x86_64.efi
removing:/var/lib/tftpboot/grub/efidefault
removing:/var/lib/tftpboot/grub/grub-x86.efi
removing:/var/lib/tftpboot/p_w_picpaths/CentOS-6.5-bin-DVD1-x86_64
removing:/var/lib/tftpboot/s390x/profile_list
copyingbootloaders
tryinghardlink/var/lib/cobbler/loaders/grub-x86_64.efi->/var/lib/tftpboot/grub/grub-x86_64.efi
tryinghardlink/var/lib/cobbler/loaders/grub-x86.efi->/var/lib/tftpboot/grub/grub-x86.efi
copyingdistrostotftpboot
copyingfilesfordistro:CentOS-6.5-bin-DVD1-x86_64
tryinghardlink/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64-bin-DVD1/p_w_picpaths/pxeboot/vmlinuz->/var/lib/tftpboot/p_w_picpaths/CentOS-6.5-bin-DVD1-x86_64/vmlinuz
tryinghardlink/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64-bin-DVD1/p_w_picpaths/pxeboot/initrd.img->/var/lib/tftpboot/p_w_picpaths/CentOS-6.5-bin-DVD1-x86_64/initrd.img
copyingp_w_picpaths
generatingPXEconfigurationfiles
generatingPXEmenustructure
copyingfilesfordistro:CentOS-6.5-bin-DVD1-x86_64
tryinghardlink/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64-bin-DVD1/p_w_picpaths/pxeboot/vmlinuz->/var/www/cobbler/p_w_picpaths/CentOS-6.5-bin-DVD1-x86_64/vmlinuz
tryinghardlink/var/www/cobbler/ks_mirror/CentOS-6.5-x86_64-bin-DVD1/p_w_picpaths/pxeboot/initrd.img->/var/www/cobbler/p_w_picpaths/CentOS-6.5-bin-DVD1-x86_64/initrd.img
WritingtemplatefilesforCentOS-6.5-bin-DVD1-x86_64
renderingDHCPfiles
generating/etc/dhcp/dhcpd.conf
renderingTFTPDfiles
generating/etc/xinetd.d/tftp
processingboot_filesfordistro:CentOS-6.5-bin-DVD1-x86_64
cleaninglinkcaches
runningpost-synctriggers
runningpythontriggersfrom/var/lib/cobbler/triggers/sync/post/*
runningpythontriggercobbler.modules.sync_post_restart_services
running:dhcpd-t-q
receivedonstdout:
receivedonstderr:
running:servicedhcpdrestart
receivedonstdout:Startingdhcpd:[OK]

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***

到此cobbler配置已經完成,可以用虛擬機器進行測試。

wKiom1QSVD3iJb-_AADBHhHwPKA114.jpg

8.安裝cobbler-web;

[[email protected]~]#yuminstall-ycobbler-web
[[email protected]~]#/etc/init.d/httpdrestart
Stoppinghttpd:[OK]
Startinghttpd:httpd:apr_sockaddr_info_get()failedforcobbler-server
httpd:Couldnotreliablydeterminetheserver'sfullyqualifieddomainname,using127.0.0.1forServerName
[OK]

訪問地址:http://ip/cobbler_web

Username:cobbler

Password:cobbler

wKioL1QSVKKiBIr9AAFh_GVHAxA392.jpg



登陸之後的介面:

wKiom1QSVNnRo6B-AAIYNJ49-zg420.jpg

轉載於:https://blog.51cto.com/jerry0117/1551439