管理サーバーの機能

1) PXEサーバ

2) NISサーバ

3) NFSサーバ
PXEブート時のファイル共有ではエラーが出るので使わない。代わりに FTP サーバを使う。

4) Proxyサーバ

5) Slurm 管理ノード

1) PXEサーバの設定

PXE ブートでは、BIOS や UEFI においてネットワーク起動が指定された計算機では、起動時にネットワークを介して DHCP サーバに対して IP アドレスの付与および起動プログラム(ブートローダー)の置き場所の通知リクエストをブロードキャストする。このブロードキャストを受け取った DHCP サーバのうち、返答が最も早かったものが用いられる。したがって、PXEブートを行う場合には、起動時に計算機が接続されているネットワーク内に DHCP サーバは 1 つだけあるような状況が望ましい。

・Opt1-a) TFTPサーバの設定

systemctl status tftp.socket として、tftpサーバに必要なプログラムがインストールされているか確認する。インストールされていなければ、
dnf install -y @network-server
でインストールする。

・Opt1-b) HTTPサーバの設定

systemctl status httpd として、httpdサーバに必要なプログラムがインストールされているか確認する。インストールされていなければ、
dnf install -y @web-server
でインストールする。

  • 設定ファイル:/etc/httpd/conf/httpd.conf

firewall-cmd --zone=trusted --change-interface=<Interface for internal network>
firewall-cmd  --reload

設定が反映されているか確認する。

firewall-cmd --get-active-zones 

systemctl enable --now httpd

FTPサーバの設定

nfsで自動OSインストール時のファイル共有を行うとエラーが発生してしまうため、ftpを用いる

systemctl status vsftpd として ftp サーバに必要なプログラムがインストールされているか確認する。インストールされていなければ、

dnf install -y @ftp-server

でインストールする。

PXEブートでの FTP 接続は匿名ユーザで行う。その際のルートパスは、anon_rootオプションで設定する。ここでは、anon_root=/var/lib/tftpboot と設定ファイルに記入し、キックスタートファイルやISOファイルを /var/lib/tftpboot 以下に置く。

以下の設定をする。

# /etc/vsftpd/vsftpd.conf

anonymous_enable=YES

anon_root=/var/lib/tftpboot

write_enable=NO

listen=YES

listen_ipv6=NO

匿名ユーザのルートディレクトリは設定ファイル中の anon_root=<ルートディレクトリ>で指定される。

systemctl enable --now vsftpd

・DHCPサーバの設定

  • DHCP とは、Dynamic Host Configuration Protocol のこと。
  • プログラムの準備
systemctl status dhcpd として、tftpサーバに必要なプログラムがインストールされているか確認する。インストールされていなければ、
dnf install -y @network-server
でインストールする。
  • 設定ファイル:/etc/dhcp/dhcpd.conf
DHCP サーバの設定ファイルには、接続を許可するネットワークと、PXEブートする計算機(クライアント)が用いる起動プログラム(ブートローダー)のパスを記載する必要がある。そこで以下のように、設定ファイルにネットワーク(subnet …) と起動プログラムのパス(filename …) を記載する。
# /etc/dhcp/dhcpd.conf## DHCP Server Configuration file.#   see /usr/share/doc/dhcp-server/dhcpd.conf.example#   see dhcpd.conf(5) man page#
authoritative;
allow booting;allow bootp;
subnet 192.168.0.0 netmask 255.255.255.0 # 接続を許可するネットワーク{ range dynamic-bootp <MIN IP address to assign> <MAX IP address to assign>; default-lease-time 86400; max-lease-time   172800;
option routers         <IP address of the DHCP server>; option subnet-mask       255.255.255.0; option domain-name <Domain name>; option domain-name-servers <IP address of the DNS server>; option time-offset       32400;
        # Always include the following lines for all PXELINUX clients filename "pxelinux/pxelinux.0"; # 起動プログラムの置き場所、この起動プログラムはTFTPを介して起動する計算機に送られるので、このパスはTFTPサーバのルートディレクトリからの相対パスで記述する。}

2) NISサーバの設定

