自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

運(yùn)維自動(dòng)化之Cobbler系統(tǒng)安裝使用詳解

運(yùn)維 系統(tǒng)運(yùn)維 自動(dòng)化
Cobbler是一個(gè)快速網(wǎng)絡(luò)安裝linux的服務(wù),而且在經(jīng)過(guò)調(diào)整也可以支持網(wǎng)絡(luò)安裝windows。使用 Cobbler,您無(wú)需進(jìn)行人工干預(yù)即可安裝機(jī)器。

一、簡(jiǎn)介

Cobbler是一個(gè)快速網(wǎng)絡(luò)安裝linux的服務(wù),而且在經(jīng)過(guò)調(diào)整也可以支持網(wǎng)絡(luò)安裝windows。該工具使用python開(kāi)發(fā),小巧輕便(才15k行python代碼),使用簡(jiǎn)單的命令即可完成PXE網(wǎng)絡(luò)安裝環(huán)境的配置,同時(shí)還可以管理DHCP、DNS、以及yum倉(cāng)庫(kù)、構(gòu)造系統(tǒng)ISO鏡像。

Cobbler支持命令行管理,web界面管理,還提供了API接口,可以方便二次開(kāi)發(fā)使用。

Cobbler客戶端Koan支持虛擬機(jī)安裝和操作系統(tǒng)重新安裝,使重裝系統(tǒng)更便捷。

二、cobbler提供的功能

使用 Cobbler,您無(wú)需進(jìn)行人工干預(yù)即可安裝機(jī)器。Cobbler 設(shè)置一個(gè) PXE 引導(dǎo)環(huán)境(它還可使用 yaboot 支持 PowerPC),并控制與安裝相關(guān)的所有方面,比如網(wǎng)絡(luò)引導(dǎo)服務(wù)(DHCP 和 TFTP)與存儲(chǔ)庫(kù)鏡像。當(dāng)希望安裝一臺(tái)新機(jī)器時(shí),Cobbler 可以:

  • 使用一個(gè)以前定義的模板來(lái)配置 DHCP 服務(wù)(如果啟用了管理 DHCP)

  • 將一個(gè)存儲(chǔ)庫(kù)(yum 或 rsync)建立鏡像或解壓縮一個(gè)媒介,以注冊(cè)一個(gè)新操作系統(tǒng)

  • 在 DHCP 配置文件中為需要安裝的機(jī)器創(chuàng)建一個(gè)條目,并使用您指定的參數(shù)(IP 和 MAC 地址)

  • 在 TFTFP 服務(wù)目錄下創(chuàng)建適當(dāng)?shù)?PXE 文件

  • 重新啟動(dòng) DHCP 服務(wù)以反映更改

  • 重新啟動(dòng)機(jī)器以開(kāi)始安裝(如果電源管理已啟用)

Cobbler 支持眾多的發(fā)行版:Red Hat、Fedora、CentOS、Debian、Ubuntu 和 SuSE。當(dāng)添加一個(gè)操作系統(tǒng)(通常通過(guò)使用 ISO 文件)時(shí),Cobbler 知道如何解壓縮合適的文件并調(diào)整網(wǎng)絡(luò)服務(wù),以正確引導(dǎo)機(jī)器。

Cobbler 可使用 kickstart 模板?;?Red Hat 或 Fedora 的系統(tǒng)使用 kickstart 文件來(lái)自動(dòng)化安裝流程。通過(guò)使用模板,您就會(huì)擁有基本的 kickstart 模板,然后定義如何針對(duì)一種配置文件或機(jī)器配置而替換其中的變量。例如,一個(gè)模板可能包含兩個(gè)變量 $domain和 $machine_name。在 Cobbler 配置中,一個(gè)配置文件指定 domain=mydomain.com,并且每臺(tái)使用該配置文件的機(jī)器在machine_name 變量中指定其名稱。該配置文件中的所有機(jī)器都使用相同的 kickstart 安裝且針對(duì) domain=mydomain.com 進(jìn)行配置,但每臺(tái)機(jī)器擁有其自己的機(jī)器名稱。您仍然可以使用 kickstart 模板在不同的域中安裝其他機(jī)器并使用不同的機(jī)器名稱。

