LoginSignup
1
1

More than 5 years have passed since last update.

UEFI HTTP Boot + Kickstart で OSの自動プロビジョニング

Last updated at Posted at 2019-02-21

最近のサーバはHTTP Bootなるものができるので調査した。IPV6も試したがいくつか問題があり、今回は断念。次回のチャレンジする。

事前準備

  • 192.168.1.1 にプロビジョニング用サーバを用意(hddが10GBあれば十分)
  • httpdと、dhcpdをインストールしておく
  • /media にインストール用DVDをマウントしておく

DHCPサーバの設定

PXEではnext-serverを指定するが、HTTP BOOT では、HTTPClientと、efiのbootイメージのファイル名を指定する。

subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.2 192.168.1.100;
  option subnet-mask 255.255.255.0;
  default-lease-time 3600;
  max-lease-time 7200;

  class "httpclients" {
    match if substring (option vendor-class-identifier, 0, 10) = "HTTPClient";
    option vendor-class-identifier "HTTPClient";
    filename "http://192.168.1.1/boot/bootx64.efi";
  }

}

WEB サーバ側の設定

最低限必要なものは以下の通り

/var/www/html/ks/rhel7.cfg        ... Kickstart のファイル、urlにはhttpでアクセスできる場所を指定する(今回なら、/rhel7/)
/var/www/html/boot/bootx64.efi    ... DVDから抽出したものに、netとhttp モジュールを組み込む必要がある。後述。
/var/www/html/boot/initrd.img     ... DVDから抽出(/media/isolinux/initrd.img)
/var/www/html/boot/vmlinuz        ... DVDから抽出(/media/isolinux/vmlinuz)
/var/www/html/boot/grub.cfg       ... 後述
/var/www/html/rhel7 -> /media     ... DVDのルートにlinkを張っておく

EFI用bootイメージの作成

メディアからコピーしてきたrpmを展開し、モジュールを組み込んだイメージを作成する

rpm2cpio /media/Packages/grub2-efi-x64-modules-xxxxxxxxx.el7.noarch.rpm | cpio -id
grub2-mkimage -d ./usr/lib/grub/x86_64-efi -O x86_64-efi \
    -o bootx64.efi -p '' normal linux http net echo linuxefi

grub.cfgの設定

netとhttpモジュールの有効化と、場所の指定をする

set timeout=10
menuentry 'RHEL 7' {
  insmod net
  insmod http
  linuxefi (http,192.168.1.1)/boot/vmlinuz ip=dhcp inst.repo=http://192.168.1.1/rhel7/ inst.ks=http://192.168.1.1/ks/rhel7.cfg
  initrdefi (http,192.168.1.1)/boot/initrd.img
}

以上

1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1