Yongbok Blog

CentOS – Kickstart 설정

Kickstart 는 PXE 부팅을 이용하여 네트워크로 여러대의 서버를 자동설치 할수 있도록 해주는 기술입니다.
사용되는 것들로는 TFTPD, DHCPD, NFSD 가 있으며 CentOS 에서 테스트 되었음을 알려드립니다.
1. TFTP 설치
TFTP 설치를 해줍니다.

[root@ruo91 ~]# yum install -y tftp tftp-server

TFTP 는 xinetd 를 사용하므로 TFTP 를 활성화 시켜 주기 위해 disable 의 값을 “yes” 에서 “no” 로 수정 해줍니다. (기본값 : yes)

[root@ruo91 ~]# vi /etc/xinetd.d/tftp

service tftp
{
socket_type             = dgram
protocol                = udp
wait                    = yes
user                    = root
server                  = /usr/sbin/in.tftpd
server_args             = -s /tftpboot
disable                 = no
per_source              = 11
cps                     = 100 2
flags                   = IPv4
}

2. syslinux 설치

http://rpmrepo.org/RPMforge/Using

[root@ruo91 ~]# wget -P $HOME http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
[root@ruo91 ~]# rpm -UvH $HOME/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
[root@ruo91 ~]# yum install -y syslinux

3. DHCP 설치 및 설정

[root@ruo91 ~]# yum install -y dhcp dhcp-devel
[root@ruo91 ~]# vi /etc/dhcpd.conf

allow bootp;
allow booting;
max-lease-time 60;
default-lease-time 60;
ddns-update-style ad-hoc;
option subnet-mask 255.255.255.0;
option domain-name “google-public-dns-a.google.com”;   # google public dns
option domain-name-servers 8.8.8.8, 8.8.4.4;
subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.1;
range 192.168.0.2 192.168.0.254;
filename “pxelinux.0”;
}

4. NFS 설치 및 설정
CentOS 5.4 에서는 기본적으로 nfs-utils 가 설치 되어 있습니다.

[root@ruo91 ~]# rpm -qa | grep nfs-utils
nfs-utils-lib-1.0.8-7.6.el5
nfs-utils-1.0.9-42.el5

만약 설치가 안됐을 경우 설치 해줍니다.

[root@ruo91 ~]# yum install -y nfs-utils

설치에 필요한 ISO 이미지 파일을 미러링 서버에서 다운로드 합니다.

[root@ruo91 ~]# wget -P $HOME http://ftp.neowiz.com/pub/centos/5.4/isos/i386/CentOS-5.4-i386-bin-DVD.iso
[root@ruo91 ~]# mount -t iso9660 -o loop $HOME/CentOS-5.4-i386-bin-DVD.iso /mnt/md0

/etc/exports 에 마운트 한 디렉토리를 읽기 전용으로 접근 할수 있도록 추가 해줍니다.

[root@ruo91 ~]# echo ‘/mnt/md0 192.168.0.0/24(ro)’ > /etc/exports
[root@ruo91 ~]# echo ‘/tftpboot/kickstart 192.168.0.0/24(ro)’ >> /etc/exports

5. TFTP 설정
– PXE 환경 설정 파일 생성

[root@ruo91 ~]# mkdir /tftpboot/{pxelinux.cfg,kickstart,centos5.4}
[root@ruo91 ~]# chmod +r -R /tftpboot

/etc/inetd.conf 파일에 아래 내용을 추가 시켜 줍니다.

[root@ruo91 ~]# echo ‘tftp    dgram   udp     wait    root    /usr/sbin/tcpd  in.tftpd /tftpboot’ > /etc/inetd.conf

– 부팅 이미지 복사 및 설정

[root@ruo91 ~]# cp /usr/share/syslinux/pxelinux.0 /tftpboot
[root@ruo91 ~]# cp /mnt/md0/images/pxeboot/{vmlinuz,initrd.img} /tftpboot/centos5.4

