Chinaunix首页 | 论坛 | 博客
  • 博客访问: 253024
  • 博文数量: 188
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: -30
  • 用 户 组: 普通用户
  • 注册时间: 2017-03-29 11:17
文章分类
文章存档

2013年(8)

2012年(5)

2011年(13)

2010年(26)

2009年(63)

2008年(20)

2007年(32)

2006年(21)

分类: LINUX

2011-08-22 10:27:19

 

一、            搭建好Yum源:

二、            安装必要的服务,DHCPD,TFTP-SERVER,NFS(一般默认就有了)

dhcpdtftp-server都有对应的rpm,直接安装就可以了.

# vi /etc/xinetd.d/tftp
service tftp
{
        disable = no (
默认是yes,这里改成no,启用它)
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -u nobody -s /tftpboot //-s
表示用/tftpboot作为tftp目录的根目录
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
注:tftp是由xinted来启动的,修改完后要记得service xinetd restart

-------------------------------------------------------------------------------------------------

# vi /etc/dhcpd.conf
ddns-update-style interim;

ignore client-updates;

allow booting;

allow bootp;

next-server 192.168.0.111;   //服务器IP

filename "pxelinux.0";    //PXE得到IP以后的引导文件

subnet 192.168.0.0 netmask 255.255.255.0 {

 

# --- default gateway

        option routers                  192.168.0.254;

        option subnet-mask              255.255.255.0;

 

#       option nis-domain               "domain.org";

#       option domain-name              "domain.org";

        option domain-name-servers      192.168.0.50;

 

        option time-offset              -18000; # Eastern Standard Time

#       option ntp-servers              192.168.1.1;

#       option netbios-name-servers     192.168.1.1;

# --- Selects point-to-point node (default is hybrid). Don't change this unless

# -- you understand Netbios very well

#       option netbios-node-type 2;

 

        range 192.168.0.112 192.168.0.115;  //IP地址池范围。

        default-lease-time 21600;

        max-lease-time 43200;

        # we want the nameserver to appear at a fixed address

        host ns {

                hardware ethernet  14:FE:B5:DA:84:E7;

                fixed-address 192.168.0.112;

        }

        host ns1 {

                hardware ethernet  18:03:73:EC:E9:14;

                fixed-address 192.168.0.115;

        }


-----------------------------------------------

三、            复制PXE启动时需要的文件资料:


1
、复制必要的文件:
----------------------------------------------
[root@rhce ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
[root@rhce ~]# mkdir /tftpboot/pxelinux.cfg
[root@rhce ~]# cp /cdrom/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
[root@rhce ~]# cp /cdrom/images/pxeboot/initrd.img   /tftpboot/
[root@rhce ~]# cp /cdrom/images/pxeboot/vmlinuz   /tftpboot/

[root@rhce ~]# cp /cdrom/isolinux/ *.msg    /tftpboot/
----------------------------------------------
2
、修改/tftpboot/pxelinux.cfg/default文件
----------------------------------------------
[root@rhce ~]# chmod u+w /tftpboot/pxelinux.cfg/default //
文件默认只读
[root@rhce ~]# vi  /tftpboot/pxelinux.cfg/default

# vi default

default linux

prompt 1

timeout 60  //超时时间,默认600(即6秒),可以不改。

display boot.msg

F1 boot.msg

F2 options.msg

F3 general.msg

F4 param.msg

F5 resue.msg

label squid

  kernel vmlinuz

  append ks=nfs:192.168.0.111:/data/install/ks1.cfg ksdevice=eth0 initrd=initrd.img

label linux

  kernel vmlinuz

  append ks=nfs:192.168.0.111:/data/install/ks.cfg ksdevice=eth0 initrd=initrd.img 

 

 

这里的ks=nfs:192.168.1.11 1:/data/install/ks 文件是指定kickstart配置文件,可以在安装中不用人工干预,自动按预设的参数安装.实现安装过程的全自动.

 

四、            复制PXE启动时需要的文件资料:

 

# vi /etc/exports
/data/install     192.168.1.0/24(ro,sync) //
这里是/data/install  而不是/data/install /

# mkdir /data/install

拷贝安装LINUXISO文件到这个目录

注意:这里上传的是解压后的文件,不是ISO

 

五、            需要开启的系统服务

/etc/init.d/xinet.d start

service dhcpd  start

service portmap start

service nfs start

六、            最后附上ks文件的内容.

vi  /data/install/ks.cfg

----------------------------------------------------

install

text

nfs --server=192.168.0.111 --dir=/data/install

key –skip                              //跳过输入序列号环节

reboot                                 //安装完成自动重启

lang en_US.UTF-8

keyboard us

network --device eth0 --bootproto=dhcp

rootpw root123

firewall --disabled --port=22:tcp

authconfig --enableshadow --enablemd5

selinux --disabled

timezone --utc Asia/Shanghai

bootloader --location=mbr --driveorder=sda --append="rhgb quiet"

# The following is the partition information you requested

# Note that any partitions you deleted are not expressed

# here so unless you clear all partitions first, this is

# not guaranteed to work

clearpart --all --initlabel

part / --fstype ext3 --size=10240

part /var --fstype ext3 --size=25600

part /usr --fstype ext3 --size=30720

part swap --size=8192

part /tmp --fstype ext3 --size=5120

part /data --fstype ext3 --size=100 --grow

part /cache --fstype ext3 --size=51200 --grow

 

%packages

@base

@core

@admin-tools

@development-libs

@development-tools

@dialup

@editors

@text-internet

@chinese-support

keyutils

trousers

fipscheck

device-mapper-multipath

imake

audit


------------------------------------------------------

七、            测试工作站:



跳过DHCP,通过TFTP 开始启动计算机

阅读(823) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~