PXE  通过网卡安装系统   预安装

流程

pxe-server端
hostnamectl set-hostname  pxe-server.example.com
yum源更改  clean all  repolist

linux中pxe安装系统(网线安装系统)_pxe
yum install dhcp
cp  /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example  /etc/dhcp/dhcpd.conf
vim /etc/dhcp/dhcpd.conf


option domain-name "westos.com";
option domain-name-servers 172.25.254.250;

subnet 172.25.254.0 netmask 255.255.255.0 {
  range 172.25.254.1 172.25.254.100;
  option routers 172.25.254.250;
  next-server  172.25.254.212;
  filename  "pxelinux.0";
}

 

systemctl restart dhcpd

yum install syslinux-4.05  tftp-server 

cp  /usr/share/syslinux/pxelinux.0  /var/lib/tftpboot
vim /etc/xinetd.d/tftp
disable = no

linux中pxe安装系统(网线安装系统)_dhcp_02

systemctl restart xinetd

systemctl stop firewalld

vim  /etc/dhcp/dhcpd.conf
next-server  172.25.254.212;
filename  "pxelinux.0";

 将启动文件复制到该目录下
[root@pxe-server isolinux]# ls
boot.cat  grub.conf   isolinux.bin  memtest     TRANS.TBL    vesamenu.c32
boot.msg  initrd.img  isolinux.cfg  splash.png  upgrade.img  vmlinuz
[root@pxe-server isolinux]# cp *  /var/lib/tftpboot/
[root@pxe-server isolinux]# cd /var/lib/tftpboot/
[root@pxe-server tftpboot]# ls
boot.cat  grub.conf   isolinux.bin  memtest     splash.png  upgrade.img   vmlinuz
boot.msg  initrd.img  isolinux.cfg  pxelinux.0  TRANS.TBL   vesamenu.c32
[root@pxe-server tftpboot]# mkdir  pxelinux.cfg
[root@pxe-server tftpboot]# ls
boot.cat  grub.conf   isolinux.bin  memtest     pxelinux.cfg  TRANS.TBL    vesamenu.c32
boot.msg  initrd.img  isolinux.cfg  pxelinux.0  splash.png    upgrade.img  vmlinuz
[root@pxe-server tftpboot]# cp isolinux.cfg pxelinux.cfg/
[root@pxe-server tftpboot]# cd pxelinux.cfg/
[root@pxe-server pxelinux.cfg]# ls
isolinux.cfg
[root@pxe-server pxelinux.cfg]# mv isolinux.cfg  default

yum install  system-config-kickstart httpd  -y

linux中pxe安装系统(网线安装系统)_http_03
systemctl start httpd
system-config-kickstart
 linux中pxe安装系统(网线安装系统)_linux_04
然后在后面加入

%packages
@base
@console-internet
@core
@fonts
@gnome-desktop
@input-methods
@internet-browser
@java-platform
@network-file-system-client
@perl-runtime
@virtualization-client
@virtualization-hypervisor
@virtualization-platform
@virtualization-tools
@x11
chrony
lftp
mtools
pax
vnc

%end
%post
cat > /etc/yum.repos.d/yum.repo <<EOF
[rhel7.3]
name=rhel7.3
baseurl=http://172.25.254.250/rhel7.3/x86_64/dvd
gpgcheck=0
EOF
%endi

cp ks.cfg  /var/www/html/
ksvalidator ks.cfg   检测正确性


然后配置default
 
timeout 60   设置默认等待时间

label linux
  menu label ^Install Red Hat  7.3
  menu default
  kernel vmlinuz
  append initrd=initrd.img repo=http://172.25.254.250/rhel7.3/x86_64/dvd ks=http://172.25.254.212/ks.cfg 

linux中pxe安装系统(网线安装系统)_xinet_05
上面是默认选项和使用脚本安装
systemctl restart xinetd.service
就可以了  然后装机的时候一定要有网线

linux中pxe安装系统(网线安装系统)_pxe_06

linux中pxe安装系统(网线安装系统)_xinet_07