Chinaunix首页 | 论坛 | 博客
  • 博客访问: 593125
  • 博文数量: 51
  • 博客积分: 4000
  • 博客等级: 上校
  • 技术积分: 1737
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-27 13:45
文章分类

全部博文(51)

文章存档

2011年(3)

2009年(19)

2008年(29)

我的朋友

分类: LINUX

2009-12-22 14:29:58

原理和概念:


1.1 什么是PXE
 

严格来说,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。PXE Client 通过 TFTP 协议到 TFTP Server 上下载所需的文件。


1.2 什么是KickStart


KickStart是一种无人职守安装方式。KickStart的工作原理是通过记录典型的安装过程中所需人工干预填写的各种参数,并生成一个名为ks.cfg的文件;在其后的安装过程中(不只局限于生成KickStart安装文件的机器)当出现要求填写参数的情况时,安装程序会首先去查找KickStart生成的文件,当找到合适的参数时,就采用找到的参数,当没有找到合适的参数时,才需要安装者手工干预。

 

1.3 PXE + KickStart安装的条件


执行 PXE + KickStart安装需要的设备为:
• DHCP 服务器;
• TFTP 服务器;
• KickStart所生成的ks.cfg配置文件
• 一台存放系统安装文件的服务器,如 NFS、HTTP 或 FTP 服务器。
• 带有一个 PXE 支持网卡的将安装的主机;


安装的步骤:


一、 安装NFS   提供安装镜像文件及Kickstart配置文件
[root@iscsi ~]# yum install nfs*.*  -y

[root@iscsi ~]# chkconfig nfs on

[root@iscsi ~]# vi /etc/exports

/ks  *(ro,sync)

/mnt/cdrom  *(ro,sync)

[root@iscsi ~]# service portmap restart

[root@iscsi ~]# service nfs restart

二、 挂载RHEL5的DVD光盘到/mnt/cdrom  以便NFS共享

1、mount /dev/cdrom   /mnt/cdrom

三、 安装 tftp-server,并启用tftp服务,重启xinetd进程
1、 [root@iscsi ~]# yum install tftp*.*
2、vi /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
#    protocol.   The tftp protocol is often used to boot diskless \
#    workstations, download configuration files to network-aware printers, \
#    and to start the installation process for some operating systems.
service tftp
{
       socket_type              =   dgram
       protocol                   udp
       wait                     =   yes
       user                     =   root
       server                   =   /usr/sbin/in.tftpd

server_args              =   -s /tftpboot     #TFTP 共享路径
       disable                 =    no              #disable的直由yes变为no
       per_source              =    11
       cps                      =    100  2
       flags                    =    IPv4
}
3、service xinetd restart


四、 将支持PXE启动的相关文件复制到相关目录。
1、[root@iscsi ~]# cd /tftpboot/

2、 [root@iscsi tftpboot]# cp /usr/lib/syslinux/pxelinux.0  /tftpboot/
3、将安装光盘上/image/pxeboot/initrd.img和vmlinux复制到/tftpboot/中
[root@iscsi /]# cp /mnt/cdrom/images/pxeboot/vmlinuz /tftpboot/

