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

相關文章
相關標籤/搜索