LoginSignup
1
5

More than 5 years have passed since last update.

CentOS7+pxe+dhcp(ネットワークブートinstall)-1

Last updated at Posted at 2018-02-13

PXEブートマシンに必要なPackage

syslinux
dhcp
tftp-server
httpd
xinetd

起動プロセス

httpd
xinetd  ・・tftpはxinetdにて起動
dhcp

DHCP.conf

allow booting;
allow bootp;

ignore client-updates;
set vendorclass = option vendor-class-identifier;

option pxe-system-type code 93 = unsigned integer 16;

subnet 192.168.1.0 netmask 255.255.255.0 {
   option subnet-mask         255.255.255.0;
   option dhcp-server-identifier 192.168.1.254;
   option broadcast-address 192.168.1.255;
   range dynamic-bootp        192.168.1.150 192.168.1.159;         ←IPレンジの指定
   default-lease-time         21600;
   max-lease-time             43200;
   next-server                192.168.1.11;                    ←DHCPサーバ自身のIP
   filename                   "/linux_install/pxelinux.0";           ←PXEメニューのパス
}

tftp起動ファイル

 service tftp
 {
     socket_type             = dgram
    protocol                = udp
    wait                    = yes
    user                    = root
    server                  = /usr/sbin/in.tftpd
    server_args             = -c -u root -s /var/lib/tftpboot      ←tftpルートディレクトリ
    disable                 = no                            ←デフォルトはdisableなので、enableに変更
    per_source              = 11
    cps                     = 100 2
    flags                   = IPv4
 }

PXEブート準備

/var/lib/tftpboot/linux_install配下に、pxelinux.0や、menu.c32、mboot.c32などのPXEブート用ファイルの配置
※syslinuxパッケージからコピーでOK
下記のような感じ

# mkdir /var/lib/tftpboot/linux_install
# cp -rp /usr/share/syslinux/* /var/lib/tftpboot/linux_install/.

続いて、/var/lib/tftpboot/esx_install配下に、導入したいOSメディアの内容を丸っとコピーする

# mkdir /mnt/cent7
# mount -t iso9660 /dev/cdrom /mnt/cent7
# cp -rp /mnt/cent7/* /var/lib/tftpboot/linux_install/images/cent7/.

★上述のbootmenuやlabelを指定した際の実施内容ファイルの修正
pxelinux.cfgディレクトリを作成する

# mkdir /var/lib/tftpboot/linux_install/pxelinux.cfg
# vi default

default menu.c32
PROMPT 0
TIMEOUT 300
ONTIMEOUT local

menu title ######## PXE Boot Menu ##########

label 1
menu label ^1) Minimal Install CentOS Linux OS 7.3 x64 with local Repository
kernel images/cent7/vmlinuz
append initrd=images/cent7/initrd.img inst.repo=http://192.168.1.11/cent7

label 2
menu label ^2) Kickstart Install CentOS Linux OS 7.3 x64 with local Repository
kernel images/cent7/vmlinuz
append initrd=images/cent7/initrd.img inst.repo=http://192.168.1.11/cent7 ks=http://192.168.1.11/kickstart/cent7_ks.cfg

:wq!
1
5
0

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
5