天天看點

cobbler

cobbler 目前最新版本為2.6.9 官網為http://cobbler.github.io/

一,安裝cobbler

以下是相關配置路徑(預設安裝) :

Cobbler 配置主要位置:/var/lib/cobbler/ (實際操作和配置的目錄 )

snippets 代碼  位置:/var/lib/cobbler/snippets/

Kickstart 模闆  位置 : /var/lib/cobbler/kickstarts/

安裝源鏡像       位置 : /var/www/cobbler/ks_mirror/ (把它link到apache的釋出目錄,友善kickstart 工作時通過http下載下傳安裝鏡像檔案 )

yum install cobbler cobbler-web pykickstart debmirror -y      

二,解決cobbler初始化問題

[root@cobbler yum.repos.d]#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 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:

    https://github.com/cobbler/cobbler/wiki/Selinux

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

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

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

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

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

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

Restart cobblerd and then run 'cobbler sync' to apply changes.

  1. 在/etc/cobbler/settings裡配置server的位址
  2. 在/etc/cobbler/settings裡配置next_server的位址
  3. 修改SELinux的配置檔案vim /etc/selinux/config 為disabled
  4. 執行cobbler get-loaders
  5. change 'disable' to 'no' in /etc/xinetd.d/rsync
  6. 注釋/etc/debmirror.conf中的dists行
  7. 注釋/etc/debmirror.conf中的arches行
  8. 執行以下指令加密密碼并替換/etc/cobbler/settings的default_password_crypted

    [root@cobbler ~]# openssl passwd -1 -salt 'random-phrase-here' 'jiayuan.com'       

    $1$random-p$CiZoWfdQPZ.Hcyd/MxC/31

  9. 安裝cman 和 fence-agents

三,安裝并管理所需服務

yum -y install dhcp tftp rsync xinetd      

四,啟動web界面

    要想啟動web界面,就必須要先啟動httpd,啟動後如下:

cobbler

四,導入系統鏡像

    首先挂載系統鏡像,然後執行令導入系統鏡像。

mount -o loop /var/iso/CentOS-6.4-x86_64.iso /mnt/os/
cobbler import --path=/mnt/os/ --name=centos6.4 --arch=x86_64      

    注意: 這個安裝源的唯一标示 就是根據這兩個參數來定義name,arch.導入系統後檢視

cobbler distro list
cobbler profile find --distro=***    #檢視配置檔案是否存在
cobbler profile remove --name=***    #删除配置檔案
cobbler profile find --distro=***    #再檢視配置已無
cobbler distro remove --name=****    #删除distro      

五、自定義profile

cobbler profile add --name=centos6.3-x86_64 --distro=rhel6.3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/6u33w.ks      
cobbler profile report --name  centos6.3-x86_64 
ksfile=$( cobbler profile report --name  centos6.3-x86_64|grep -E '^Kickstart' |head -n 1|cut -d ':' -f 2 );cat $ksfile;      

繼續閱讀