PRIMERGY RX200をネットワークブートでディスクレス運用するまとめ。
まず、クライアント側でPXEブートに使うネットワークポートを確認し、BIOSでPXE enableに設定する。PRIMERGYの場合デフォルトで1つのポートだけPXE対応に設定されているはず。(2つ両方とも対応はできる)
クライアント側の準備はひとまずこれだけ。
サーバ側ですることは
DHCPサーバとTFTPサーバをインストールして起動する
ポートを開放する
起動イメージとroot領域を用意する
の3点。
PXEサーバのアドレスを192.168.1.1
クライアントのアドレスは192.168.1.100以降をDHCPで取得とする
まずはtftpサーバのインストール、設定、起動
# yum -y install syslinux xinetd sftp-server
# mkdir /var/lib/tftpboot/pxelinux.cfg
# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
# nano /etc/xinetd.d/tftp
# default: off # description: The tftp server serves files using the trivial file transfer \ # protocol. The tftp protocol is often used to boot diskless \ # workstations, download configuration files to network-aware printers, \ # and to start the installation process for some operating systems. service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /var/lib/tftpboot disable = no #yes→noに書き換え per_source = 11 cps = 100 2 flags = IPv4 }
# systemctl start xinetd
# systemctl enable xinetd
次にdhcpサーバのインストール、設定、起動
# yum -y install dhcp
# nano /etc/dhcp/dhcpd.conf
# DHCP Server Configuration file. # see /usr/share/doc/dhcp*/dhcpd.conf.example # see dhcpd.conf(5) man page # option domain-name-servers 192.168.1.1; default-lease-time 600; max-lease-time 7200; authoritative; subnet 192.168.1.0 netmask 255.255.255.0 { range dynamic-bootp 192.168.1.100 192.168.1.254; option subnet-mask 255.255.255.0; option broadcast-address 192.168.1.255; option routers 192.168.1.1; option domain-name-servers 10.0.1.1; default-lease-time 600; max-lease-time 7200; filename "pxelinux.0"; next-server 192.168.1.1; }
# systemctl start dhcpd
# systemctl enable dhcpd
ポートを開ける
# firewall-cmd --add-service=dhcp --permanent
success
# firewall-cmd --reload
success
最後に起動イメージのインストールと諸々の設定
# yum -y install dracut-network nfs-utils
# mkdir -p /var/lib/tftpboot/centos7/root/
# yum groups -y install "minimal" --releasever=7 --installroot=/var/lib/tftpboot/centos7/root/
# python3 -c 'import crypt,getpass; print(crypt.crypt(getpass.getpass(), crypt.mksalt(crypt.METHOD_SHA512)))'
password:
と出るのでパスワードを入力すると
$6$Nt5Jxt9.........................
と長々とした文字が出るのでこれをコピーし、
# nano /var/lib/tftpboot/centos7/root/shadow
root:$6$Nt5Jxt9.........................:16372:0:99999:7:::
入力したパスワードでクライアントのrootにログインできる。
# wget -P /var/lib/tftpboot/centos7/ http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/vmlinuz http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/initrd.img
# nano /var/lib/tftpboot/pxelinux.cfg/default
default centos7 label centos7 kernel centos7/vmlinuz append initrd=centos7/initrd.img root=nfs:192.168.1.1:/var/lib/tftpboot/centos7/root rw selinux=0
# nano /etc/exports
/var/lib/tftpboot/centos7/root 192.168.1.0/24(rw,no_root_squash)
# systemctl start rpcbind nfs-server
# systemctl enable rpcbind nfs-server
# nano /var/lib/tftpboot/centos7/root/etc/fstab
none /tmp tmpfs defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0