Fedora15 で Cobbler 環境構築

Cobbler = ネットワークブート用ユーティリティパッケージ
Cobbler のバージョンは以下のとおり。

$ sudo cobbler version
Cobbler 2.0.11
  source: ?, ?
  build time: Tue Apr 26 19:08:26 2011


以下、実際に行なった手順。
Fedora 15インストール

iptables,selinux,ipv6無効化

yum-plugin-fastestmirror インストール&システム最新化

VMWare環境なので、VMWareToolsをインストール


必要なパッケージをインストール & 設定

$ sudo yum -y install cobbler dhcp syslinux
$ sudo vi /etc/cobbler/settings
manage_dhcp: 1

next_server: <DHCPサーバで通知するTFTPサーバのIP、当例の場合は配布サーバと同一つまり自分のIPアドレス>
server: <配布サーバのIPまはFQDN、つまり当例の場合は同上>
$ sudo vi /etc/cobbler/dhcp.template 
subnet 192.168.135.0 netmask 255.255.255.0 {
     option routers             <default_gateway>;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.135.100 192.168.135.254;
     filename                   "/pxelinux.0";
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
}


NIC が2枚あるのでどちらのインターフェースを DHCP に利用するかを設定。

$ sudo vi /etc/sysconfig/dhcpd
DHCPDARGS=eth0


ここで、cobbler を起動 & 設定チェック

$ sudo /etc/rc.d/init.d/cobblerd start
$ sudo chkconfig cobblerd on
$ sudo cobbler check
httpd does not appear to be running and proxying cobbler
$ sudo /etc/rc.d/init.d/httpd start
$ sudo chkconfig httpd on
$ sudo reboot
$ sudo cobbler check
The following are potential configuration items that you may want to fix:

1 : 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.
2 : change 'disable' to 'no' in /etc/xinetd.d/tftp
3 : change 'disable' to 'no' in /etc/xinetd.d/rsync
4 : since iptables may be running, ensure 69, 80, and 25151 are unblocked
5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
6 : 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

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

$ sudo cobbler get-loaders
$ sudo vi /etc/xinetd.d/tftp 
$ sudo vi /etc/xinetd.d/rsync 
//     disable                 = yes
             ↓
        disable                 = no
$ sudo /etc/rc.d/init.d/xinetd restart
$ sudo chkconfig tftp on
$ sudo chkconfig rsync on
$ sudo yum -y install debmirror
$ sudo cobbler check
The following are potential configuration items that you may want to fix:

1 : since iptables may be running, ensure 69, 80, and 25151 are unblocked
2 : comment 'dists' on /etc/debmirror.conf for proper debian support
3 : comment 'arches' on /etc/debmirror.conf for proper debian support
4 : 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

$ sudo vi /etc/debmirror.conf 
@dists="sid";
@arches="i386";
           ↓
# @dists="sid";
# @arches="i386";
$ openssl passwd -1 -salt Q9QuRBrc
 $1$Q9QuRBrc$xq6YBrbLH4qEiN.rf1nWF0
$ sudo vi /etc/cobbler/settings 
default_password_crypted: "$1$Q9QuRBrc$xq6YBrbLH4qEiN.rf1nWF0"
$ sudo /etc/rc.d/init.d/cobblerd restart
$ sudo cobbler check

The following are potential configuration items that you may want to fix:

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

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

iptables の機能をオフにしてるのに↑のメッセージが出るが無視。
いよいよ sync 。

$ sudo cobbler sync
・・・
running: dhcpd -t -q
received on stdout: 
received on stderr: 
running: /etc/rc.d/init.d/dhcpd restart
received on stdout: 
received on stderr: /bin/sh: /etc/rc.d/init.d/dhcpd: No such file or directory

Exception occured: <class 'cobbler.cexceptions.CX'>
Exception value: 'cobbler trigger failed: cobbler.modules.sync_post_restart_services'
Exception Info:
  File "/usr/lib/python2.7/site-packages/cobbler/remote.py", line 95, in run
    rc = self._run(self)
   File "/usr/lib/python2.7/site-packages/cobbler/remote.py", line 184, in runner
    return self.remote.api.sync(self.options.get("verbose",False),logger=self.logger)
   File "/usr/lib/python2.7/site-packages/cobbler/api.py", line 611, in sync
    return sync.run()
   File "/usr/lib/python2.7/site-packages/cobbler/action_sync.py", line 146, in run
    utils.run_triggers(self.api, None, "/var/lib/cobbler/triggers/sync/post/*", logger=self.logger)
   File "/usr/lib/python2.7/site-packages/cobbler/utils.py", line 862, in run_triggers
    raise CX("cobbler trigger failed: %s" % m.__name__)

!!! TASK FAILED !!!


失敗(´・ω・`)。
Fedora15 から一部サービスの管理が init から systemctl に変更になったため、
/etc/rc.d/init.d/dhcpd
が削除された模様。
dhcpd を再起動している部分を書き換え。

$ sudo vi /usr/lib/python2.7/site-packages/cobbler/modules/sync_post_restart_services.py
//44行目
rc = utils.subprocess_call(logger,"/etc/rc.d/init.d/dhcpd restart", shell=True)
    ↓
rc = utils.subprocess_call(logger,"systemctl restart dhcpd.service", shell=True)

サービスを再起動して変更を適用し、 sync

$ sudo /etc/rc.d/init.d/cobblerd restart
$ sudo cobbler sync


ネットワークブート&インストールに必要な情報をDVDからインポート。
ついでに、ローカルリポジトリを構築。

$ sudo mount /dev/cdrom /mnt
$ sudo cobbler import --path=/mnt --name=Fedora15-x86_64

$ sudo cobbler repo add --name=Fedora15-x86_64 --mirror=rsync://ftp.riken.jp/fedora/releases/15/Everything/x86_64/os/
$ sudo cobbler repo add --name=Fedora15-x86_64-updates --mirror=rsync://ftp.riken.jp/fedora/updates/15/x86_64/
$ sudo cobbler reposync


かなり、放置。
続きは後日。


参考1:http://www.server-world.info/query?os=Fedora_15&p=initial_conf&f=2
参考2:http://www.asahi-net.or.jp/~aa4t-nngk/pxeinstall.html
参考3:http://www.cafechantant.com/trac/wiki/cobbler_own_repo
参考4:http://trac.mizzy.org/public/wiki/Cobbler