CentOS 7.6 PXE方式安装和配置

以下配置文档亲手配置有效,其中为了省事关闭了selinux和防火墙。

yum -y install dhcp tftp-server syslinux httpd xinetd
systemctl disable firewalld

vi /etc/selinux/config
disabled selinux

systemctl enable dhcpd
systemctl enable httpd
systemctl enable tftp

vi /etc/dhcp/dhcpd.conf

allow booting;
allow bootp;
ddns-update-style interim;
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {
        option subnet-mask      255.255.255.0;
        option domain-name-servers  192.168.1.10;
        range dynamic-bootp 192.168.1.100 192.168.1.200;
        default-lease-time      21600;
        max-lease-time          43200;
        next-server             192.168.1.10;
        filename                "/pxelinux.0";
}
option option-128 code 128 = string;
option option-129 code 129 = text;

systemctl start dhcpd
//下午继续
systemctl disable firewalld
vi /etc/xinetd.d/tftp and change disable to 'no'

disable = no
systemctl restart xinetd

mount /dev/cdrom /media/cdrom

 cd /var/lib/tftpboot
 cp /usr/share/syslinux/pxelinux.0 .
 cp /media/cdrom/images/pxeboot/{vmlinuz,initrd.img} .
 cp /media/cdrom/isolinux/{vesamenu.c32,boot.msg} .
 mkdir pxelinux.cfg
 cp /media/cdrom/isolinux/isolinux.cfg pxelinux.cfg/default

 vi pxelinux.cfg/default
 1 default linux
61 label linux
 62 menu label ^Install CentOS Linux 7.0
 63 kernel vmlinuz
 64 append initrd=initrd.img inst.stage2=http://192.168.1.10/inst/ ks=http://192.168.10.10/inst/ks.cfg 

ks.cfg
//只要指定url就可以了
url --url http://192.168.1.10/inst/

**************************
直接把ks内容写到default无效,找不到安装源,后来只好把他写入到ks.cfg ,好神奇,明明是放到同样的
http://192.168.1.10/inst 目录下,但是却可以找到了。

标签
菜单分类