systemctl status ypbind.service として nis サーバに必要なプログラムがインストールされているか確認する。インストールされていなければ、

dnf install -y ypbind

でインストールする。

3) NFSサーバの設定

systemctl status rpcbind nfs-server として nfs サーバに必要なプログラムがインストールされているか確認する。インストールされていなければ、

dnf install -y rpcbind nfs-server

でインストールする。

4) Proxyサーバの設定

systemctl status squid として proxy サーバに必要なプログラムがインストールされているか確認する。インストールされていなければ、

dnf install -y squid

でインストールする。

冒頭部分に、acl localnet src <内部ネットワークのIPアドレス範囲>   を記載する。
プロキシ接続用のポートは http_port で設定されている。

# /etc/squid/squid.conf

#

# Recommended minimum configuration:

#


# Example rule allowing access from your local networks.

# Adapt to list your (internal) IP networks from where browsing

# should be allowed

acl localnet src 0.0.0.1-0.255.255.255 # RFC 1122 "this" network (LAN)

acl localnet src 10.0.0.0/8 # RFC 1918 local private network (LAN)

acl localnet src 100.64.0.0/10 # RFC 6598 shared address space (CGN)

acl localnet src 169.254.0.0/16 # RFC 3927 link-local (directly plugged) machines

acl localnet src 172.16.0.0/12 # RFC 1918 local private network (LAN)

acl localnet src <IP address of the local private network> # RFC 1918 local private network (LAN)

acl localnet src fc00::/7       # RFC 4193 local private network range

acl localnet src fe80::/10      # RFC 4291 link-local (directly plugged) machines


acl SSL_ports port 443

acl Safe_ports port 80 # http

acl Safe_ports port 21 # ftp

acl Safe_ports port 443 # https

acl Safe_ports port 70 # gopher

acl Safe_ports port 210 # wais

acl Safe_ports port 1025-65535 # unregistered ports

acl Safe_ports port 280 # http-mgmt

acl Safe_ports port 488 # gss-http

acl Safe_ports port 591 # filemaker

acl Safe_ports port 777 # multiling http

acl CONNECT method CONNECT


#

# Recommended minimum Access Permission configuration:

#

# Deny requests to certain unsafe ports

http_access deny !Safe_ports


# Deny CONNECT to other than secure SSL ports

http_access deny CONNECT !SSL_ports


# Only allow cachemgr access from localhost

http_access allow localhost manager

http_access deny manager


# We strongly recommend the following be uncommented to protect innocent

# web applications running on the proxy server who think the only

# one who can access services on "localhost" is a local user

#http_access deny to_localhost


#

# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS

#


# Example rule allowing access from your local networks.

# Adapt localnet in the ACL section to list your (internal) IP networks

# from where browsing should be allowed

http_access allow localnet

http_access allow localhost


# And finally deny all other access to this proxy

http_access deny all


# Squid normally listens to port 3128

http_port <Port that the proxy server listens to>


# Uncomment and adjust the following to add a disk cache directory.

#cache_dir ufs /var/spool/squid 100 16 256


# Leave coredumps in the first cache dir

coredump_dir /var/spool/squid


#

# Add any of your own refresh_pattern entries above these.

#

refresh_pattern ^ftp: 1440 20% 10080

refresh_pattern ^gopher: 1440 0% 1440

refresh_pattern -i (/cgi-bin/|\?) 0 0% 0

refresh_pattern . 0 20% 4320

5) DNSサーバの設定

dnf install -y bind bind-utils

冒頭に、

acl nodes {

    192.168.0.0/24; # 適切な内部ネットワークに変更する。

};

を追加して、内部ネットワークの範囲を宣言する。

options { … } の中で、

listen-on port 53 { nodes; };

allow-query     { localhost; nodes; };

recursion yes;

forwarders { <このサーバーが名前解決を問い合わせるDNSサーバーのリスト>; };

forward only;

dnssec-enable no;

# dnssec-validation yes;

と設定する。

systemctl enable --now named

6) Slurm管理ノードの設定

計算ノードへのOSインストール

1) ブート設定ファイルの用意