為了協(xié)助管理系統(tǒng),Cobbler 可通過(guò) fence scripts 連接到各種電源管理環(huán)境。Cobbler 支持 apc_snmp、bladecenter、bullpap、drac、ether_wake、ilo、integrity、ipmilan、ipmitool、lpar、rsa、virsh 和 wti。要重新安裝一臺(tái)機(jī)器,可運(yùn)行 reboot system foo命令,而且 Cobbler 會(huì)使用必要的憑據(jù)和信息來(lái)為您運(yùn)行恰當(dāng)?shù)?fence scripts(比如機(jī)器插槽數(shù))。

除了這些特性,還可使用一個(gè)配置管理系統(tǒng) (CMS)。您有兩種選擇:該工具內(nèi)的一個(gè)內(nèi)部系統(tǒng),或者集成一個(gè)現(xiàn)有的外部 CMS,比如 Chef 或 Puppet。借助內(nèi)部系統(tǒng),您可以指定文件模板,這些模板會(huì)依據(jù)配置參數(shù)進(jìn)行處理(與 kickstart 模板的處理方式一樣),然后復(fù)制到您指定的位置。如果必須自動(dòng)將配置文件部署到特定機(jī)器,那么此功能很有用。

使用 koan 客戶端,Cobbler 可從客戶端配置虛擬機(jī)并重新安裝系統(tǒng)。我不會(huì)討論配置管理和koan 特性,因?yàn)樗鼈儾粚儆诒疚牡慕榻B范疇。但是,它們是值得研究的有用特性。

三、安裝配置

1.安裝方式

cobbler可以手動(dòng)編譯安裝,也可以基于yum源的安裝, 如果需要通過(guò)yum源安裝,則需要配置epel源,epel源可以通過(guò)下載官方給的epel源的目錄來(lái)實(shí)現(xiàn)安裝https://fedoraproject.org/wiki/EPEL

 

  1. [root@node1 ~]# yum install cobbler cobbler-web pykickstart debmirror -y 

 

2.檢查配置文件,需要在cobblerd和httpd啟動(dòng)的情況下檢查

  1. [root@node1 ~]# cobbler check 
  2. The following are potential configuration items that you may want to fix: 
  3. 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. 
  4. 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. 
  5. 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. 
  6. 4 : change 'disable' to 'no' in /etc/xinetd.d/rsync 
  7. 5 : comment out 'dists' on /etc/debmirror.conf for proper debian support 
  8. 6 : comment out 'arches' on /etc/debmirror.conf for proper debian support 
  9. 7 : The default password used by the sample templates 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 
  10. 8 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them 

 

 

 

如上個(gè)問(wèn)題的解決辦法為:

1.修改/etc/cobbler/settings文件的server參數(shù)的值為提供cobbler服務(wù)的主機(jī)對(duì)應(yīng)的ip地址

2.修改/etc/cobbler/settings文件的next_server參數(shù)的值為提供PXE服務(wù)的主機(jī)的對(duì)應(yīng)IP地址  

3.如果當(dāng)前節(jié)點(diǎn)可以訪問(wèn)互聯(lián)網(wǎng),執(zhí)行“cobbler get-loader”命令下載pxelinux.0,menu.c32,elilo.efi, 或yaboot文件,否則,需要安裝syslinux程序包,而后復(fù)制/usr/share/syslinux/中的pxelinux.0,menu.c32等文件至/var/lib/cobbler/loaders目錄中 4.將/etc/xinetd.d/rsync中的disable改為no,或者執(zhí)行“chkconfig rsync on”

5.注釋/etc/dedmirror.conf文件中的“@dists="sid";”一行

6.注釋/etc/dedmirror.conf文件中的“@arches="i386";”一行

7.執(zhí)行“openssl passwd -1 -salt $(openssl rand -hex 4)”生成密碼,并用其替換/etc/cobbler/settings文件中default_password_crypted參數(shù)

8.安裝cam和fance-agents來(lái)實(shí)現(xiàn)電源管理

