基于PXE的Centos无人值守安装(Win平台)

一、环境准备

       PXE服务器端

       1、工具

       tftpd32 (下载)用于提供DHCP和ftp服务

       hfs   (下载)     用于提供安装软件的http方式下载

       Kickstart              用于生成无人值守文件(需要linux系统运行,使用yum -y install system-config-kickstart 安装)

       2、配置文档

       lpxelinux.0(或pxelinux.0)、ldlinux.c32 : 从 syslinux 获得 (下载)注:下载是一个压缩包,在压缩包里搜索即可

       initrd.img、vmlinuz: 从 centos.iso文件 isolinux目录中获得

       ks.cfg    使用  kickstart 工具生成,后面详细说明

       建立pxelinux.cfg 目录,在目录下建立 default文件,后面详细说明

       3、目录结构

       pxe

          |----   pxelinux.cfg   

                           |---  default

          |----   Ipxelinux.0(或 pxelinux.0)

          |----   initrd.img

          |----   vmlinuz

          |----   ks.cfg

          |----   centos(从centos解压出来的所有文件)

         4、pxelinux.cfg  目录下的  default 文件

该文件用于启动后的配置文件,可以在文件中实现选择菜单,并指定ks的获取路径,下面举例说明

default linux
prompt 1
timeout 6 //超时时间,默认600,可以不改。
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
kernel vmlinuz
append initrd=initrd.img ks=http://10.0.0.100:8080/pxe/ks.cfg ksdevice=eth1     #ks.cfg配置文件所在目录,需要和hfs的地址一致

     5、无人值守安装配置

#platform=x86, AMD64, 或 Intel EM64T
#skip input subscribe number
key --skip
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="http://10.0.0.100:8080/pxe/centos"       #centos安装文件所在目录,需要和hfs的地址一致
# Root password
rootpw --iscrypted $1$bIZz5.0G$okfXTZMuvK32r3gSIY6Rv/
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use graphical install
graphical
firstboot --disable
# System keyboard
keyboard us
# System language
lang zh_CN.UTF-8
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# Partition clearing information
clearpart --all --initlabel 
# Reboot after installation
reboot
# Network information
network --onboot no --device eth0 --bootproto dhcp --noipv6
# Disk partitioning information
part /boot --asprimary --bytes-per-inode=4096 --fstype="ext4" --size=200
part / --asprimary --bytes-per-inode=4096 --fstype="ext4" --grow --size=1
part swap --asprimary --bytes-per-inode=4096 --fstype="swap" --size=512

# System timezone
timezone  Asia/Shanghai
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all  

%packages
@base
@chinese-support
@core
@debugging
@fonts
%end

二、软件配置

1、tftpd32

该软件需要配置ftp和dhcp服务

首先需要在本机的网卡上配置IP地址和子网掩码,例如 IP:10.0.0.100 ,子网掩码:255.255.255.0

基于PXE的Centos无人值守安装(Win平台)_第1张图片

点击Settings,设置TFTP,选择pxe文件所在的目录

基于PXE的Centos无人值守安装(Win平台)_第2张图片

设置dhcp地址,IP池开始地址,ip的数量,启动文件名称(boot file),默认网关等



2、HFS

在menu菜单中,ip地址选择为本机地址。在根目录处右键Add folder from disk 选择你的pxe根目录

基于PXE的Centos无人值守安装(Win平台)_第3张图片


三、启动安装

首先需要在需要安装的机器上,设置好网卡启动,在bios中确定是否支持网卡启动。启动后系统会自动获取到ip地址,然后到ftp服务器上获取必要的安装文件,进入安装后,系统会自动根据default文件和ks的配置,到hfs上获取文件


参考文档

http://baidu.blog.51cto.com/71938/158669/

http://www.cnblogs.com/mchina/p/centos-pxe-kickstart-auto-install-os.html

CentOS kickstart 标准指南: http://fedoraproject.org/wiki/Anaconda/Kickstart


你可能感兴趣的:(基于PXE的Centos无人值守安装(Win平台))