目录
PXE是有Intel公司开发的网络引导技术,工作在Client/Server模式(也简称CS模式),允许客户机通过网络从远程服务器下载引导镜像,并加载安装文件或整改操作系统。
① 客户机
② 服务端
1.网卡需要查找相关的dhcp服务器(获取地址时间)
2.找到后dhcp服务器提供ip地址,和引导程序(boot loader)的地址 还提供给客户机TFTPserver地址(dhcp本身不提供tftp服务)
3.网卡使用tftp客户端吧引导程序加载到内存中来
4.bios执行引导程序
5.引导程序会去TFTP去查找配置文件
6.根据配置文件去引导安装系统
批量安装系统
[root@localhost mnt]# yum install dhcp tftp-server.x86_64 vsftpd syslinux -y
[root@localhost /]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
[root@localhost /]# vim /etc/dhcp/dhcpd.conf
# DHCP server to understand the network topology.
subnet 192.168.100.0 netmask 255.255.255.0 {
range 192.168.100.10 192.168.100.50;
option routers 192.168.100.100;
next-server 192.168.100.100;
filename "pxelinux.0";
}
[root@localhost /]# rpm -ql tftp-server
[root@localhost /]# vim /etc/xinetd.d/tftp
disable = no
[root@localhost tftpboot]# cd /var/ftp/
[root@localhost ftp]# mkdir centos7
[root@localhost ftp]# mount /dev/sr0 centos7/
[root@localhost ftp]# cd centos7/
[root@localhost centos7]# cd isolinux/
[root@localhost isolinux]# cp initrd.img vmlinuz /var/lib/tftpboot/
[root@localhost isolinux]# cd /var/lib/tftpboot/
[root@localhost tftpboot]# rpm -ql syslinux |grep pxelinux.0
[root@localhost tftpboot]# cp /usr/share/syslinux/pxelinux.0 ./
[root@localhost tftpboot]# mkdir pxelinux.cfg
[root@localhost tftpboot]# cd pxelinux.cfg/
[root@localhost pxelinux.cfg]# vim default
复制
[root@localhost ~]# cd /mnt
[root@localhost mnt]# cd isolinux/
[root@localhost isolinux]# vim isolinux.cfg
[root@localhost pxelinux.cfg]# vim default
default auto
prompt 1
label auto
kernel vmlinuz
append initrd=initrd.img method=ftp://192.168.100.100/centos7
label linux text
kernel vmlinuz
append text initrd =initrd.img method=ftp://192.168.100.100/centos7
label linux rescue
kernel vmlinuz
append rescue initrd=initrd.img method=ftp://192.168.100.100/centos7
[root@localhost pxelinux.cfg]# cd ..
[root@localhost tftpboot]# tree
[root@localhost tftpboot]# systemctl stop firewalld
[root@localhost tftpboot]# setenforce 0
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33
IPADDR=192.168.100.100
NETMASK=255.255.255.0
GATEWAY=192.168.100.100
#DNS1=8.8.8.8
设置仅主机
[root@localhost ~]# systemctl restart network
[root@localhost ~]# ip a
root@localhost ~]# systemctl start dhcpd
[root@localhost dhcp]# systemctl start tftp
[root@localhost dhcp]# systemctl start vsftpd
设置仅主机
[root@localhost pxelinux.cfg]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# mkdir bak
[root@localhost yum.repos.d]# mv *.repo bak/
[root@localhost yum.repos.d]# vim local.repo
[local]
name=local
baseurl=file:///var/ftp/centos7
gpgckeck=0
[root@localhost yum.repos.d]# yum clean all && yum makecache
[root@localhost yum.repos.d]# yum install system-config-kickstart -y
[root@localhost yum.repos.d]# cd /var/ftp/
[root@localhost ftp]# cd /var/lib/tftpboot/
[root@localhost tftpboot]# cd pxelinux.cfg/
[root@localhost pxelinux.cfg]# vim default
default menu.c32
prompt 1
label auto
kernel vmlinuz
append initrd=initrd.img method=ftp://192.168.100.100/centos7 ks=ftp://192.168.100.100/ks.cfg
label linux text
kernel vmlinuz
append text initrd =initrd.img method=ftp://192.168.100.100/centos7
label linux rescue
kernel vmlinuz
append rescue initrd=initrd.img method=ftp://192.168.100.100/centos7
[root@localhost pxelinux.cfg]# cd /usr/share/syslinux/ #不加men.c32就不用打 是壁纸
[root@localhost syslinux]# cp menu.c32 /var/lib/tftpboot/
手机扫一扫
移动阅读更方便
你可能感兴趣的文章