RHEL6 환경에서 PXE boot 환경 구축

RHEL6 환경에서 PXE boot 환경 구축
작성자 : 서진우
– 기본 패키지 확인

# rpm -qa | grep syslinux
syslinux-4.02-4.el6.x86_64

# rpm -qa | grep dhcp
dhcp-4.1.1-31.P1.el6.x86_64
dhcp-common-4.1.1-31.P1.el6.x86_64

# rpm -qa | grep tftp
tftp-0.49-7.el6.x86_64
tftp-server-0.49-7.el6.x86_64

– tftp 설정

# vi /etc/xinetd.d/tftp
———————————————————————
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
}
———————————————————————

# /etc/rc.d/init.d/xinetd restart

– dhcp 설정

# vi /etc/dhcp/dhcpd.conf
———————————————————————
ddns-update-style interim;
ignore client-updates;
default-lease-time 3600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.201.255;
option routers 192.168.201.254;
#option domain-name-servers 192.168.201.254;
option domain-name “alang02”;
authoritative;

allow booting;
allow bootp;

class “pxeclients” {
match if substring (option vendor-class-identifier, 0, 9) = “PXEClient”;
next-server 192.168.201.80;
filename “pxelinux.0”;
}
##############################################################################

group {
next-server 192.168.201.80;
filename “linux-install/pxelinux.0″;

host node01 {
hardware ethernet 00:09:3d:10:8b:c6;
fixed-address 192.168.201.1;
}
host node02 {
hardware ethernet 00:09:3d:10:96:64;
fixed-address 192.168.201.2;
}
}

##############################################################################

subnet 192.168.201.0 netmask 255.255.255.0 {
interface eth0;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.201.255;
option routers 192.168.201.254;
range dynamic-bootp 192.168.201.200 192.168.201.250;
}
—————————————————————————

# vi /etc/sysconfig/dhcpd
—————————————————————————
DHCPDARGS=eth0
—————————————————————————

# /etc/rc.d/init.d/dhcpd restart

DHCP 구성 시 실제 서비스 대상 IP에 접근할 수 있는 Network Device 에서
DHCP 서비스가 구동되어야 한다.

만일 Multi NIC 환경에서 eth1 장치를 통해 DHCP 서비스를 할 경우
/etc/sysconfig/dhcpd 파일을 열고, DHCPDARGS 설정에 eth1 을 입력하도록 한다.

참고로 eth0:0 와 같은 alias 된 장치의 경우 DHCP 서비스가 정상 동작하지
않는다.

– pxe 설정

# mount -o loop rhel-server-6.3-x86_64-dvd.iso /mnt
# mkdir -p /tftpboot/linux-install/pxelinux.cfg
# mkdir -p /tftpboot/linux-install/rhel63

# cp /mnt/images/pxeboot/vmlinuz /tftpboot/linux-install/rhel63
# cp /mnt/images/pxeboot/initrd.img /tftpboot/linux-install/rhel63
# cp /usr/share/syslinux/pxelinux.0 /tftpboot/linux-install
# cp /usr/share/syslinux/vesamenu.c32 /tftpboot/linux-install
# cp /usr/share/syslinux/menu.c32 /tftpboot/linux-install

# vi /tftpboot/linux-install/pxelinux.cfg/default
——————————————————————————
timeout 100
#default menu.c32
default vesamenu.c32

# Menu config
MENU INCLUDE pxelinux.cfg/graphics.conf
MENU TITLE Welcom to Clunix Teragon Auto Installer
MENU BACKGROUND pxelinux.cfg/splash.jpg

label 0
menu label ^0) Boot from Local Hard Disk
localboot

label 1
menu label ^1) Install RHEL 6.2
kernel rhel6.2/vmlinuz
append initrd=rhel6.2/initrd.img ks=nfs:192.168.201.80:/home/clunix/OS/ks/rhel62.ks ksdevice=eth0 ip=dhcp

label 2
menu label ^2) Install RHEL 6.3
kernel rhel6.3/vmlinuz
append initrd=rhel6.3/initrd.img ks=nfs:192.168.201.80:/home/clunix/OS/ks/rhel63.ks ksdevice=eth0 ip=dhcp

label 3
menu label ^3) Install RHEL 6.3 (Include NVIDIA VGA)
kernel rhel6.3/vmlinuz
append initrd=rhel6.3/initrd.img xdriver=vesa nomodeset ks=nfs:192.168.201.80:/home/clunix/OS/ks/rhel63-xen.ks ksdevice=eth0

