部署多个发行版的思路是传递给NBP不同发行版的内核文件,为此在pxelinux.0同级目录下创建目录。

这里从最简单的红帽系开始,整理好的结构类似这样。

ubuntu和ks不那么契合,一时搞不定preseed,先挖个坑以后来填

[root@localhost ~]# tree /var/lib/tftpboot/pxe/      
/var/lib/tftpboot/pxe/      
├── centos      
│   ├── 63      
│   │   ├── initrd.img      
│   │   └── vmlinuz      
│   ├── 66      
│   │   ├── initrd.img      
│   │   └── vmlinuz      
│   └── 71      
│       ├── initrd.img      
│       └── vmlinuz

├── pxelinux.0      
├── pxelinux.cfg      
│   └── default      
├── splash.jpg      
├── vesamenu.c32

 

编辑pxelinux.cfg/default增加多系统选单。

PS:这里需要注意内核参数格式,7的inst.ks,6系是ks。

label 2      
menu label ^2) Install CentOS 6 x64 with local Repo      
kernel centos/66/vmlinuz      
append initrd=centos/66/initrd.img  ks=ftp://192.168.1.200/pub/ks/centos/66/co.cfg      

这里我们把前方7生成的kickstart做适当修改

[root@localhost ~]# cat /var/ftp/pub/ks/centos/66/co.cfg      

#platform=x86, AMD64, or Intel EM64T    
#version=DEVEL      
# Firewall configuration      
firewall --enabled --ssh      
# Install OS instead of upgrade      
install      
# Use network installation      
url --url="ftp://192.168.1.200/pub/iso/centos/66"      
# Root password      
rootpw --iscrypted $1$u3Z6DS70$0i.X7A5xhzNebhrvuy0mc1      
# System authorization information      
auth  --useshadow  --passalgo=sha512      
# Use text mode install      
text      
# System keyboard      
keyboard us      
# System language      
lang en_US      
# SELinux configuration      
selinux --permissive      
# Do not configure the X Window System      
skipx      
# Installation logging level      
logging --level=info      
# Reboot after installation      
reboot      
# System timezone      
timezone --isUtc Asia/Shanghai      
# Network information      
network  --bootproto=dhcp --device=eth0 --onboot=on      
# System bootloader configuration      
bootloader --location=mbr      
autopart #这里如果使用kickstart图形界面生成ks配置,同时没有创建分区,需要添加此参数,否则安装会停在硬盘分区      
# Clear the Master Boot Record      
zerombr      
# Partition clearing information      
clearpart --all --initlabel

%packages    
@core    --nobase     
openssh-server     
%end

%pre
#!/bin/sh
echo "###############"
echo "Installation Began"
%end

%post
#!/bin/sh
echo "##################"
echo "Hello, World."
%end