2) キックスタートファイルの用意

1) ブート設定ファイルの設定

ブートローダのパスを ./pxelinux.0 としたとき、ブート設定ファイルの置き場所は ./pxelinux.cfg/<ブート設定ファイル設定ファイル>
このディレクトリ内にあるどのファイルが読み込まれるかには規則がある。優先順位の高い順から
01-<マシンのMACアドレス>
default
である。

以下で、<キックスタートファイルのパス> を次の節で説明するキックスタート設定ファイルのパスに置き換える。

# ./pxelinux.cfg/01-<ノードのMACアドレス>

#prompt 1

timeout 100

default os-autoinstall


menu title PXE Boot Menu


label os-manualinstall

  MENU LABEL Install Rocky Linux 8.9 Manually

  kernel images/vmlinuz

  append initrd=images/initrd.img inst.selinux=0 biosdevname=0


label os-autoinstall

  menu label Install Rocky Linux 8.9 Automatically

  kernel images/vmlinuz

  ipappend 2

  append initrd=images/initrd.img inst.ks=<キックスタートファイルのパス> inst.selinux=0 biosdevname=0 text ip=dhcp


label local

  menu default

  menu label Boot from ^local drive

  localboot 0

./pxelinux.cfg/<ブート設定ファイル>

./images/vmlinuz
./images/initrd.img

となっている。

2) キックスタートファイルの設定

キックスタートファイルを作成する最も簡単な方法は、いずれかの計算機を用いて一度 OS を手動インストールすることである。OS をインストールすると /root/anaconda-ks.cfg にインストール時の設定を反映したキックスタートファイルが自動生成されている。これを基にすることで、他の計算機への OS インストールに用いるキックスタートファイルを比較的簡単に用意することができる。

計算機がインターネットに接続されていない場合、OS公式ページなどに用意されているOSインストールに必要なリポジトリにアクセスすることができない。そこで、これらの必要なリポジトリを FTP サーバに用意しておき、インストールソースとしてその場所を指定する必要がある。

例えば、ISOイメージを <FTPルート>/rocky8.9-install 以下に展開した場合、インストールソースパスとして

ftp://<FTPサーバのIPアドレス>/rocky8.9-install

を指定する。ここでインストールソースを指定するため、ブート設定ファイルでは inst.repo オプションや inst.stage2 オプションを指定する必要はない。

自動 OS インストール後の再起動時に再び自動 OS インストールが始まらないようにするためには、自動 OS インスールの最終ステップにおいて、ブート設定ファイルの “default os-autoinstall” を “default local” に変更する必要がある。
そこで、この操作をキックスタートファイルに記載する必要がある。
OS インストール後に実行するべきコマンドは、キックスタートファイル内において
%post
<実行するコマンド群>
%end
と記載する。


# pxelinux.cfg/<NODENAME>.cfg

#version=RHEL8

# License agreement

eula --agreed

# Reboot after installation

reboot

# Use text mode install

text


%post --logfile=/root/setup.log