———————————————————————————-

# vi /tftpboot/linux-install/pxelinux.cfg/graphics.conf
———————————————————————————-
MENU WIDTH 80
MENU MARGIN 10
MENU PASSWORDMARGIN 3
MENU ROWS 12
MENU TABMSGROW 18
MENU CMDLINEROW 18
MENU ENDROW 24
MENU PASSWORDROW 11
MENU TIMEOUTROW 20

MENU PASSPROMPT Enter Password

NOESCAPE 1
ALLOWOPTIONS 1

MENU COLOR BORDER 37;40 #80ffffff #00000000

MENU COLOR SCROLLBAR 44;30

MENU COLOR TABMSG 37;40 #80ffffff #00000000
MENU COLOR HOTSEL 30;47 #40000000 #20ffffff
MENU COLOR SEL 30;47 #40000000 #20ffffff
MENU COLOR SCROLLBAR 30;47 #40000000 #20ffffff

MENU COLOR PWDBORDER 44;30 #FF187CCA #FFFFFFFF
MENU COLOR PWDHEADER 1;44;30 #FF187CCA #FFFFFFFF
MENU COLOR PWDENTRY 5;44;30 #FF187CCA #FFFFFFFF
————————————————————————————-

백그라운드로 사용하는 splash 이미지 파일은 png 형식의 640×480 크기에 맞추면 이용이
가능하다.

– nfs 설정

# vi /etc/exports
————————————————————————————-
/home/clunix *(rw,no_root_squash)
————————————————————————————-

/home/clunix/OS/rhel6.3 디렉토리에 OS 이미지를 복사해 둔다.

# /etc/rc.d/init.d/nfs restart

– ks 설정

# vi /home/clunix/OS/ks/rhel63.ks
————————————————————————————-
# Kickstart file automatically generated by anaconda.
#version=DEVEL
install
text
#interactive

reboot

#driverdisk –source=nfs:192.168.123.131:/home/iso/driverdisk/aac_RHEL6.img
nfs –server=192.168.201.80 –dir=/home/clunix/OS/rhel6.3

lang en_US.UTF-8
keyboard ko
firstboot –disable
skipx

network –onboot=yes –noipv6 –device=eth0 –bootproto=dhcp

rootpw –iscrypted $6$xj2EFu0/$.Ni0vMW98He5b4Ze2C5L2f.ZISzKkGmatMr7FmwAXn10ITZ2GuQ54DsiG6dUVt7e2LkjlLUNU22Rx5wxL/xI2.

firewall –disabled
selinux –disabled

authconfig –enableshadow –passalgo=sha512

timezone Asia/Seoul
bootloader –location=mbr –driveorder=sda –append=” rhgb crashkernel=auto quiet”
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work

clearpart –all –initlabel

part / –fstype=ext4 –size=40000 –asprimary
part swap –size=8000 –grow –asprimary

#part / –fstype=ext4 –size=51200 –ondisk=sda –asprimary
#part swap –size=32768 –ondisk=sda –asprimary
#part /usr –fstype=ext4 –size=32768 –ondisk=sda –asprimary
#part /engrid –fstype=ext4 –size=32768 –ondisk=sda
#part /APP –fstype=ext4 –size=51200 –ondisk=sda

#part / –fstype=ext4 –size=16382 –ondisk=sda –asprimary
#part swap –size=8192 –ondisk=sda –asprimary
#part /usr –fstype=ext4 –size=16382 –ondisk=sda –asprimary
#part /engrid –fstype=ext4 –size=10240 –ondisk=sda
#part /APP –fstype=ext4 –size=100000 –ondisk=sda

#part / –fstype=ext4 –size=32764 –ondisk=sda –asprimary
#part swap –size=8192 –ondisk=sda –asprimary
#part /usr –fstype=ext4 –size=32764 –ondisk=sda –asprimary
#part /engrid –fstype=ext4 –size=32764 –ondisk=sda
#part /APP –fstype=ext4 –size=100000 –ondisk=sda