通過(guò)cobbler get-loaders同步文件:

 

  1. [root@node1 ~]# cobbler get-loaders 
  2. task started: 2014-04-23_212251_get_loaders 
  3. task started (id=Download Bootloader Content, time=Wed Apr 23 21:22:51 2014) 
  4. downloading http://www.cobblerd.org/loaders/README to /var/lib/cobbler/loaders/README 
  5. downloading http://www.cobblerd.org/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo 
  6. downloading http://www.cobblerd.org/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot 
  7. downloading http://www.cobblerd.org/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux 
  8. downloading http://www.cobblerd.org/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi 
  9. downloading http://www.cobblerd.org/loaders/yaboot-1.3.14-12 to /var/lib/cobbler/loaders/yaboot 
  10. downloading http://www.cobblerd.org/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0 
  11. downloading http://www.cobblerd.org/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32 
  12. downloading http://www.cobblerd.org/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi 
  13. downloading http://www.cobblerd.org/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi 

四、配置及啟動(dòng)cobbler所依賴的各服務(wù)

 

cobbler的運(yùn)行依賴于dhcp、tftp、rsync及dns服務(wù),其中dhcp可由dhcpd(isc)提供,也可由dnsmasq提供;tftp可由tftp-server程序包提供,也可由cobbler功能提供,rsync有rsync程序包提供,dns可由bind提供,也可由dnsmasq提供

cobbler可自行管理這些服務(wù)中的部分甚至是全部,但需要配置/etc/cobbler/settings文件中的“manange_dhcp”、“manager_tftpd”、“manager_rsync”、“manager_dns”分別來(lái)進(jìn)行定義,另外,由于各種服務(wù)都有著不同的實(shí)現(xiàn)方式,如若需要進(jìn)行自定義,需要通過(guò)修改/etc/cobbler/modules.conf配置文件中各服務(wù)的模塊參數(shù)的值來(lái)實(shí)現(xiàn)

本處通過(guò)獨(dú)立管理。即不通過(guò)cobbler來(lái)管理這些服務(wù)

