基于CentOS中PXE网络环境构建实例

NO.1###########################
prepare software:
 system-config-kickstart
 syslinux
 dhcp 
 tftp-server
 httpd/vsftpd
you can use "yum install software" to install packages.

NO.2#########################
configure the DHCP-SERVICE:
# vim  /etc/dhcp/dhcpd.conf
option domain-name "example.org";                      #domain-name
option domain-name-servers 172.25.254.186;      #dns-host

default-lease-time 600;                                            #lease-time
max-lease-time 7200;                                             #max-lease-time
log-facility local7;                                                     #log-type
authoritative;                                                           #auth

subnet 192.168.2.0 netmask 255.255.255.0 {          #subnet
  range 192.168.2.2 192.168.2.20;                           #IP-pool
  option routers 192.268.2.234;                               #default-router
  filename "pxelinux.0";                                            #find the pxelinux
  next-server 192.268.2.234;                                    #tftp-server
}
 
#systemctl restart dhcpd
#systemctl enable dhcpd

NO.3####################################
configure the http:(for sharing the system operation)
#mount rhel7-x86_64.iso /mnt
#cp -r /mnt/* /var/www/html/rhel7
#systemctl enable httpd
#systemctl restart httpd

Test the sharing:
   Browser http://192.268.2.234/centos
OR
 configure the vsftpd:
#cp -r /mnt/* /var/ftp/pub/rhel7
#chgrp ftp /var/ftp/pub -R
#systemctl restart vsftpd
#systemctl enable vsftpd

Test the sharing:
   Browser ftp://192.268.2.234/centos

NO.4#####################################
Use the create kictstart! Generating a ks.cfg.

NO.5####################################
configure a tftp-server:

# vim /etc/xinetd.d/tftp
disable                = no    #modify
# systemctl restart xinetd.service


NO.6####################################
make some files and pxework-directory!
1)
#cd /var/lib/tftpboot/
#mkdir pxelinux.cfg
2)
#mount the iso of the rhel7
#cp isolinux/* /var/lib/tftpboot
3)
#cp /var/lib/tftpboot/isolinux.cfg   /var/lib/tftpboot/pxelinux.cfg/default
#cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
4)
make a userfully install source and kickstart,my of this is in the ftp's(http) pub
http://192.268.2.234/centos

ftp://192.268.2.234/ks.cfg
5)
config the file of /var/lib/tftpboot/pxelinux.cfg/default like this:
default vesamenu.c32
#prompt 1
timeout 600
display boot.msg
menu background splash.jpg
menu title Welcome to Red Hat Enterprise Linux 6.0!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000

label linux
  menu label ^Install or upgrade an existing system
  menu default
  kernel vmlinuz
  append initrd=initrd.img
label rescue
  menu label ^Rescue installed system
  kernel vmlinuz
  append initrd=initrd.img rescue
label small-install
  menu label rhel6-small-install
  kernel vmlinuz
  append initrd=initrd.img repo=http://192.268.2.234/centos ks=ftp://192.268.2.234/pub/ks.cfg noipv6

 

 

你可能感兴趣的:(基于CentOS中PXE网络环境构建实例)