%packages
@Base
@Core
@additional-devel
@base
@basic-desktop
@cifs-file-server
@client-mgmt-tools
@compat-libraries
@core
@debugging
@desktop-debugging
@desktop-platform
@desktop-platform-devel
@development
@directory-client
@eclipse
@emacs
@fonts
@ftp-server
@general-desktop
@graphical-admin-tools
@graphics
@input-methods
@internet-browser
@java-platform
@korean-support
@legacy-unix
@legacy-x
@network-file-system-client
@nfs-file-server
@performance
@perl-runtime
@print-client
@remote-desktop-clients
@ruby-runtime
@scientific
@server-platform
@server-platform-devel
@server-policy
@system-management
@technical-writing
@tex
@x11
abrt-gui
ant
atlas
certmonger
compat-openmpi
compat-openmpi-psm
desktop-file-utils
genisoimage
gnutls-devel
junit
krb5-workstation
ksh
libXau-devel
libXinerama-devel
libXmu
libXmu-devel
libXp
libXrandr-devel
libbonobo-devel
libdrm-devel
libgcrypt-devel
libglade2-devel
libgnomeui-devel
libxslt-devel
mtools
netpbm-progs
numpy
oddjob
openmotif
openmotif-devel
pam_krb5
pax
perl-DBD-SQLite
perl-Test-Pod
perl-Test-Pod-Coverage
perltidy
perl-DBD-MySQL
perl-LDAP
perl-suidperl
perl-Date-Manip
perl-Mozilla-LDAP
perl-Frontier-RPC
perl-DBD-Pg
perl-Cache-Memcached
perl-CGI-Session
perl-CGI
sblim-cmpi-samba
samba-winbind
samba
libXp
libXpm-devel
openmotif-devel
libXaw-devel
tigervnc-server
libXau-devel
vim-X11
libdrm-devel
popt-devel
python-dmidecode
rpmdevtools
sgpio
startup-notification-devel
tcp_wrappers
wodim
xorg-x11-proto-devel
tcl-devel
expect
compat-gcc-34
compat-gcc-34-g77
compat-gcc-34-c++
compat-libstdc++-33.i686
libXinerama-devel
openmotif-devel
libXmu-devel
xorg-x11-proto-devel
startup-notification-devel
libgnomeui-devel
libbonobo-devel
junit
libXau-devel
libgcrypt-devel
popt-devel
libdrm-devel
libXrandr-devel
libxslt-devel
libglade2-devel
gnutls-devel
mtools
pax
python-dmidecode
oddjob
sgpio
genisoimage
wodim
abrt-gui
desktop-file-utils
rpmdevtools
jpackage-utils
rpmlint
certmonger
pam_krb5
krb5-workstation
netpbm-progs
rsh
rsh-server
tcp_wrappers
openmotif
libXmu
libXp
perl-DBD-SQLite
numpy
atlas
expect
perl-DBI
samba
samba-client
samba-common
samba-winbind
samba-winbind-clients
libXp
libXp-devel
openmotif22
openmotif
libXpm
libXpm-devel
openmotif-devel
libXaw
libXaw-devel
dejavu-lgc-sans-mono-fonts
tigervnc-server
xinetd
libgcc.i686
glibc.i686
glibc-devel
glibc-headers
glibc-common
nss-softokn-freebl
libXau.i686
libxcb.i686
libX11.i686
libXext.i686
libXv.i686
libXfixes.i686
libXdamage.i686
libXxf86vm.i686
libdrm.i686
libselinux.i686
mesa-dri-drivers.i686
mesa-libGL.i686
mesa-libGLU.i686
libXv-devel
libXv-devel.i686
xterm

%post –interpreter=/bin/bash

#IP=`ifconfig eth0 | grep Bcast | awk -F “:” ‘{print $2}’ | awk ‘{print $1}’ `
#perl -pi -e ‘s/dhcp/static/g’ /etc/sysconfig/network-scripts/ifcfg-eth0
#echo “IPADDR=$IP” >> /etc/sysconfig/network-scripts/ifcfg-eth0
#echo “NETMASK=255.255.255.0” >> /etc/sysconfig/network-scripts/ifcfg-eth0

#### setting IP ADDR ############################
stringZ=`cat /proc/cmdline`
for service in $stringZ
do
if [ `expr match “$service” “ksip=”` -eq “5” ] ; then
IPADDR=${service:5}
fi
if [ `expr match “$service” “ksnm=”` -eq “5” ] ; then
NAME=${service:5}
fi
done

echo “DEVICE=eth0” > /etc/sysconfig/network-scripts/ifcfg-eth0
echo “BOOTPROTO=static” >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo “IPADDR=${IPADDR}” >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo “NETMASK=255.255.255.0” >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo “ONBOOT=yes” >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo “NETWORKING=yes” > /etc/sysconfig/network
echo “HOSTNAME=${NAME}” >> /etc/sysconfig/network

