[클러스터] PXE와 Kickstart 를 이용한 리눅스 자동 인스톨
자동설치 테스트 과정
A. 시스템 사양
– node 수 : 4
– CPU : P4 2.8C (Hyperthreading ON)
– Mem : 1GB
– HDD : 80GB SATA
– NIC : e100(100Mbps) & tg3(1000Mbps)
B. 설치과정
1. Master Node 설치
– 설치 OS : Redhat ES3
– text 모드로 설치
– Language : English
– partition
/boot : 128M
/ : 20GB
swap : 1GB
/home : 나머지
– network 설정
eth0 (Giga) : 192.168.101.1, 255.255.255.0, nogw, nodns
eth1 (e100, PXE device0 : 192.168.201.1, 255.255.255.0, nogw, nodns
hostname : node01.cluster.com
– Firewall : no
– Language : USA & Korean (USA Default)
– Time : Asia/Seoul
– Package Selection : Everything
– X configuration : skip
– Kernel : 2.4.21-15.ELsmp
2. 설치후 과정
(a) /etc/hosts 파일 수정
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.101.1 node01.cluster.com node01
192.168.101.2 node02.cluster.com node02
192.168.101.3 node03.cluster.com node03
192.168.101.4 node04.cluster.com node04
192.168.201.1 node01s.cluster.com node01s
192.168.201.2 node02s.cluster.com node02s
192.168.201.3 node03s.cluster.com node03s
192.168.201.4 node04s.cluster.com node04s
(b) /etc/hosts.equiv 생성
node01
node02
node03
node04
node01s
node02s
node03s
node04s
(c) /root/.rhosts 생성
node01
node02
node03
node04
node01s
node02s
node03s
node04s
(d) service 재설정 : rc3.d (chkconfig 이용)
apmd
autofs
crond
dhcpd
irqbalance (smp only)
microcode_ctl
netfs
network
nfs
nfslock
portmap
random
rawdevice
rlogin
rsh
sendmail
sshd
syslog
tftp
xfs
xinetd
(e) Install RPM 복사
* 1번 CD
# mount /dev/cdrom /mnt/cdrom
# cp -a /mnt/cdrom/Redhat /tftpboot/linux-install/
# cp -a /mnt/cdrom/images/ /tftpboot/linux-install/
# umount /dev/cdrom
* 2번 CD
# mount /dev/cdrom /mnt/cdrom
# cp -a /mnt/cdrom/Redhat /tftpboot/linux-install/
# umount /dev/cdrom
* 3번 CD
# mount /dev/cdrom /mnt/cdrom
# cp -a /mnt/cdrom/Redhat /tftpboot/linux-install/
# umount /dev/cdrom
(f) /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
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot/linux-install
per_source = 11
cps = 100 2
flags = IPv4
}
– tftp 재실행
/etc/rc.d/init.d/xinetd restart
(g) client node PXE 가능 NIC의 mac-address 추출
node02 : 00:0C:F1:DA:E5:D5
node03 : 00:0C:F1:DA:E5:C6
node04 : 00:0C:F1:DA:E6:7F
(h) /etc/xinted.d/dhcpd.conf 편집
allow booting;
allow bootp;
option subnet-mask 255.255.255.0;
option domain-name “cluster.com”;
option broadcast-address 192.168.201.255;
ddns-update-style none;
default-lease-time 21600;
max-lease-time 43200;
subnet 192.168.201.0 netmask 255.255.255.0 {
range 192.168.201.2 192.168.201.4;
}
group {
next-server 192.168.201.1;
filename “pxelinux.0”;
host node02 {
option host-name “node02.cluster.com”;
hardware ethernet 00:0C:F1:DA:E5:D5;
fixed-address 192.168.201.2;
}
host node03 {
option host-name “node03.cluster.com”;
hardware ethernet 00:0C:F1:DA:E5:C6;
fixed-address 192.168.201.3;
}
host node04 {
option host-name “node04.cluster.com”;
hardware ethernet 00:0C:F1:DA:E6:7F;
fixed-address 192.168.201.4;
}
}
subnet 192.168.101.0 netmask 255.255.255.0 {
}
– dhcpd 재실행
#/etc/rc.d/init.d/dpchd restart
(i) /tftpboot/pxeconfig.cfg/default 편집
LABEL linux
KERNEL vmlinuz
APPEND initrd=initrd.img ramdisk_size=8192 ks=nfs:192.168.201.1:/tftpboot/linux-install/kickstart/ks.cfg ksdevice=eth1
(j) boot 파일 복사
# cp /tftpboot/linux-install/images/pxeboot/vmlinuz /tftpboot/linux-install/
# cp /tftpboot/linux-install/images/pxeboot/initrd.img /tftpboot/linux-install/
(k) NFS 설정
/tftpboot/linux-install/ node*(ro)
# exportfs -a 실행
(l) /tftpboot/linux-install/kickstart/ks.cfg 작성
#Generated by Kickstart Configurator
#System language
lang en_US
#Language modules to install
langsupport ko_KR.eucKR –default=en_US
#System keyboard
keyboard us
#System mouse
mouse genericwheelps/2
#Sytem timezone
timezone Asia/Seoul
#Root password
rootpw –iscrypted $1$/nH3/7qI$1BouFY3WFtj74nfrz.hXA/
#Use text mode install
text
#Install Red Hat Linux instead of upgrade
install
#Use NFS installation Media
nfs –server=192.168.201.1 –dir=/tftpboot/linux-install/
#System bootloader configuration
bootloader –location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart –all –initlabel
#Disk partitioning information
part /boot –fstype ext3 –size 128
part / –fstype ext3 –size 20000
part swap –size 1024
part /home –fstype ext3 –size 1 –grow
#System authorization infomation
auth –useshadow –enablemd5
#Network information
network –bootproto=dhcp –device=eth1
#Firewall configuration
firewall –disabled
#Do not configure XWindows
skipx
#Package install information
%packages –ignoredeps
@ Everything
(n) configuration file 복사
# mkdir /tftpboot/linux-install/config
# tar cvfP /tftpboot/linux-install/config/cluster-config.tar /etc/hosts /etc/hosts.equiv /root/.rhosts /etc/pam.d/rsh /etc/pam.d/rlogin /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1
3. Client Node 설치
(a) BIOS에서 booting 순서 변경
– PXE Boot
– CD-ROM
– HDD
(b) reboot client node system
(c) 설치 완료 후 서버에서 tftp 서비스 종료
#chkconfig –level 3 tftp off
(d) /etc/dhcpd.conf 에서 다음 주석처리
# next-server 192.168.201.1;
# filename “pxelinux.0”;
(e) 클라이언트 재부팅
(f) 각 노드에서 다음의 명령 수행
# mount -t nfs 192.168.201.1:/tftpboot/linux-install /tftpboot/linux-install
# tar xvfP /tftpboot/linux-install/config/cluster-config.tar
# rm -f /etc/rc.d/rc3.d/*
# tar xvfP /tftpboot/linux-install/config/rc.tar (이때 주의사항 rsh, rlogin은 이걸로 안됨, xinetd.d/rsh, rlogin 복사)
(g) /etc/sysconfig/network-script/ifcfg-eth0, /etc/sysconfig/network-script/ifcfg-eth1 수정
(이때 mac address를 보존하고 수정해야함)
(h) reboot