[root@iscsi /]# cp /mnt/cdrom/images/pxeboot/initrd.img  /tftpboot/
4、将安装光盘上isolinux/*.msg拷贝到/tftpboot目录下
[root@iscsi /]# cp /mnt/cdrom/isolinux/*.msg  /tftpboot/
5、 在tftpboot中新建一个pxelinux.cfg目录
[root@iscsi tftpboot]# mkdir pxelinux.cfg
6、把安装光盘上isolinux目录中的isolinux.cfg复制到pxelinux.cfg目录中,并同时更改文件名称为default

[root@iscsi ~]# cp /mnt/cdrom/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default

 修改/tftpboot/pxelinux.cfg/default文件,指定读取ks.cfg的方法

(ks=nfs:192.168.1.100:/pxeks/ks.cfg)

default linux

prompt 1

timeout 600

display boot.msg

F1 boot.msg

F2 options.msg

F3 general.msg

F4 param.msg

F5 rescue.msg

label linux

  kernel vmlinuz

append ks=nfs:192.168.1.100:/pxeks/ks.cfg initrd=initrd.img devfs=nomount ramdisk_size=16384

label text

  kernel vmlinuz

  append initrd=initrd.img text

label ks

  kernel vmlinuz

  append ks initrd=initrd.img

label local

  localboot 1

label memtest86

  kernel memtest

  append -

六、 安装dhcp服务,同时修改配置
1、 [root@iscsi ~]# yum install dhcp*.* -y

2、 [root@iscsi ~]# chkconfig dhcpd on
3、 复制配置模板文件到/etc/dhcpd.conf
cp /usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample /etc/dhcpd.conf
4、 修改配置文件/etc/dhcpd.conf ,

[root@iscsi ~]# vim /etc/dhcpd.conf      
ddns-update-style interim;
ignore client-updates;
next-server 192.168.0.253;            #PXE服务器IP地址
filename "/pxelinux.0"               PXE启动文件。

subnet 192.168.0.0 netmask 255.255.255.0 {

# --- default gateway
       option routers                  192.168.0.253;
       option subnet-mask              255.255.255.0;

       option nis-domain               "example.com";
       option domain-name              "example.com";
       option domain-name-servers       192.168.0.253;
      
       option time-offset              -18000; # Eastern Standard Time
   option ntp-servers              192.168.0.253;
   option netbios-name-servers     192.168.0.253;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
   option netbios-node-type 2;

       range dynamic-bootp 192.168.0.100 192.168.0.200;
       default-lease-time 21600;
       max-lease-time 43200;

       # we want the nameserver to appear at a fixed address
       #host ns {
          next-server server1.example.com;
           hardware ethernet 12:34:56:78:AB:CD;
           fixed-address 192.168.0.110;
       #}
}

4、 启动dhcp服务

[root@iscsi ~]# service dhcpd restart
七、配置 kicksttart文件

1、 yum install system-config-kickstart –y    #安装Kickstart配置工具

2、 在gnome环境下配置kickstart
system-config-kickstart
3、 软件包的选择,我选择了Kernel Developent和Development Tools安装(但千万不要选择这两个软件包,不然的话在安装的时候会报错的,以下是我先选择安装,等一会我们来查看产生的问题,你就明白了)

11、 生成文件ks.cfg,保存到/ks 下面
八、修改/tftpboot/pxelinux.cfg/default文件,指定读取ks.cfg的方法(ks=)
vi /tftpboot/pxelinux.cfg/default
auth --useshadow --enablemd5
key --skip #这行一定要,跳过注册号输入,不然实验失败
bootloader --location=mbr
clearpart –all –initlabel
text
firewall --disabled
firstboot --disable
keyboard us
lang en_US
logging --level=info

nfs --server=192.168.0.253 --dir=/mnt/cdrom
network --bootproto=dhcp --device=eth0 --onboot=on
reboot
rootpw --iscrypted $1$HEJKfwF9$r1l0JoPz74ToF9NbE3Qs1
selinux --disabled
timezone --isUtc Asia/Shanghai
intall
xconfig --defaultdesktop=GNOME -depth=8 --resolution=640x480
part swap --bytes-per-inode=4096 --fstype="swap" --size=512
part /boot --bytes-per-inode=4096 --fstype-"ext3" --size=200
part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=1
%packages
@cluster-storage
@mysql
@development-libs
@editors
@text-internet
@x-software-development
@virtualization
@legacy-network-server
@dns-server
@gnome-desktop
@dialup
@core
@base
@ftp-server
@network-server
@clustering
@java-development
@base-x
@chinese-support
@web-server
@smb-server
@printing
@admin-tools
@development-tools
@graphical-internet
kmod-gnbd-xen
kmod-gfs-xen
perl-Convert-ASN1
perl-Crypt-SSLeay
mesa-libGLU-devel
tftp-server
kexec-tools
bridge-utils
device-mapper-multipath
ypserv
openldap-servers
vnc-server
dhcp
xorg-x11-server-Xnest
xort-x11-server-Xvfb
imake
gcc-objc
expect

阅读(2950) | 评论(0) | 转发(0) |
0

上一篇:ltp安装配置

下一篇:Linux 下配置FTP服务器

给主人留下些什么吧!~~