1.配置dhcp服務(wù)

 定義好所需的“subnet”及其他參數(shù),本處的配置如下: 

  1. [root@node1 ~]# cp /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcp/dhcpd.conf 
  2. 編輯配置文件 
  3. option domain-name "wangfeng7399"; 
  4. option domain-name-servers 192.168.1.201; 
  5. default-lease-time 43200; 
  6. max-lease-time 86400; 
  7. log-facility local7; 
  8. subnet 192.168.1.0 netmask 255.255.255.0 { 
  9.         range 192.168.1.210 192.168.1.230 
  10.         option routers 192.168.1.253 
  11. next-server 192.168.1.210; 
  12. filename="pxelinux.0"

 

 

 

2.配置tftpd服務(wù)

 

  1. [root@node1 ~]# chkconfig tftp on 

 

五、配置cobbler

cobbler的各主要組件間的關(guān)系如下圖所示:

wKiom1Nw3UnBVNxHAAJgNktBY9o030.jpg

  1.管理distro

是cobbler變得可用的***步為定義distro,其可以通過(guò)為其指定外部的安裝引導(dǎo)內(nèi)核及ramdisk文件的方式實(shí)現(xiàn)。而如果已經(jīng)有完成的安裝樹(shù)(如os的安裝鏡像)則推薦使用improt之間導(dǎo)入的方式進(jìn)行:

  1. [root@node1 ~]# mount /dev/cdrom /media 
  2. mount: block device /dev/sr0 is write-protected, mounting read-only 
  3. [root@node1 ~]# cobbler import --name=centos6.5-x86-64 --path=/media/ 
  4. task started: 2014-04-23_214916_import 
  5. task started (id=Media import, time=Wed Apr 23 21:49:16 2014) 
  6. Found a candidate signature: breed=redhatversion=rhel6 
  7. Found a matching signature: breed=redhatversion=rhel6 
  8. Adding distros from path /var/www/cobbler/ks_mirror/centos6.5-x86-64: 
  9. creating new distro: centos6.5-64-x86_64 
  10. trying symlink: /var/www/cobbler/ks_mirror/centos6.5-x86-64 -> /var/www/cobbler/links/centos6.5-64-x86_64 
  11. creating new profile: centos6.5-64-x86_64 
  12. associating repos 
  13. checking for rsync repo(s) 
  14. checking for rhn repo(s) 
  15. checking for yum repo(s) 
  16. starting descent into /var/www/cobbler/ks_mirror/centos6.5-x86-64 for centos6.5-64-x86_64 
  17. processing repo at : /var/www/cobbler/ks_mirror/centos6.5-x86-64 
  18. need to process repo/comps: /var/www/cobbler/ks_mirror/centos6.5-x86-64 
  19. looking for /var/www/cobbler/ks_mirror/centos6.5-x86-64/repodata/*comps*.xml 
  20. Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos6.5-x86-64/repodata 
  21. *** TASK COMPLETE *** 

 

 

 

列出所有的distro:

  1. [root@node1 ~]# cobbler distro list 
  2. centos6.5-64-x86_64 

 

 

 

 如果有kickstart文件,也可以使用--kickstart=/path/to/kickstart_file進(jìn)行導(dǎo)入,因此import會(huì)自動(dòng)為導(dǎo)入的distro生成一個(gè)profile

2.管理profile

 cobbler使用profile來(lái)為特定的需求類別提供鎖需要安裝的配置,即在distro的基礎(chǔ)上通過(guò)提供kiskstart文件來(lái)生成一個(gè)特定的系統(tǒng)安裝配置。distro的profile可以出現(xiàn)在pxe的引導(dǎo)菜單中作為安裝的選擇之一,關(guān)于kickstark文件的講解可以移步本人的相關(guān)博客http://wangfeng7399.blog.51cto.com/3518031/1369553,不出就不再做詳細(xì)說(shuō)明:

 

  1. [root@node1 ~]# cobbler profile add --name=centos6.5-x86_64 --distro=centos6.5-64-x86_64 kickstart=/root/anaconda-ks.cfg 

 

列出當(dāng)前系統(tǒng)上的profile:

  1. [root@node1 ~]# cobbler profile list 
  2. centos6.5-64-x86_64 
  3. centos6.5-x86_64 

 

 

 

刪除一個(gè)profile:

 

  1. [root@node1 ~]# cobbler profile remove --name=centos6.5-64-x86_64 

 

3.重啟服務(wù)及同步數(shù)據(jù)到響應(yīng)的目錄 

 

  1. [root@node1 ~]# service cobblerd restart  
  2. Stopping cobbler daemon:                                   [  OK  ]  
  3. Starting cobbler daemon:                                   [  OK  ]  
  4. [root@node1 ~]# cobbler sync  
  5. task started: 2014-04-23_220652_sync  
  6. task started (id=Synctime=Wed Apr 23 22:06:52 2014)  
  7. running pre-sync triggers  
  8. cleaning trees  
  9. removing: /var/www/cobbler/images/centos6.5-64-x86_64  
  10. removing: /var/lib/tftpboot/pxelinux.cfg/default  
  11. removing: /var/lib/tftpboot/grub/images  
  12. removing: /var/lib/tftpboot/grub/efidefault  
  13. removing: /var/lib/tftpboot/images/centos6.5-64-x86_64  
  14. removing: /var/lib/tftpboot/s390x/profile_list  
  15. copying bootloaders  
  16. trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0  
  17. trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32  
  18. trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot  
  19. 中間省去N行  
  20. received on stderr:  
  21. running shell triggers from /var/lib/cobbler/triggers/sync/post/*  
  22. running python triggers from /var/lib/cobbler/triggers/change/*  
  23. running python trigger cobbler.modules.scm_track  
  24. running shell triggers from /var/lib/cobbler/triggers/change/*  
  25. *** TASK COMPLETE ***  

 

  4.測(cè)試  

 

wKioL1Nw_OLB236xAACzwYdDGI8873.jpg

可以看到我們定制的系統(tǒng)啟動(dòng)頁(yè)面,開(kāi)始安裝系統(tǒng)

wKiom1Nw_Q2zpiUNAAEV8Xm_Jps672.jpg

系統(tǒng)安裝成功,登陸系統(tǒng)

wKiom1Nw_92gOcwhAAEITWN87Q4866.jpg

六、使用cobbler_web

cobbler_web支持多種認(rèn)證方式,如authn_configfil、authn_ldap或authn_pam等,默認(rèn)為authn_denyall,即拒絕所有用戶登陸。下面說(shuō)明兩種能認(rèn)證用戶登錄cobbler_web的方式

1.使用authn_pam模塊認(rèn)證cobbler_web用戶

首先修改modules中的[authentication]段中的module參數(shù)的值為authn_pam,接著設(shè)定系統(tǒng)用戶,并為用戶設(shè)定密碼,而后將設(shè)定的系統(tǒng)用戶添加至cobbler_web的admin組中,修改/etc/cobbler/users.conf文件,將設(shè)定的用戶添加為admin參數(shù)的值即可。  

  2.使用authn_configfile模塊認(rèn)證cobbler_web用戶

首先修改modules中的[authentication]段中的module參數(shù)的值為authn_configfile,接著創(chuàng)建其認(rèn)證文件/etc/cobbler/users.digest,并添加所需要的用戶即可。需要注意的是,添加***用戶時(shí),需要為htdigest命令使用“-c”選項(xiàng),后續(xù)添加其他用戶則不能再使用。

本處使用的為authn_pam

  1. [root@node1 ~]# vi /etc/cobbler/modules.conf 
  2. [authentication] 
  3. module = authn_pam 
  4. [root@node1 ~]# useradd wangfeng7399 
  5. [root@node1 ~]# passwd wangfeng7399 
  6. Changing password for user wangfeng7399. 
  7. New password: 
  8. Retype new password: 
  9. passwd: all authentication tokens updated successfully. 
  10. [root@node1 ~]# vi /etc/cobbler/users.conf 
  11. [admins] 
  12. admin = "wangfeng7399" 

 

 

 

wKioL1NxAGDh2J3xAAJOswKBn8c655.jpg

wKiom1NxAIyQhR8MAAGb1odXoqw457.jpg

wKioL1NxAGGzzHAfAAHX4uWbjiE851.jpg

wKiom1NxAIzzqVTaAAJoJMvRY5w390.jpg

完全可以手動(dòng)添加,這也不為記不住命令而發(fā)愁了!

大功告成,后續(xù)將推出自動(dòng)化運(yùn)維的相關(guān)內(nèi)容,敬請(qǐng)期待!

責(zé)任編輯:黃丹 來(lái)源: 51TCO博客
相關(guān)推薦

2011-09-01 10:22:03

Cobbler運(yùn)維自動(dòng)化

2013-04-17 15:48:51

2013-04-11 17:31:28

運(yùn)維自動(dòng)化Cobbler

2014-08-04 10:10:35

IT運(yùn)維自動(dòng)化運(yùn)維

2013-04-16 14:55:21

自動(dòng)化運(yùn)維Puppet實(shí)戰(zhàn)

2014-09-22 11:24:18

運(yùn)維

2012-05-05 21:28:44

2012-05-05 21:48:43

puppet自動(dòng)化運(yùn)維

2010-08-12 17:39:07

網(wǎng)站運(yùn)維自動(dòng)化管理

2012-05-05 22:27:46

puppet自動(dòng)化運(yùn)維

2012-10-22 14:54:48

2016-03-30 11:53:51

Cobbler運(yùn)維運(yùn)維自動(dòng)化

2017-03-22 18:30:44

Linux運(yùn)維自動(dòng)化ansible

2012-05-05 21:43:27

puppet自動(dòng)化運(yùn)維

2017-03-22 16:31:30

Linux運(yùn)維自動(dòng)化ansible

2012-05-05 21:03:35

puppet自動(dòng)化運(yùn)維

2018-06-23 07:31:05

2020-04-30 15:00:17

運(yùn)維Ansible自動(dòng)化

2015-09-23 16:46:54

架構(gòu)監(jiān)控運(yùn)維自動(dòng)化

2020-12-11 10:20:33

Ansible運(yùn)維軟件包
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)