[root@ruo91 ~]# vi /tftpboot/pxelinux.cfg/default
timeout=30
default CentOS5.4
label CentOS5.4
kernel centos5.4/vmlinuz
append ksdevice=link load_ramdisk=1 initrd=centos5.4/initrd.img network ks=nfs:192.168.0.1:/tftpboot/kickstart/ks.cfg

6. Kickstart 설정 파일 생성
kickstart 설정 파일을 만듭니다.

[root@ruo91 ~]# vi /tftpboot/kickstart/ks.cfg

# 설치 또는 업그레이드 여부
# 예) install 또는 upgrade
install

# 설치 모드 지정 (이 옵션이 없으면 그래픽 모드로 설치가 진행 됩니다.)
text

# 미러링 서버 지정
# 예) url –url http://mirror.yongbok.net/centos/5/os/i386
# 예) nfs –server=192.168.0.1 –dir=/mnt/md0
url –url http://mirror.yongbok.net/centos/5/os/i386

# 언어선택으로 기본설정 사용.
# langsupport 에 ko_KR.UTF-8 를 추가해주면 한국어 지원.
# 예) langsupport –default=en_US.UTF-8 en_US.UTF-8 ko_KR.UTF-8
lang en_US.UTF-8
langsupport –default=en_US.UTF-8 en_US.UTF-8 ko_KR.UTF-8

# 키보드 설정
keyboard us

# 마우스 설정
mouse none

# 네트웍 설정
# dhcp 로 ip를 가져오지 못하면 고정 ip 설정화면이 나옵니다.
# 아래 주석은 여러가지 형태의 네트웍 설정방법을 예로 보여준 것 입니다.
#network –bootproto dhcp
#network –bootproto static
#network –device eth0 –bootproto dhcp –hostname ns.domain.com
network –device eth0 –bootproto static –ip 192.168.0.5 –netmask 255.255.255.0 –gateway 192.168.0.1 –nameserver  8.8.8.8 –hostname ruo91.yongbok.net

# root 패스워드 입니다. 원하시는걸로 바꾸시면됩니다.
rootpw 123456789

# firewall 설정 단계로 개인적으로 os 설치완료후 설정할 것을 권장합니다.
firewall –disabled

# selinux 설정 단계로 완벽하게 이해 하지 못한다면 disabled 하는것을 권장합니다.
selinux –disabled

# 시스템에서 사용될 인증 옵션을 설정합니다. 기본값 사용
authconfig –enableshadow –enablemd5

# timezone 설정
timezone Asia/Seoul

# 부트로더 설정
bootloader –location=mbr

# 시스템에 있는 모든 파티션을 삭제 합니다.
clearpart –initlabel –all

# 파티션을 나눕니다.
part /boot –fstype ext3 –size=256 –asprimary
part /var –fstype ext3 –size=4096
part /usr/local –fstype ext3 –size=4096
part /usr –fstype ext3 –size=2048
part swap –size=2048 –asprimary
part / –fstype ext3 –size=1024 –asprimary
part /tmp –fstype ext3 –size=512
part /home –fstype ext3 –size=1 –grow
reboot

# 패키지를 선택합니다. (나머지는 설치 완료 후 yum 으로 설치)
%packages
@ development-tools
%post

7. 서비스 시작
– xinetd 를 시작 해줍니다.

[root@ruo91 ~]# /etc/init.d/xinetd start
xinetd (을)를 시작 중:                                     [  OK  ]

– DHCPD 를 시작 합니다.

[root@ruo91 ~]# /etc/init.d/dhcpd start
dhcpd (을)를 시작 중:                                      [  OK  ]

– Portmap, NFS 를 시작 합니다.

[root@ruo91 ~]# /etc/init.d/portmap start
portmap (을)를 시작 중:                                    [  OK  ]
[root@ruo91 ~]# /etc/init.d/nfs start
NFS 서비스를 시작 중:                                      [  OK  ]
NFS 쿼터를 시작 중:                                        [  OK  ]
NFS 데몬을 시작 중:                                        [  OK  ]
NFS mountd를 시작 중:                                      [  OK  ]

Exit mobile version