【1】原理和系统引导过程
BIOS =>引导介质=>用于安装环境的linux内核(vmlinuz)和驱动模块(initrd.img)=>安装程序(anaonda)=>寻找安装介质=>安装配置=> 重启 => 进入系统
【2】 需要用到的服务
DHCP: 连接服务器
TFTP: 获得内核和启动文件
FTP: 获得安装镜
【3】 安装kickstart
yum install system-config-kickstart
system-config-kickstart 启动kickstart 配置 生成 ks.cfg 文件
#platform=x86, AMD64, 或 Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
key --skip
# System keyboard
keyboard us
# System language
lang zh_CN
# Installation logging level
logging --level=info
# Use network installation
url --url=ftp://10.10.68.1/iso
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# Reboot after installation
reboot
#Root password
rootpw uplooking
# SELinux configuration
selinux --disabled
# System timezone
timezone Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig --defaultdesktop=GNOME --depth=32 --resolution=1024x768
# Disk partitioning information
part / --bytes-per-inode=4096 --fstype="ext3" --grow --maxsize=100 --size=1
part swap --bytes-per-inode=4096 --fstype="swap" --grow --maxsize=1024 --size=1
part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=1
%post
%packages
@base
@gnome-desktop
@development-libs
@base-x
@admin-tools
@development-tools
@chinese-support
@server-cfg
@dns-server
@system-tools
@editors
@text-internet
@network-server
@graphical-internet
@ftp-server
【4】 配置TFTP服务 (简单文件传输协议)
rpm -q tftp-server
chkconfig tftp on
service xinetd restart
【5】 安装配置DHCP服务
DHCP服务的配置文件
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
ddns-update-style interim;
ignore client-updates;
subnet 10.10.68.0 netmask 255.255.255.0 {
option routers 10.10.68.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 10.10.68.1;
next-server 10.10.68.1;
filename="/pxelinux.0";
range dynamic-bootp 10.10.68.100 10.10.68.200;
default-lease-time 21600;
max-lease-time 43200;
}
【6】 打开ftp服务
将ks.cfg 文件 copy到 /var/ftp 目录
将光盘镜像挂载至 /var/ftp/iso 目录
【6】 配置pxe服务模块
cp linux-install/pxelinux.0 /tftpboot/
mkdir /tftpboot/pxelinux.cfg
cp /mnt/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
cp /mnt/isolinux/vmlinuz /tftpboot/
cp /mnt/isolinux/initrd.img /tftpboot/
cp /mnt/isolinux/boot.msg /tftpboot/
【7】 编辑 default 文件
default linux
prompt 1
timeout 30
display boot.msg
label linux
kernel vmlinuz
append ksdevice=eth0 nodmraid initrd=initrd.img ks=ftp://10.10.68.1/ks.cfg
【8】 配置完成 当网络中有新机器加入时,采用网卡引导 即可完成自动安装系统