Pxe+kickstart simple construction, I write here relatively rough, but it is easier to read
[[email protected] ~]# yum-y install TFTP tftp-server httpd syslinux DHCP
Copy the DHCP sample configuration file to the DHCP configuration file directory
[Email protected] dhcp]# cp/usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf
Cp:overwrite '/etc/dhcp/dhcpd.conf '? Y
[Email protected] dhcp]# vim dhcpd.conf
The configuration file contents are as follows
Option Domain-name "example.org";
Option Domain-name-servers ns1.example.org, ns2.example.org;
Default-lease-time 600;
Max-lease-time 7200;
Log-facility Local7;
Mainly add the following content, other content depends on the actual situation
Subnet 172.16.0.0 netmask 255.255.0.0 {
Range 172.16.6.99 172.16.6.199;
#option routers 172.16.0.1; Gateway
Option routers 172.16.6.20; #vm adjusted to
Next-server 172.16.6.20;
FileName "pxelinux.0";
}
Modify the configuration file for the XINETD Super daemon thread
[Email protected] dhcp]# vim/etc/xinetd.d/tftp
Service TFTP
{
Socket_type = Dgram
protocol = UDP
Wait = yes
user = root
Server =/USR/SBIN/IN.TFTPD
Server_args =-s/var/lib/tftpboot
Disable = no #默认值为yes, change Yes to No
Per_source = 11
CPS = 100 2
Flags = IPV4
}
[Email protected] dhcp]# service xinetd restart
stopping xinetd: [FAILED]
Starting xinetd: [OK]
[Email protected] dhcp]# Ls/usr/share/syslinux
Copy the pxelinux.0 file to the/var/lib/tftpboot/directory
[Email protected] dhcp]# cp/usr/share/syslinux/pxelinux.0/var/lib/tftpboot/
[Email protected] dhcp]# ls/var/lib/tftpboot/
pxelinux.0
Test if the TFTP service is working
[Email protected] dhcp]# cd/tmp/
[[Email protected] tmp]# TFTP 172.16.6.20
Tftp> get pxelinux.0 #使用get下载pxelinux. 0 file
Tftp> quit
[email protected] tmp]# ls #查看是否能下载pxelinux. 0 file
Pulse-kloegfauvelg pxelinux.0
[Email protected] tmp]# CD ~
[Email protected] ~]# Mkdir-pv/media/cdrom
mkdir:created directory '/media/cdrom
Mount a Centos6.6.iso mirror on a VM virtual machine
[Email protected] ~]# mount-r/dev/cdrom/media/cdrom/#把系统镜像文件挂载到centos6.6.iso Mirror
[Email protected] ~]# cd/media/cdrom/
[[email protected] cdrom]# ls
Centos_buildtag Isolinux rpm-gpg-key-centos-debug-6
EFI Packages rpm-gpg-key-centos-security-6
EULA release-notes-en-us.html rpm-gpg-key-centos-testing-6
GPL Repodata TRANS. TBL
Images rpm-gpg-key-centos-6
Copying files to the/var/lib/tftpboot/directory
[Email protected] images]# cd/media/cdrom/images/pxeboot/
[[email protected] pxeboot]# ls
Initrd.img TRANS. TBL Vmlinuz
[email protected] pxeboot]# CP Vmlinuz initrd.img/var/lib/tftpboot/
[Email protected] pxeboot]# cd/media/cdrom/isolinux/
[[email protected] isolinux]# ls
Boot.cat grub.conf isolinux.bin memtest TRANS. TBL Vmlinuz
Boot.msg initrd.img isolinux.cfg splash.jpg VESAMENU.C32
[email protected] isolinux]# CP boot.msg splash.jpg vesamenu.c32/var/lib/tftpboot/
[email protected] isolinux]# CP isolinux.cfg isolinux.bin/var/lib/tftpboot/
[Email protected] isolinux]# cd/var/lib/tftpboot/
[Email protected] tftpboot]# mkdir pxelinux.cfg
[email protected] tftpboot]# CP isolinux.cfg Pxelinux.cfg/default
[[Email protected] tftpboot]# CD
[Email protected] ~]# MKDIR/VAR/WWW/HTML/CENTOS6
[email protected] ~]# Mount--bind/media/cdrom//VAR/WWW/HTML/CENTOS6
[Email protected] ~]# LS/VAR/WWW/HTML/CENTOS6
Centos_buildtag Isolinux rpm-gpg-key-centos-debug-6
EFI Packages rpm-gpg-key-centos-security-6
EULA release-notes-en-us.html rpm-gpg-key-centos-testing-6
GPL Repodata TRANS. TBL
Images rpm-gpg-key-centos-6
[Email protected] html]# wget http://172.16.0.1/rhel6.x86_64.cfg
--2015-01-27 14:42:06--http://172.16.0.1/rhel6.x86_64.cfg
Connecting to 172.16.0.1:80 ... Connected.
HTTP request sent, awaiting response ... OK
length:2249 (2.2K) [Text/plain]
Saving to: "Rhel6.x86_64.cfg"
100%[======================================================>] 2,249--.-k/s in 0s
2015-01-27 14:42:06 (349 MB/s)-"rhel6.x86_64.cfg" saved [2249/2249]
[[email protected] html]# ls
CENTOS6 rhel6.x86_64.cfg
[Email protected] html]# MV Rhel6.x86_64.cfg centos6.cfg
[Email protected] html]# vim centos6.cfg
Modify the URL path to a httpd web path
URL--url http://172.16.6.20/centos6 #此次服务可能是http, FTP, etc., pay attention to modify
[Email protected] html]# cd/var/lib/tftpboot/
[Email protected] tftpboot]# vim Pxelinux.cfg/default
Add after append initrd=initrd.img under the first label
Ks=http://172.16.6.20/centos6.cfg
Label Linux
Menu label ^install or upgrade an existing system
Menu default
Kernel Vmlinuz
Append initrd=initrd.img ks=http://172.16.6.20/centos6.cfg
This article from the "source clean is clear, the shape of the end of the shadow straight" blog, please be sure to keep this source http://zhouxt.blog.51cto.com/8743763/1641581
Pxe+kickstart Simple Construction