1锄开、安裝需要的軟件
yum -y install dhcp tftp-server httpd syslinux
2添祸、使用httpd提供kickstart文件及yum倉庫
(1)將手動安裝系統(tǒng)自動生成的kickstart文件復(fù)制到http的目錄中,并做適當(dāng)修改
cp /root/anaconda-ks.cfg /var/www/html/centos7.cfg
chmod +r centos7.cfg
vi /var/www/html/centos7.cfg
# Use CDROM installation media
#cdrom //將光盤安裝的配置注釋掉
url --url=http://192.168.34.7/centos/7/x86_64/ //添加網(wǎng)絡(luò)安裝的路徑
reboot //安裝完成后自動重啟
//其他配置根據(jù)自己情況做修改
(2)將本地光盤掛載到http的目錄中
mount -o ro /dev/cdrom /var/www/html/centos/7/x86_64/
3佛玄、在tftp的目錄中創(chuàng)建引導(dǎo)系統(tǒng)
cp /var/www/html/centos/7/x86_64/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/
cp /usr/share/syslinux/{chain.c32,mboot.c32,memdisk,menu.c32,pxelinux.0} /var/lib/tftpboot
mkdir /var/lib/tftpboot/pxelinux.cfg
vi /var/lib/tftpboot/pxelinux.cfg/default
default menu.c32
prompt 5
timeout 30
MENU TITLE Centos 7 PXE Menu
LABEL linux
MENU LABLE Install Centos 7 install
KERNEL vmlinuz
APPEND initrd=initrd.img ks=http://192.168.34.7/centos7.cfg
4、搭建dhcp服務(wù)
vi /etc/dhcp/dhcpd.conf
subnet 192.168.34.0 netmask 255.255.255.0 {
range 192.168.34.101 192.168.34.200;
filename "pxelinux.0"; //指定引導(dǎo)文件名
next-server 192.168.34.7; //指定引導(dǎo)文件所在tftp服務(wù)器
}
5扣囊、啟動相關(guān)服務(wù)
systemctl start httpd tftp.socket dhcpd
6拙徽、保證客戶端服務(wù)器內(nèi)存2G以上恰矩,內(nèi)存過小會無法安裝仿便。