#################################################
#### setting start daemon ############################

/sbin/chkconfig –level 345 rhnsd off
/sbin/chkconfig –level 345 pcmcia off
/sbin/chkconfig –level 345 atd off
/sbin/chkconfig –level 345 openibd off
/sbin/chkconfig –level 345 rpcgssd off
/sbin/chkconfig –level 345 rpcidmapd on
/sbin/chkconfig –level 345 isdn off
/sbin/chkconfig –level 345 lm_sensors off
/sbin/chkconfig –level 345 haldaemon on
/sbin/chkconfig –level 345 sendmail off
/sbin/chkconfig –level 345 microcode_ctl off
/sbin/chkconfig –level 345 firstboot off
/sbin/chkconfig –level 345 cups off
/sbin/chkconfig –level 345 anacron off
/sbin/chkconfig –level 345 cpuspeed off
/sbin/chkconfig –level 345 smartd off
/sbin/chkconfig –level 345 iiim off
/sbin/chkconfig –level 345 gpm off
/sbin/chkconfig –level 345 rawdevices off
/sbin/chkconfig –level 345 mdmonitor off
/sbin/chkconfig –level 345 iptables off
/sbin/chkconfig –level 345 acpid off
/sbin/chkconfig –level 345 messagebus on
/sbin/chkconfig –level 345 arptables_jf off
/sbin/chkconfig –level 345 cups-config-daemon off
/sbin/chkconfig –level 345 bluetooth off
/sbin/chkconfig –level 345 NetworkManager off

/sbin/chkconfig rsh on
/sbin/chkconfig rlogin on
echo rsh >> /etc/securetty
echo rlogin >> /etc/securetty
echo `hostname` > /etc/hosts.equiv
echo `hostname` > /root/.rhosts
chmod 600 /root/.rhosts
/bin/rm -f /etc/profile.d/krb5-devel.sh
/bin/rm -f /etc/profile.d/krb5-devel.csh
/bin/rm -f /etc/profile.d/krb5-workstation.sh
/bin/rm -f /etc/profile.d/krb5-workstation.csh
/bin/rm -f /etc/profile.d/krb5-appl*

rpm -e vsftpd
rpm -e rwho
rpm -e rusers
rm -f /etc/my.cnf
rpm -e sysreport
rpm -e dovecot-mysql –nodeps
rpm -e mysql-server –nodeps
rpm -e mysql –nodeps
rpm -e mysql-devel –nodeps
rpm -e qt-mysql –nodeps
rpm -e akonadi –nodeps
/etc/rc.d/init.d/iptables stop
chkconfig –level 345 iptables off

setenforce permissive
sed -e ‘s/SELINUX=enforcing/SELINUX=disabled/’ /etc/selinux/config > /etc/selinux/config.tmp ; mv -f /etc/selinux/config.tmp /etc/selinux/config

echo “root ALL=(ALL) ALL” > /etc/sudoers
echo “clunix ALL=(ALL) NOPASSWD: ALL” >> /etc/sudoers

mv /usr/bin/gpk-update-icon /usr/bin/gpk-update-icon.bak

