Install CentOS6.6 on pxe
Environment:
Dhcp server: 172.160.1
Tftp + pxe Server: 172.160.2
Configure DHCP server
1. Configure the local yum Source
mount
/dev/cdrom
/mnt
rm
-rf
/etc/yum
.repos.d/*
vi
/etc/yum
.repos.d
/base
.repo
[base]
name=base
baseurl=
file
:
///mnt
enabled=1
gpgcheck=0
yumrepolist
Ii. install and configure dhcp
yum-y
install
dhcp
cp
/usr/share/doc/dhcp-4
.1.1
/dhcpd
.conf.sample
/etc/dhcp/dhcpd
.conf
cat
/etc/dhcp/dhcpd
.conf|
grep
-
v
"^$"
|
grep
-
v
"^#"
optiondomain-name
"parpar.com"
;
optiondomain-name-servers8.8.8.8;
default-lease-
time
3600;
max-lease-
time
7200;
log-facilitylocal7;
subnet172.168.0.0netmask255.255.0.0{
range172.168.0.20172.168.0.30;
optionrouters172.168.0.1;
next-server172.168.0.2;
filename
"pxelinux.0"
;
}
chkconfigdhcpdon
servicedhcpdstart
Configure the tftp + http + pxe Server
1. install and configure tftp
yum-y
install
tftptftp-server
chkconfigtftpon
servicexinetdstart
2. Configure the PXE work environment
yum-y
install
syslinux
cp
/usr/share/syslinux/pxelinux
.0
/var/lib/tftpboot/
3. Provide boot kernel files
cp
/mnt/images/pxeboot/
{vmlinuz,initrd.img}
/var/lib/tftpboot/
cp
/mnt/isolinux/
{vesamenu.c32,boot.msg,splash.jpg}
/var/lib/tftpboot
mkdir
/var/lib/tftpboot/pxelinux
.cfg
cp
/mnt/isolinux/isolinux
.cfg
/var/lib/tftpboot/pxelinux
.cfg
/default
4. install and configure the httpd service
yum-y
install
httpd
mkdir
/var/www/html/centos6
mount
--bind
/mnt
/var/www/html/centos6
servicehttpdstart
5. Generate ks files
yum-y
install
system-config-kickstart
system-config-kickstart
mv
ks.cfg
/var/www/html/
cat
/var/www/html/ks
.cfg
#platform=x86,AMD64,orIntelEM64T
#version=DEVEL
#Firewallconfiguration
firewall--disabled
#InstallOSinsteadofupgrade
install
#Usenetworkinstallation
url--url=
"http://172.168.0.2/centos6"
repo--name=
"CentOS"
--baseurl=http:
//172
.168.0.2
/centos6
--cost=100
#Rootpassword
rootpw--iscrypted$1$10KAJR0t$WqUKt8fRa24FDPnHZxRTZ1
#Systemauthorizationinformation
auth--useshadow--passalgo=sha512
#Usegraphicalinstall
graphical
firstboot--disable
#Systemkeyboard
keyboardus
#Systemlanguage
langen_US
#SELinuxconfiguration
selinux--disabled
#Installationlogginglevel
logging--level=info
#Rebootafterinstallation
reboot
#Systemtimezone
timezoneAsia
/Shanghai
#Networkinformation
network--bootproto=dhcp--device=eth0--onboot=on
#Systembootloaderconfiguration
bootloader--append=
"crashkernel=autorhgbquiet"
--location=mbr--driveorder=
"sda"
#CleartheMasterBootRecord
zerombr
#Partitionclearinginformation
clearpart--all--initlabel
#Diskpartitioninginformation
part
/boot
--fstype=
"ext4"
--size=200
partswap--size=4000
part/--fstype=
"ext4"
--grow--size=200
%packages
@core
%end
Vi. Modification
vim
/var/lib/tftpboot/pxelinux
.cfg
/default
labellinux
menulabel^Installorupgradeanexistingsystem
menudefault
kernelvmlinuz
appendks=http:
//172
.168.0.2
/ks
.cfginitrd=initrd.img
7. After the configuration is complete, the system can be automatically installed after a new virtual machine is started.