溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Cobbler系統(tǒng)如何安裝使用

發(fā)布時間:2021-10-29 10:32:27 來源:億速云 閱讀:130 作者:小新 欄目:系統(tǒng)運維

小編給大家分享一下Cobbler系統(tǒng)如何安裝使用,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

一、簡介

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

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

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

二、cobbler提供的功能

使用 Cobbler,您無需進行人工干預即可安裝機器。Cobbler 設置一個 PXE 引導環(huán)境(它還可使用 yaboot 支持 PowerPC),并控制與安裝相關的所有方面,比如網絡引導服務(DHCP 和 TFTP)與存儲庫鏡像。當希望安裝一臺新機器時,Cobbler 可以:

  • 使用一個以前定義的模板來配置 DHCP 服務(如果啟用了管理 DHCP)

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

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

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

  • 重新啟動 DHCP 服務以反映更改

  • 重新啟動機器以開始安裝(如果電源管理已啟用)

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

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

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

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

使用 koan 客戶端,Cobbler 可從客戶端配置虛擬機并重新安裝系統(tǒng)。我不會討論配置管理和koan 特性,因為它們不屬于本文的介紹范疇。但是,它們是值得研究的有用特性。

三、安裝配置

1.安裝方式

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

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

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

[root@node1 ~]# cobbler check 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 : change 'disable' to 'no' in /etc/xinetd.d/rsync 5 : comment out 'dists' on /etc/debmirror.conf for proper debian support 6 : comment out 'arches' on /etc/debmirror.conf for proper debian support 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 8 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

如上個問題的解決辦法為:

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

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

3.如果當前節(jié)點可以訪問互聯(lián)網,執(zhí)行“cobbler get-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,或者執(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來實現(xiàn)電源管理

通過cobbler get-loaders同步文件:

[root@node1 ~]# cobbler get-loaders task started: 2014-04-23_212251_get_loaders task started (id=Download Bootloader Content, time=Wed Apr 23 21:22:51 2014) downloading http://www.cobblerd.org/loaders/README to /var/lib/cobbler/loaders/README downloading http://www.cobblerd.org/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo downloading http://www.cobblerd.org/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot downloading http://www.cobblerd.org/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux downloading http://www.cobblerd.org/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi downloading http://www.cobblerd.org/loaders/yaboot-1.3.14-12 to /var/lib/cobbler/loaders/yaboot downloading http://www.cobblerd.org/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0 downloading http://www.cobblerd.org/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32 downloading http://www.cobblerd.org/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi downloading http://www.cobblerd.org/loaders/grub-0.97-x86_64.efi to /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”分別來進行定義,另外,由于各種服務都有著不同的實現(xiàn)方式,如若需要進行自定義,需要通過修改/etc/cobbler/modules.conf配置文件中各服務的模塊參數(shù)的值來實現(xiàn)

本處通過獨立管理。即不通過cobbler來管理這些服務

1.配置dhcp服務

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

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

2.配置tftpd服務

[root@node1 ~]# chkconfig tftp on

五、配置cobbler

cobbler的各主要組件間的關系如下圖所示:

Cobbler系統(tǒng)如何安裝使用

  1.管理distro

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

[root@node1 ~]# mount /dev/cdrom /media mount: block device /dev/sr0 is write-protected, mounting read-only [root@node1 ~]# cobbler import --name=centos6.5-x86-64 --path=/media/ task started: 2014-04-23_214916_import task started (id=Media import, time=Wed Apr 23 21:49:16 2014) 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.5-x86-64: creating new distro: centos6.5-64-x86_64 trying symlink: /var/www/cobbler/ks_mirror/centos6.5-x86-64 -> /var/www/cobbler/links/centos6.5-64-x86_64 creating new profile: centos6.5-64-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.5-x86-64 for centos6.5-64-x86_64 processing repo at : /var/www/cobbler/ks_mirror/centos6.5-x86-64 need to process repo/comps: /var/www/cobbler/ks_mirror/centos6.5-x86-64 looking for /var/www/cobbler/ks_mirror/centos6.5-x86-64/repodata/*comps*.xml Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos6.5-x86-64/repodata *** TASK COMPLETE ***

列出所有的distro:

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

如果有kickstart文件,也可以使用--kickstart=/path/to/kickstart_file進行導入,因此import會自動為導入的distro生成一個profile

2.管理profile

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

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

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

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

刪除一個profile:

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

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

[root@node1 ~]# service cobblerd restart  Stopping cobbler daemon:                                   [  OK  ]  Starting cobbler daemon:                                   [  OK  ]  [root@node1 ~]# cobbler sync  task started: 2014-04-23_220652_sync  task started (id=Sync, time=Wed Apr 23 22:06:52 2014)  running pre-sync triggers  cleaning trees  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  copying bootloaders  trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0  trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32  trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot  中間省去N行  received on stderr:  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/*  *** TASK COMPLETE ***

  4.測試  

Cobbler系統(tǒng)如何安裝使用

可以看到我們定制的系統(tǒng)啟動頁面,開始安裝系統(tǒng)

Cobbler系統(tǒng)如何安裝使用

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

Cobbler系統(tǒng)如何安裝使用

六、使用cobbler_web

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

1.使用authn_pam模塊認證cobbler_web用戶

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

  2.使用authn_configfile模塊認證cobbler_web用戶

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

本處使用的為authn_pam

[root@node1 ~]# vi /etc/cobbler/modules.conf [authentication] module = authn_pam [root@node1 ~]# useradd wangfeng7399 [root@node1 ~]# passwd wangfeng7399 Changing password for user wangfeng7399. New password: Retype new password: passwd: all authentication tokens updated successfully. [root@node1 ~]# vi /etc/cobbler/users.conf [admins] admin = "wangfeng7399"

Cobbler系統(tǒng)如何安裝使用

Cobbler系統(tǒng)如何安裝使用

Cobbler系統(tǒng)如何安裝使用

Cobbler系統(tǒng)如何安裝使用

以上是“Cobbler系統(tǒng)如何安裝使用”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業(yè)資訊頻道!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經查實,將立刻刪除涉嫌侵權內容。

AI