echo “======================================” >> /root/rhel_check.log
echo “daemon check” >> /root/rhel_check.log
echo “======================================” >> /root/rhel_check.log
chkconfig –list rpcidmapd | awk ‘{print $1, $5, $7}’ >> /root/rhel_check.log
chkconfig –list rsh >> /root/rhel_check.log
echo “======================================” >> /root/rhel_check.log
echo “rsh config check” >> /root/rhel_check.log
echo “======================================” >> /root/rhel_check.log
echo “# cat /root/.rhosts” >> /root/rhel_check.log
cat /root/.rhosts >> /root/rhel_check.log
echo “#cat /etc/securetty” >> /root/rhel_check.log
cat /etc/securetty | grep rsh >> /root/rhel_check.log
cat /etc/securetty | grep rlogin >> /root/rhel_check.log
echo “# cat /etc/hosts.equiv” >> /root/rhel_check.log
cat /etc/hosts.equiv >> /root/rhel_check.log
echo “======================================” >> /root/rhel_check.log
echo “rpm remove check” >> /root/rhel_check.log
echo “======================================” >> /root/rhel_check.log
rpm -qa | grep vsftpd >> /root/rhel_check.log
rpm -qa | grep rwho >> /root/rhel_check.log
rpm -qa | grep rusers >> /root/rhel_check.log
rpm -qa | grep sysreport >> /root/rhel_check.log
rpm -qa | grep mysql >> /root/rhel_check.log
ls /etc/my.cnf >> /root/rhel_check.log
echo “” >> /root/rhel_check.log
echo “======================================” >> /root/rhel_check.log
echo “rpm install check” >> /root/rhel_check.log
echo “======================================” >> /root/rhel_check.log
rpm -q mysql-libs >> /root/rhel_check.log
rpm -q tcl >> /root/rhel_check.log
rpm -q expect >> /root/rhel_check.log
rpm -q perl-DBI >> /root/rhel_check.log
rpm -qa | grep samba >> /root/rhel_check.log
rpm -q rsh >> /root/rhel_check.log
rpm -q rsh-server >> /root/rhel_check.log
rpm -q libXp >> /root/rhel_check.log
rpm -q libXp-devel >> /root/rhel_check.log
rpm -q openmotif22 >> /root/rhel_check.log
rpm -q openmotif >> /root/rhel_check.log
rpm -q openmotif-devel >> /root/rhel_check.log
rpm -q libXpm >> /root/rhel_check.log
rpm -q libXpm-devel >> /root/rhel_check.log
rpm -q libXmu >> /root/rhel_check.log
rpm -q libXmu-devel >> /root/rhel_check.log
rpm -q libXaw >> /root/rhel_check.log
rpm -q libXaw-devel >> /root/rhel_check.log
rpm -q dejavu-lgc-sans-mono-fonts >> /root/rhel_check.log
rpm -q ksh >> /root/rhel_check.log
rpm -q tigervnc-server >> /root/rhel_check.log
echo “======================================” >> /root/rhel_check.log
echo “Linux CDP RPM check (needs rpm i686 type)” >> /root/rhel_check.log
rpm -q glibc.i686 >> /root/rhel_check.log
rpm -q glibc.x86_64 >> /root/rhel_check.log
rpm -q glibc-devel >> /root/rhel_check.log
rpm -q glibc-common >> /root/rhel_check.log
rpm -q glibc-headers >> /root/rhel_check.log
rpm -q libgcc >> /root/rhel_check.log
rpm -q nss-softokn-freebl >> /root/rhel_check.log
rpm -q libXau >> /root/rhel_check.log
rpm -q libxcb >> /root/rhel_check.log
rpm -q libX11 >> /root/rhel_check.log
rpm -q libX11-devel >> /root/rhel_check.log
rpm -q libXext >> /root/rhel_check.log
rpm -q libXext-devel >> /root/rhel_check.log
rpm -q libXv >> /root/rhel_check.log
rpm -q libXv-devel >> /root/rhel_check.log
rpm -q libXdamage >> /root/rhel_check.log
rpm -q libXfixes >> /root/rhel_check.log
rpm -q libXxf86vm >> /root/rhel_check.log
rpm -q libdrm >> /root/rhel_check.log
rpm -q libselinux >> /root/rhel_check.log
rpm -q libstdc++ >> /root/rhel_check.log
rpm -q mesa-dri-drivers >> /root/rhel_check.log
rpm -q mesa-libGL >> /root/rhel_check.log
rpm -q mesa-libGL-devel >> /root/rhel_check.log
rpm -q mesa-libGLU >> /root/rhel_check.log
rpm -q mesa-libGLU-devel >> /root/rhel_check.log
echo “======================================” >> /root/rhel_check.log
echo “security check” >> /root/rhel_check.log
echo “======================================” >> /root/rhel_check.log
chkconfig –list iptables | awk ‘{print $1, $5, $7}’ >> /root/rhel_check.log
getenforce >> /root/rhel_check.log
cat /etc/sudoers >> /root/rhel_check.log
/bin/echo “* soft memlock unlimited” >> /etc/security/limits.conf
/bin/echo “* hard memlock unlimited” >> /etc/security/limits.conf
/bin/echo “* soft stack unlimited” >> /etc/security/limits.conf
/bin/echo “* hard stack unlimited” >> /etc/security/limits.conf

%end
———————————————————————————-

ksip= ksnm=
vnc vncpassword=

서진우

슈퍼컴퓨팅 전문 기업 클루닉스/ 상무(기술이사)/ 정보시스템감리사/ 시스존 블로그 운영자

You may also like...