CentOS 7实现PXE支持CentOS5,6,7的系统安装(2)

centos6的.cfg参考如下:
[root@centos7 html]# cat /var/www/html/ksdir/ks6.cfg 
# Kickstart file automatically generated by anaconda.
 
#version=DEVEL
install
url --url=http://httpsrv/centos/6
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw  --iscrypted $6$CxpwSUg0oCIQZX52$0yfD8CXU4Q.60uYDqSHWz5.1enxwnhrv9esPRYSix4U1cWoaN.hOpgSLqCd22yjRdEhAwwUdxAIbn.mxMn.kx/
firewall --disable
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
zerombr
clearpart --all
reboot
text
part /boot --fstype=ext4 --size=1000
part / --fstype=ext4 --size=100000
part /app --fstype=ext4 --size=50000
part swap --size=2048
 
%packages
@base
@core
@basic-desktop
@desktop-platform
@fonts
@general-desktop
@graphical-admin-tools
@input-methods
@internet-applications
@internet-browser
@network-file-system-client
@office-suite
@print-client
@remote-desktop-clients
@server-policy
@workstation-policy
@x11
mtools
pax
%end

rhel5的.cfg文件如下:
# Kickstart file automatically generated by anaconda.
 
install
url --url=http://192.168.23.7/rhel5
key --skip
lang zh_CN.UTF-8
keyboard us
xconfig --startxonboot
network --device eth0 --bootproto dhcp --hostname rhel5.4.centos.com
rootpw --iscrypted $1$YntMaKAR$vXCZ6J8hGwcRtfso7lk9o.
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --disabled
timezone Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --linux
zerombr
clearpart --all
reboot
 
text
part /boot --fstype ext3 --size=100
part / --fstype ext3 --size=51200
part /app --fstype ext3 --size=10240
part swap --size=1024
 
%packages
@admin-tools
@base
@core
@dialup
@editors
@graphical-internet
@graphics
@legacy-software-support
@office
@printing
@text-internet
@base-x
kexec-tools
fipscheck
sgpio
emacs
libsane-hpaio
xorg-x11-utils
xorg-x11-server-Xnest

5.准备相关文件,必备文件如下:
pxelinux.0(pex引导文件),menu.c32(图形菜单),vmlinuz内核文件,initrd.img初始根文件系统
配置文件:isolinux.cfg改名为pxelinux.cfg/default
    cp /usr/share/syslinux/{pxelinux.0,menu.c32} /var/lib/tftpboot/
    mkdir /var/lib/tftpboot/centos{6,7}
    mkdir /var/lib/tftpboot/rhel5
    cp /var/www/html/rhel5/isolinux/{initrd.img,vmlinuz}  /var/lib/tftpboot/rhel5
    cp /var/www/html/centos6/isolinux/{initrd.img,vmlinuz}  /var/lib/tftpboot/centos6
    cp /var/www/html/centos7/isolinux/{initrd.img,vmlinuz}  /var/lib/tftpboot/centos7
    mkdir /var/lib/tftpboot/pxelinux.cfg/
    cp /var/www/html/centos/7/isolinux/isolinux.cfg  /var/lib/tftpboot/pxelinux.cfg/default
此环节准备的文件均在/var/lib/tftpboot下,以便通过tftp获取文件。


[root@centos7 tftpboot]# tree /var/lib/tftpboot
.
|-- centos6
|  |-- initrd.img
|  `-- vmlinuz
|-- centos7
|  |-- initrd.img
|  `-- vmlinuz
|-- menu.c32
|-- pxelinux.0
|-- pxelinux.cfg
|  `-- default
`-- rhel5
    |-- initrd.img
    `-- vmlinuz
 
4 directories, 9 files

6.编辑自动化安装页面菜单
即编辑/var/lib/tftpboot/pxelinux.cfg/default文件。其基本信息如下:
[root@centos7 ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
default menu.c32
timeout 600
 
menu title CentOS Linux 7
label centos7
  menu label ^Auto Install CentOS Linux 7
  kernel centos7/vmlinuz
  append initrd=centos7/initrd.img ks=http://httpsrv/ksdir/ks7.cfg
label centos6
  menu label Auto install CentOS Linux ^6
  kernel centos6/vmlinuz
  append initrd=centos6/initrd.img  ks=http://httpsrv/ksdir/ks6.cfg
label manualcentos6
  menu label ^Manual install CentOS Linux 6
  kernel centos6/vmlinuz
  append initrd=centos6/initrd.img  inst.repo=http://httpsrv/centos/6/
label local
  menu default
  menu label Boot from ^local drive
  localboot 0xffff
menu end

这样制作过程便OK了。期间可能出现小的错误导致服务不能正常重启。还要就事论事,一项项排除。主要步骤就是这些了。

安装测试

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/13421.html