安装步骤概况:
- IOS系统镜像文件——FTP
- FTP
- DHCP
- TFTP(简单文件传输协议,包含内核文件、初始化镜像文件、引导程序、引导配置文件)
详细安装步骤:
FTP
[root@localhost ~]# vim /etc/yum.repos.d/CentOS-media.repo
[development] (文件名称必须修改)
[root@localhost centos7]# systemctl stop firewalld
[root@localhost centos7]# setenforce 0
[root@localhost ~]# yum -y install vsftpd
[root@localhost ~]# cd /var/ftp
[root@localhost ftp]# mkdir centos7
[root@localhost ftp]# cp -rf /media/cdrom/* /var/ftp/centos7/
[root@localhost centos7]# systemctl restart vsftpd
备注:
开机自动启动程序[root@localhost centos7]# systemctl enable vsftpd
DHCP
[root@localhost ~]# yum -y install dhcp
[root@localhost ~]# vim /etc/dhcp/dhcpd.conf
subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.200 192.168.10.200;
next-server 192.168.10.101;
filename "pxelinux.0";
}
[root@localhost ~]# systemctl start dhcpd
[root@localhost ~]# systemctl enable dhcpd (开机自动启动)
tftp-server
[root@localhost ~]# yum -y install tftp-server
[root@localhost ~]# vim /etc/xinetd.d/tftp
disable = no (将disable yes更改为no )
[root@localhost ftp]# systemctl start tftp
[root@localhost ~]# systemctl enable tftp
[root@localhost ftp]# cd /media/cdrom/
[root@localhost cdrom]# ls
CentOS_BuildTag GPL LiveOS RPM-GPG-KEY-CentOS-7
EFI images Packages RPM-GPG-KEY-CentOS-Testing-7
EULA isolinux repodata TRANS.TBL
[root@localhost cdrom]# cd images
[root@localhost images]# ls
efiboot.img pxeboot TRANS.TBL
[root@localhost images]# cd pxeboot
[root@localhost pxeboot]# ls
initrd.img TRANS.TBL vmlinuz
[root@localhost pxeboot]# cp initrd.img vmlinuz /var/lib/tftpboot/
备注:
initrd.img :初始化镜像文件
vmlinuz :内核文件
[root@localhost ~]# yum -y install syslinux
[root@localhost ~]# cd /usr/share/syslinux/
[root@localhost syslinux]# ls
[root@localhost ~]# cd /usr/share/syslinux/ (pxeliunx.0是该引导程序)
[root@localhost syslinux]# cp pxelinux.0 /var/lib/tftpboot/
[root@localhost tftpboot]# mkdir pxelinux.cfg
[root@localhost tftpboot]# cd pxelinux.cfg/ (pxelinux.cfg是引导程序的引导文件)
[root@localhost pxelinux.cfg]# ls
[root@localhost pxelinux.cfg]# vim default
default auto
promot 1
label auto (自动)
kernel vmlinuz (内核)
append initrd=initrd.img method=ftp://192.168.10.101/centos7
label linux text
kernel vmlinuz
append text initrd=initrd.img method=ftp://192.168.10.101/centos7
label linux rescue
kernel vmlinuz
append rescue initrd=initrd.img method=ftp://192.168.10.101/centos7
备注:
[root@localhost tftpboot]# ls
initrd.img pxelinux.0 pxelinux.cfg vmlinuz
- initrd.img 初始化镜像文件
- pxelinux.0 引导程序
- pxelinux.cfg 引导程序的引导文件
- vmlinuz 内核
四者缺一不可