PXE HTTP로 부팅하기
- 꼬반
- 2015. 6. 8. 09:11
====== PXE_http로 부팅하기 ======
출처 : http://blog.naver.com/PostView.nhn?blogId=hackit&logNo=150124612644
Network,Kick-Start Install linux_hadoop 2011/11/20 13:01
http://hackit.blog.me/150124612644
Install OS to a Client computer from PXE Server. It's useful if your client computer has no CD/DVD drive.
[1] Download ISO image first to your PXE server. The following example shows the ISO image of CentOS 6 is under /home/iso directory.
<code>
[root@pxe ~]# mkdir -p /var/pxe/centos6
[root@pxe ~]# mkdir /var/lib/tftpboot/centos6
[root@pxe ~]# mount -t iso9660 -o loop /home/iso/CentOS-6.0-x86_64-bin-DVD1.iso /var/pxe/centos6
[root@pxe ~]# cp /var/pxe/centos6/images/pxeboot/vmlinuz /var/lib/tftpboot/centos6/
[root@pxe ~]# cp /var/pxe/centos6/images/pxeboot/initrd.img /var/lib/tftpboot/centos6/
[root@pxe ~]# cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/
[root@pxe ~]# vi /var/lib/tftpboot/pxelinux.cfg/default
</code>
<code>
# create new
timeout 1
default menu.c32
menu title ########## PXE Boot Menu ##########
label 1
menu label ^1) Install CentOS 6
kernel centos6/vmlinuz
# change like follows : specify kick-start-file
# original fuction
# append initrd=centos6/initrd.img method=http://10.0.0.30/centos6 devfs=nomount
append initrd=centos6/initrd.img ks=http://10.0.0.30/ks/centos6-ks.cfg ksdevice=eth1
label 2
menu label ^2) Boot from local drive
localboot
</code>
Start HTTP Server.
Install httpd
<code>
[root@www ~]# yum -y install httpd
# remove welcome page
[root@www ~]# rm -f /etc/httpd/conf.d/welcome.conf
# remove default error page
[root@www ~]# rm -f /var/www/error/noindex.html
# create a link for Perl
[root@www ~]# ln -s /usr/bin/perl /usr/local/bin/perl
</code>
Configure httpd.
<code>
[root@www ~]# vi /etc/httpd/conf/httpd.conf
# line 44: change
ServerTokens Prod
# line 76: change to ON
KeepAlive On
# line 262: Admin's address
ServerAdmin root@pdalgo.server
# line 276: change to your server's name
ServerName 10.0.0.30:80
# line 331: change (enable CGI and disable Indexes)
Options FollowSymLinks ExecCGI
# line 338: change
AllowOverride All
# line 402: add file name that it can access only with directory's name
DirectoryIndex index.html index.cgi index.php
# line 536: change
ServerSignature Off
# line 759: make it comment
#
AddDefaultCharset UTF-8
# line 796: uncomment and add file-type that apache looks them CGI
AddHandler cgi-script .cgi .pl
</code>
<code>
[root@www ~]# /etc/rc.d/init.d/httpd start
Starting httpd: [ OK ]
[root@www ~]# chkconfig httpd on
[root@pxe ~]# vi /etc/httpd/conf.d/pxeboot.conf
</code>
<code>
# create new
Alias /centos6 /var/pxe/centos6
<Directory /var/pxe/centos6>
Options Indexes FollowSymLinks
Order Deny,Allow
Deny from all
Allow from 127.0.0.1 10.0.0.0/24 #Ip address you allow
</Directory>
</code>
<code>
[root@pxe ~]# /etc/rc.d/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd:[ OK ]
</code>
It's troublesome to do the same installation again and again if you need to install to many Client, then configure Kick-Start Install settings.
[1] Configure Kick-Start settings
<code>
[root@pxe ~]# mkdir /var/www/html/ks
[root@pxe ~]# cp /root/anaconda-ks.cfg /var/www/html/ks/centos6-ks.cfg
[root@pxe ~]# chmod 644 /var/www/html/ks/centos6-ks.cfg
[root@pxe ~]# openssl passwd -1
# generate root password
Password:
Verifying - Password:
$1$sxxxxxxxxxxxxxxxxxxxxxxxxxxx.# remember it
[root@pxe ~]# vi /var/www/html/ks/centos6-ks.cfg
</code>
<code>
# Kickstart file automatically generated by anaconda.
#version=RHEL6
install
#add : automatically proceed
autostep
#add : reboot after finishing installation
reboot
#add : install source
url --url=http://10.0.0.30/centos6/
lang en_US.UTF-8
keyboard us
#change to the root password you generated above
rootpw --iscrypted $1$yfp8pY1w$.aZg.HhMCwoZLaq/VxYCG1
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512 --enablefingerprint
selinux --enforcing
timezone --utc Asia/Seoul
#bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# if the client is KVM virtual machine, make the line above comment and add the line below (uncomment it)
bootloader --location=mbr --driveorder=vda --append="console=ttyS0,115200n8 crashkernel=auto"
#add : delete all partitions in all disks
zerombr
clearpart --all --initlabel
# 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 --drives=sda
#volgroup VolGroup --pesize=4096 pv.oxgYA4-N5LR-JCyL-ZTAf-gVLZ-D81o-j8FLuV
#logvol /home --fstype=ext4 --name=lv_home --vgname=VolGroup --grow --size=100
#logvol / --fstype=ext4 --name=lv_root --vgname=VolGroup --grow --size=1024 --maxsize=51200
#logvol swap --name=lv_swap --vgname=VolGroup --grow --size=1024 --maxsize=34288
#part /boot --fstype=ext4 --size=500
#part pv.oxgYA4-N5LR-JCyL-ZTAf-gVLZ-D81o-j8FLuV --grow --size=1
#make it comment
#repo -name="CentOS" -baseurl=file:///mnt/source --cost=100
%packages
@base
@core
@debugging
@basic-desktop
@desktop-debugging
@desktop-platform
@directory-client
@fonts
@general-desktop
@graphical-admin-tools
@input-methods
@internet-applications
@internet-browser
@java-platform
@legacy-x
@network-file-system-client
@office-suite
@print-client
@remote-desktop-clients
@server-platform
@server-policy
@virtualization
@virtualization-client
@virtualization-platform
@virtualization-tools
@x11
mtools
pax
oddjob
sgpio
genisoimage
wodim
abrt-gui
certmonger
pam_krb5
krb5-workstation
nscd
pam_ldap
nss-pam-ldapd
gnome-pilot
libXmu
%end
</code>
참고 : http://www.server-world.info/en/note?os=CentOS_6&p=pxe&f=3
출처 : http://http://blog.naver.com/hackit/150124612644 | 작성자 천재해커