yum install dhcp xinetd syslinux tftp-server httpd
编辑dhcpdb配置(192.168.0.1为本机IP)
default-lease-time 6000; max-lease-time 72000; log-facility local7; subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.100 192.168.0.200; option routers 192.168.0.1; filename "pxelinux.0"; next-server 192.168.0.1; }
修改tftp配置(no就是开启)
disable = no
创建和挂载系统目录
mkdir /var/www/html/centos7 mount -o loop CentOS7.iso /var/www/html/centos7/
复制vmlinuz
,和 initrd.img
到tftp访问目录的centos7子目录中,因为以后会引导其它的系统,所以这里通过子目录将不同的系统区分开
mkdir /var/lib/tftpboot/centos7 cp /var/www/html/centos7/images/pxeboot/initrd.img /var/lib/tftpboot/centos7/ cp /var/www/html/centos7/images/pxeboot/vmlinuz /var/lib/tftpboot/centos7/
vesamenu.c32
和menu.c32
是syslinux所拥有众多模块中的两个,它们的功能是制定启动器使用什么模式的背景。vesamenu.c32
图形模式,menu.c32
文本模式。我选择的是menu.c32
。
cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/ cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
建立pxelinux.cfg目录,并在此目录下建立default文件,编辑引导菜单。
mkdir /var/lib/tftpboot/pxelinux.cfg/ vi /var/lib/tftpboot/pxelinux.cfg/default
default配置内存,如果要多个系统可以在里面添加
default menu.c32 prompt 0 timeout 300 ONTIMEOUT local menu title ########## PXE Boot Menu ########## label 1 menu label ^1) Install CentOS 7 x64 with HTTP kernel centos7/vmlinuz append initrd=centos7/initrd.img method=http://192.168.0.1/centos7 devfs=nomount
启动服务
systemctl start dhcpd.service
systemctl start xinetd.service
systemctl start tftp.service
systemctl start httpd.service
Windows
在default添加Windows引导
default menu.c32 prompt 0 timeout 300 ONTIMEOUT local menu title ########## PXE Boot Menu ########## label 1 menu label ^1) Install CentOS 7 x64 with HTTP kernel centos7/vmlinuz append initrd=centos7/initrd.img method=http://192.168.0.1/centos7 devfs=nomount label 2 menu label ^1) Install Windows 7 x64 KERNEL memdisk INITRD winpe_amd64.iso APPEND iso raw
安装并配置samba
yum install smba -y
vi /etc/samba/smb.conf [global] workgroup = PXESERVER server string = Samba Server Version %v log file = /var/log/samba/log.%m max log size = 50 idmap config * : backend = tdb cups options = raw netbios name = pxe map to guest = bad user dns proxy = no public = yes ## For multiple installations the same time - not lock kernel kernel oplocks = no nt acl support = no security = user guest account = nobody [install] comment = Windows 7 Image path = /windows read only = no browseable = yes public = yes printable = no guest ok = yes oplocks = no level2 oplocks = no
创建共享目录
mkdir /windows
验证配置文件并启动服务
testparm
systemctl start smb
挂载系统镜像
mount -o loop /iso/cn_windows_7_enterprise_with_sp1_x64_dvd_u_677685.iso /mnt/
制作winpe镜像
1.下载windows自动安装工具包 ISO映像文件(安装该工具包需要.net2.0)
http://www.microsoft.com/en-us/download/details.aspx?id=5753
2.装载 KB3AIK_EN.iso 映像文件,运行StartCD.exe,点击图中选项,之后完成安装
3. 点击AIK命令提示符,(以管理员身份运行),并制作winpe_amd64.iso镜像
4. 下面是制作命令,需要根据AIK安装目录修改命令中的路径,pe镜像路径可以自行定义
copype amd64 C:\winPE_amd64 copy "C:\Program Files\Windows AIK\Tools\PETools\amd64\winpe.wim" C:\winpe_amd64\ISO\Sources\Boot.wim copy "C:\Program Files\Windows AIK\Tools\amd64\Imagex.exe" C:\winpe_amd64\ISOoscdimg -n -bC:\winpe_amd64\etfsboot.com C:\winpe_amd64\ISO C:\winpe_amd64\winpe_amd64.iso
5. 最后将做好的PE放到pxe服务器的/var/lib/tftpboot/目录下
centos7 搭建pxe 安装centos windows(非全自动)(这个教程测试centos6和7.2可以用,Windows各版本也可以)