str=$(ip addr | grep 192.168 | grep enp) && str=${str##* }

nmcli connection modify $str ipv4.addresses <IP address and subnet mask of the intranet>

nmcli connection modify $str ipv4.dns-search '<Domain name>'

systemctl restart NetworkManager

systemctl restart network



# Setup NFS to enable access to setup files

MNT_DIR=$(mktemp -q -d /tmp/tmp.XXXXX)

mount -o nolock <IP address of the TFTP server>:/tftpboot $MNT_DIR


chmod u+x $MNT_DIR/setupfiles/NFS.setup

$MNT_DIR/setupfiles/NFS.setup

# Change the default boot option from "os-autoinstall" to "local" so that the machine starts normally in the next boot.

# autofs.service does not start while instllation. Thus, explicit mounting is required to moify "<NODENAME>.cfg"

sed -i -e "s/^default os-autoinstall/default local/g" \

$MNT_DIR/pxelinux/pxelinux.cfg/<NODENAME>.cfg


umount $MNT_DIR

rmdir  $MNT_DIR

%end


%packages

@^server

@container-management

@debugging

@development

@file-server

@ftp-server

@graphical-admin-tools

@headless-management

@legacy-unix

@network-file-system-client

@performance

@remote-desktop-clients

@remote-system-management

@rpm-development-tools

@scientific

@system-tools

@large-systems

createrepo

initial-setup

kexec-tools

ypbind


%end


# Keyboard layouts

keyboard --vckeymap=us --xlayouts='us','jp'

# System language

lang en_US.UTF-8 --addsupport=ja_JP.UTF-8


# Firewall configuration

firewall --disabled

# Network information

network  --bootproto=static --device=link --gateway=<IP address of the gateway server> --hostname=<NODENAME> --ip=<IP address of the node> --nameserver=<IP address of the DNS server> --netmask=<Netmask of the intranet> --activate


# Use network installation

url --url="ftp://<IP address of the FTP server>/rocky8.9-install/"


# System authorization information

authselect select nis --force # Enable NIS


# SELinux configuration

selinux --disabled


# Do not configure the X Window System

skipx

# System services

services --enabled="chronyd"


ignoredisk --only-use=sda

# System bootloader configuration

bootloader --append="selinux=0 biosdevname=0 crashkernel=auto" --location=mbr --driveorder="sda" --boot-drive=sda

autopart --nohome

# Clear the Master Boot Record

zerombr

# Partition clearing information

clearpart --all --initlabel --drives=sda


# System timezone

timezone Asia/Tokyo --isUtc


# Root password

rootpw --iscrypted <Hash of the root password>


%addon com_redhat_kdump --enable --reserve-mb='auto'


%end


%anaconda

pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty

pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok

pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty

%end

OSインストール後の計算ノードの設定

1) NFSクライアント

2) NISクライアント

3) Sudoの設定

4) Slurm計算ノード設定

1) NFSのクライアント設定

/etc/autofs.conf
/etc/auto.master
/etc/auto.home

OSインストール時のキックスタートファイルにて、autofsを用いたNFSの設定を行なっているため(authselect select nis --force の部分)、OSインストール後の作業は不要。

2) NISのクライアント設定 

- /etc/yp.conf
domain <nisdomain> server <IP address of the NIS server>

- /etc/nsswitch.conf
この設定ファイルは authselect select nis --force で用意されているはずである。

3) Sudoの設定 

root でない一般ユーザーでも、wheel グループに属していれば sudo ができるように設定する。

## Allows people in group wheel to run all commands

%wheel  ALL=(ALL)       ALL

となっていることを確認する。

groupmod -g 1010 wheel
make -C /var/yp

とする。1つ目のコマンドでは、wheelのgroup ID を デフォルトの10から1010に変更している。これは、NISでは group ID が 1000以上のグループしか共有されないからである。

sed -i '/^wheel/d' /etc/group

とする。これは、/etc/nsswitch.conf において、

group:      files nis systemd

となっていて、NIS の情報よりも各ノード上にある /etc/group の情報が優先されるためである。

4) Slurm計算ノードの設定

mkdir -p /var/lib/tftpboot/etc/profile.d
cp /etc/profile.d/slurm.sh /var/lib/tftpboot/etc/profile.d

とした後、各計算ノード上で

rsync -avh /tftpboot/etc /etc

とする。

mkdir -p /var/lib/tftpboot/etc/munge
cp /etc/munge/munge.key /var/lib/tftpboot/etc/munge/munge.key

その後、各ノード上で 

rsync -avh /tftpboot/etc /etc
chown -R munge:munge /etc/munge

としてmunge.key をコピーし、所有者を munge:munge に変更する。

dnf install -y munge
systemctl enable --now munge.service

/opt/slurm/sbin/slurmd -C

を実行して得られる内容を記載する。

systemctl restart slurmctld

slurmctld が起動していなければ、

systemctl enable --now slurmctld

とする。

rsync -avh -e 'ssh' /usr/lib/systemd/system/slurmd.service <IP address of the node>:/usr/lib/systemd/system

とすれば良い。

systemctl enable --now slurmd

を実行し、slurmd を起動する。