close

http://blog.csdn.net/liuy5277/article/details/6667587

 

The Preboot eXecution Environment (PXE, also known as Pre-Execution Environment; sometimes pronounced "pixie") is an environment to boot computers using a network interface independently of data storage devices (like hard disks) or installed operating systems.

 

 

 

Server OS: Centos5.6 i386 

  hostname: linuxdba 

  ip: 192.168.1.17 

  netmask: 255.255.255.0 

  gateway: 192.168.1.1 

  DNS: 8.8.8.8 

Prepare to install the Centos 6.0 

  Download site: http://mirrors.163.com/centos /6.0/isos/i386/CentOS-6.0-i386-bin-DVD.iso

 

 

1. DHCP 

linuxdba -->yum install dhcp 

linuxdba -->vi /etc/dhcpd.conf

 

 

ddns-update-style interim; 

ignore client-updates;

 

 

subnet 192.168.1.0 netmask 255.255.255.0 { 

        option routers 192.168.1.1; 

        option subnet-mask 255.255.255.0; 

        option domain-name-servers 8.8.8.8; 

        option time-offset -18000; # Eastern Standard Time 

        filename "/pxelinux.0 "; 

        next-server 192.168.1.17; 

        range dynamic-bootp 192.168.1.100 192.168.1.200; 

        default-lease-time 21600; 

        max-lease-time 43200; 

}

 

 

 

linuxdba -->chkconfig dhcpd on 

linuxdba -->service dhcpd start

 

 

2. tftp 

linuxdba -->yum install tftp-server 

linuxdba -->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 }

       

 

 

 

 

 

linuxdba -->service xinetd restart 

linuxdba -->chkconfig xinetd on

 

 

3. http

 

 

linuxdba -->yum install http 

linuxdba -->mkdir /var/www/html/iso 

linuxdba -->mount -o loop /virtual/CentOS-6.0-i386-bin-DVD.iso /var/www/html/iso / 

linuxdba -->cp /usr/lib/syslinux/pxelinux.0 /tftpboot/ 

linuxdba -->cp /var/www/html/iso/images/pxeboot/initrd.img /tftpboot/ 

linuxdba -->cp /var /www/html/iso/images/pxeboot/vmlinuz /tftpboot/ 

linuxdba -->mkdir /tftpboot/pxelinux.cfg 

linuxdba -->vi /tftpboot/pxelinux.cfg/default

 

 

default centos 

#prompt 1 

timeout 15

 

 

display boot.msg

 

 

 

label centos 

  menu label ^Install or upgrade an existing system 

  menu default 

  kernel vmlinuz 

  append initrd=initrd.img ks=http://192.168.1.17/ks.cfg

 

 

 

linuxdba -->chmod 777 /tftpboot/pxelinux.cfg/default

 

 

 

4. ks.cfg 

linuxdba -->vi /var/www/html/ks.cfg # Kickstart file automatically generated by anaconda.

 

 

#version=RHEL6 

install 

#cdrom 

url --url=http://192.168.1.17/iso 

lang en_US.UTF-8 

keyboard us 

rootpw --iscrypted $6$YHg0M9ey56UIjzUx$tm9tayFqF6xfSyfzSTJqk/iLAhqlXIFBXz2IMg2mipHT2RH5DJN3cnoMHf43GKPxKX1H0GsACg5ACG/gbZShw1

firewall --disabled 

selinux --disabled 

firstboot --disable 

timezone Asia/Chongqing 

bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb 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 --none --drives=sda 

clearpart --all --initlabel 

part /boot --fstype=ext4 --size=300 

part / -- fstype=ext4 --grow --asprimary --size=200 

part swap --size=1800 

reboot 

#repo --name="centos" --baseurl=file:///mnt/source --cost=100

 

 

%packages 

@base 

@core 

@basic-desktop 

@desktop-platform 

@desktop-platform-devel 

@internet-applications 

@internet-browser 

@legacy-x 

@nfs-file-server 

@network-tools 

@php 

@server-policy 

@system -admin-tools 

@tex 

@web-server 

@system-management-wbem 

@x11 

mtools 

sgpio 

desktop-file-utils 

libXmu 

crypto-utils 

tog-pegasus 

%end

 

 

linuxdba -->chmod 777 /var/www/html/ks.cfg

 

 

5. Start your target machine from network, the installtion will start automatically.

 

 

 

Notes: 

Reference page: 

  1.http://spazzzz.blog.51cto.com/2707720/613598 

  2.http://en.wikipedia.org/wiki/Preboot_Execution_Environment

 

 

Any doubt, pls contect linuxdba@qq.com

 

arrow
arrow
    文章標籤
    Linux Centos PXE
    全站熱搜

    m1016c 發表在 痞客邦 留言(0) 人氣()