PXE+DHCP+Apache+KickStart无人值守安装RHEL5.8

相关概念html

1. 什么是PXEnode

   严格来讲,PXE 并非一种安装方式,而是一种引导方式。进行 PXE 安装的必要条件是在要安装的计算机中必须包含一个 PXE 支持的网卡(NIC),即网卡中必需要有 PXE Client。PXE (Pre-boot Execution Environment)协议可使计算机经过网络启动。此协议分为 Client端和 Server 端,而PXE Client则在网卡的 ROM 中。当计算机引导时,BIOS 把 PXE Client 调入内存中执行,而后由 PXE Client 将放置在远端的文件经过网络下载到本地运行。运行 PXE 协议须要设置 DHCP 服务器和 TFTP 服务器。DHCP 服务器会给 PXE Client(将要安装系统的主机)分配一个 IP 地址,因为是给 PXE Client 分配 IP 地址,因此在配置 DHCP 服务器时须要增长相应的 PXE 设置。此外,在 PXE Client 的 ROM 中,已经存在了 TFTP Client,那么它就能够经过 TFTP 协议到 TFTP Server 上下载所需的文件了。linux

2. 什么是Kickstartweb

   Kickstart是一种无人值守的安装方式。它的工做原理是在安装过程当中记录典型的须要人工干预填写的各类参数,并生成一个名为 ks.cfg的文件。若是在安装过程当中(不仅局限于生成Kickstart安装文件的机器)出现要填写参数的状况,安装程序首先会去查找 Kickstart生成的文件,若是找到合适的参数,就采用所找到的参数;若是没有找到合适的参数,便须要安装者手工干预了。因此,若是Kickstart文件涵盖了安装过程当中可能出现的全部须要填写的参数,那么安装者彻底能够只告诉安装程序从何处取ks.cfg文件,而后就去忙本身的事情。等安装完毕,安装程序会根据ks.cfg中的设置重启系统,并结束安装。apache

3. PXE + Kickstart的安装先决条件bash

DHCP 服务器。
TFTP 服务器。
Kickstart所生成的ks.cfg配置文件。
一台存放系统安装文件的服务器,如 NFS、HTTP 或 FTP 服务器。
一个带有 PXE 支持网卡的主机。

实现步骤
服务器

#############################挂载光盘################################
yum install -y httpd    安装apache
mount /dev/cdro /mnt/cdrom    挂载安装光盘
cp -rf /mnt/cdrom/* /mnt/cdrom    复制光盘内容到web目录
#############################安装tftp################################
yum install -y tftp-server    安装tftp-server
cat /etc/xinetd.d/tftp    修改配置文件内容为
service tftp
{
  socket_type    = dgram
  protocol    = udp
  wait      = yes
  user      = root
  server      = /usr/sbin/in.tftpd
  server_args    = -s /tftpboot
  disable      = no
  per_source    = 11
  cps      = 100 2
  flags      = IPv4
}
service xinetd restart    重启xinetd进程
########################配置支持PXE的启动程序#######################
mkdir -p /tftpboot
cp /usr/lib/syslinux/pxelinux.0 /tftpboot
cp /var/www/html/p_w_picpaths/pxeboot/vmlinuz /tftpboot
cp /var/www/html/p_w_picpaths/pxeboot/initrd.img /tftpboot/
cp /var/www/html/isolinux/*.msg /tftpboot/
mkdir /tftpboot/pxelinux.cfg -pv
cp /var/www/html/isolinux/isolinux.cfg  /tftpboot/pxelinux.cfg/default
########################安装配置dhcp服务#############################
yum –y install dhcp
cat /etc/dhcpd.conf    主配置文件
ddns-update-style interim;
ignore client-updates;
next-server 192.168.1.110;
filename "/pxelinux.0";
subnet 192.168.1.0 netmask 255.255.255.0 {
        option routers                  192.168.1.10;
        option subnet-mask              255.255.255.0;
        option nis-domain               "domain.org";
        option domain-name              "domain.org";
        option domain-name-servers      192.168.1.10;
        option time-offset              -18000; # Eastern Standard Time
        range dynamic-bootp 192.168.1.100 192.168.1.200;
        default-lease-time 21600;
        max-lease-time 43200;
}
service dhcpd start
########################安装Kickstart并配置##########################
yum –y install system-config-kickstart
system-config-Kickstart    配置
最后将生成的文件ks.cfg保存到/var/www/html下
###############修改/tftpboot/pxelinux.cfg/default文件################
修改前两行内容为
default text ks=http://192.168.11.29/ks.cfg
timeout 2
#################修改/var/www/html/ks.cfg文件内容####################
#platform=x86, AMD64, or Intel EM64T
#System authorization information
auth    --useshadow    --enablemd5
# System bootloader configuration
key --skip
bootloader --location=mbr
# Partition clearing information
clearpart --none
# Use graphical install
graphical
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
#System keyboard
keyboard us
#System language
lang en_US
# Installation logging level
logging --level=info
# Use network installation
url --url=http://192.168.1.110/
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
reboot
#Root password
rootpw --iscrypted $1$aseasd$W0TpOJ8tqCoFgcbKk4wie0
# SELinux configuration
selinux --disabled
# System timezone
timezone --isUtc Asia/Shanghai
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig    --defaultdesktop=GNOME --depth=8 --resolution=640x480
# Disk partitioning information
bootloader --location=mbr --driveorder=sda
clearpart --all --initlabel
part / --bytes-per-inode=4096 --fstype="ext3" --size=5120
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=128
part swap --bytes-per-inode=4096 --fstype="swap" --size=500
part /data --bytes-per-inode=4096 --fstype="ext3" --grow --size=1
%packages
@base
@development-libs
@development-tools
#######################添加开机启动而且启动各服务####################
service httpd start
chkconfig httpd on
service dhcpd start
chkconfig dhcpd on
service xinetd restart

启动客户端测试
网络

   至此代表各服务正常工做dom

   至此代表ks.cfg文件生效socket

相关文章
相关标签/搜索