Ubuntu ServerにCobblerインストール
UbuntuサーバにCobblerをインストールして使ってみる. CobblerからインストールするのもUbuntu
- 最終更新 2014/05/02
モチベーション
- Ubuntu Severを何台かインストール・セットアップしたい。一台一台インストールは面倒。
- どうせなら外から管理しよう。PXEブートの環境用意しなきゃ。
- CobblerがDHCPやTFTPを良きに管理してくれるらしい。使ってみよう。
Install
$ sudo apt-get install cobbler cobbler-web
チェック
$ sudo cobbler check
追加しろと言われるので,,,,
$ sudo apt-get install debmirror
dhcpdのインストール
どのdhcp入れるのが良いかは詳しくない.
sudo apt-get install isc-dhcp-server
dhcpの設定変更
Cobblerの設定するとdhcp側の設定を変えなくても勝手に反映される. ルーティングとかDNSとかしないのでコメントアウトしてある.
$ sudo vi /etc/cobbler/dhcp.template
# ****************************************************************** # Cobbler managed dhcpd.conf file # # generated from cobbler dhcp.conf template ($date) # Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes # in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be # overwritten. # # ****************************************************************** ddns-update-style interim; allow booting; allow bootp; ignore client-updates; set vendorclass = option vendor-class-identifier; subnet 192.168.0.0 netmask 255.255.255.0 { # option routers 192.168.0.1; # option domain-name-servers 192.168.0.1; option subnet-mask 255.255.255.0; range dynamic-bootp 192.168.0.100 192.168.0.254; filename "/pxelinux.0"; default-lease-time 21600; max-lease-time 43200; next-server 192.168.0.2; }
いろいろ設定
以下の3点を設定
$ sudo vi /etc/cobbler/settings
- manage_dhcp: 0 + manage_dhcp: 1
next_server: 192.168.0.2
server: 192.168.0.2
サービス再起動
$ sudo service cobbler restart $ sudo cobbler sync
チェック
$ sudo cobbler check
ユーザ追加
$ sudo htdigest /etc/cobbler/users.digest "cobbler" cobbler
ISOファイルのマウント.ループバックな感じで
$ sudo mount -o loop [isoファイル] /mnt
cobblerへimport
$ sudo cobbler import --name=ubuntu-server --path=mnt --breed=ubuntu
webで確認
http://192.168.0.2/cobbler_web/
preseed(kickstart)の編集
preseedの作成.中身の保証はしない.
apt-mirrorが前の日記のものを参照するようになっている.
d-i debian-installer/locale string en_US.UTF-8 d-i debian-installer/splash boolean false d-i console-setup/ask_detect boolean false d-i console-setup/layoutcode string us d-i console-setup/variantcode string d-i netcfg/dhcp_failed note d-i netcfg/dhcp_options select Configure network manually d-i clock-setup/utc boolean true d-i partman-auto/method string regular d-i partman-lvm/device_remove_lvm boolean true d-i partman-lvm/confirm boolean true d-i partman/confirm_write_new_label boolean true d-i partman/choose_partition select Finish partitioning and write changes to disk d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true d-i partman/default_filesystem string ext3 d-i clock-setup/utc boolean true d-i clock-setup/ntp boolean true d-i clock-setup/ntp-server string ntp.ubuntu.com d-i base-installer/kernel/image string linux-server d-i passwd/root-login boolean false d-i passwd/make-user boolean true d-i passwd/user-fullname string ubuntu d-i passwd/username string ubuntu d-i passwd/user-password-crypted password $6$.1eHH0iY$ArGzKX2YeQ3G6U.mlOO3A.NaL22Ewgz8Fi4qqz.Ns7EMKjEJRIW2Pm/TikDptZpuu7I92frytmk5YeL.9fRY4. d-i passwd/user-uid string d-i user-setup/allow-password-weak boolean false d-i user-setup/encrypt-home boolean false d-i passwd/user-default-groups string adm cdrom dialout lpadmin plugdev sambashare d-i mirror/country string manual d-i mirror/http/hostname string 192.168.0.3 d-i mirror/http/directory string /ubuntu #d-i mirror/suite string precise d-i mirror/suite string trusty d-i mirror/udeb/components multiselect main, restricted, multiverse, universe d-i apt-setup/restricted boolean true d-i apt-setup/universe boolean true d-i apt-setup/multiverse boolean true d-i apt-setup/services-select multiselect security d-i apt-setup/security_host string 192.168.0.3 d-i apt-setup/security_path string /ubuntu d-i debian-installer/allow_unauthenticated string false d-i pkgsel/upgrade select safe-upgrade d-i pkgsel/language-packs multiselect d-i pkgsel/update-policy select none d-i pkgsel/updatedb boolean true d-i grub-installer/skip boolean false d-i lilo-installer/skip boolean false d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean true d-i finish-install/keep-consoles boolean false d-i finish-install/reboot_in_progress note d-i cdrom-detect/eject boolean true d-i debian-installer/exit/halt boolean false d-i debian-installer/exit/poweroff boolean false d-i pkgsel/include string openssh-server
preseedのセットアップ
Webでセットしてセーブ
sync
$ sudo service cobbler restart
$ sudo cobbler sync
試す.
とりあえず,インストール始まればおk
デフォルトの変更
上記の設定では何も触らないと(local)が選択され,PXEブートが開始されない. デフォルトを変更する
$ sudo cobbler system add --name=default --profile=ubuntu1404-server-amd64 $ sudo cobbler sync
もちろん"ubuntu1404-server"には自分がデフォルトに設定したいProfileの名前が入る.
MACアドレスを指定し,個別自動インストール
- 上記のname部分をMACアドレスにすることで個別にprofileを設定することができる.
$ sudo cobbler system add --name=00:00:00:00:00:01 --profile=ubuntu1204-server-amd64 $ sudo cobbler sync
その他設定いろいろ
- ここ( http://blog.glidenote.com/blog/2012/03/16/cobbler-system-add/ )とかここ( http://zinrai.github.io/blog/html/2013/06/22/centos_cobbler_puppet_install.html )にsystem addの設定についていろいろあった.実際の動作は確かめて無い.
system add の他,system editで編集ができるらしい.
以下オプション
pxe_just_onceを有効にする(/etc/cobbler/setting で設定する.デフォルトは1で有効)と登録したsystemは1度しかpxe_bootしない.もう1度インストールしたくなったら以下のコマンドを実行
$ sudo cobbler system edit --name=hogehoge-server --netboot-enabled=1
- 設定の確認は以下のコマンド
$ sudo cobbler report
Reference
- http://www.colinmcnamara.com/setting-up-cobbler-pxe-auto-deployment-for-ubuntu-server-12-04-precise/
- http://ideasnet.wordpress.com/2013/05/31/ubuntu-server-using-cobbler-to-install-ubuntu-12-04lts-mini-in-4-or-more-machines/
- https://www.ibm.com/developerworks/jp/linux/library/l-cobbler/#ibm-pcon
- http://www.asahi-net.or.jp/~aa4t-nngk/pxeinstall.html
- http://zinrai.github.io/blog/html/2013/06/22/centos_cobbler_puppet_install.html
- http://blog.glidenote.com/blog/2012/03/16/cobbler-system-add/