Chinaunix首页 | 论坛 | 博客
  • 博客访问: 327609
  • 博文数量: 81
  • 博客积分: 2107
  • 博客等级: 大尉
  • 技术积分: 742
  • 用 户 组: 普通用户
  • 注册时间: 2008-10-30 09:38
文章分类

全部博文(81)

文章存档

2011年(2)

2010年(28)

2009年(45)

2008年(6)

我的朋友

分类: LINUX

2009-12-30 11:16:01

一、制作安装光盘镜像文件

可以在windows平台上用光盘镜像制作工具完成ISO镜像的制作,各个ISO文件须按光盘的前后次序顺序命名:比如 as4.0_1.ISO, as4.0_2.ISO, as4.0_3.ISO, as4.0_4.ISO,然后用SSH工具上传到服务器系统中,以实现镜像安装时自动顺序加载。

LinuxAs4.0的四个镜像文件存放在的目录为:/os/linux/as4.0_i386

二、NFS导出镜像存储目录

1. vi /etc/exports                     #打开文件exports,此文件不存在,则新建

2. exports中添加如下内容(以#开头的文字为说明文字,可不添加到exports文件中):

/os/linux  *(ro, sync, all_squash)     #导出共享目录/os/linux

                                    #访问方式:ro, 只读;sync, 与硬盘同步;

                                # all_squash, 所有网络访问用户,更改为nobody

#的权限

    3. 保存exports 文件,退出vi.

    4. exportfs –a                    #导出网络共享目录

  

三、配置DHCP服务

1.            vi  /etc/dhcpd.conf

     #新建文件,此文件也可把/usr/share/doc/dhcp-3.0.1/dchpd.conf.sample 拷贝到/etc目录下,然后更名为dhcpd.conf

2.            更改dchpd.conf 文件如下:

        option space PXE;

option PXE.mtftp-ip code 1 = ip-address;

option PXE.mtftp-cport code 2 = unsigned integer 16;

option PXE.mtftp-sport code 3 = unsigned integer 16;

option PXE.mtftp-tmout code 4 = unsigned integer 8;

option PXE.mtftp-delay code 5 = unsigned integer 8;

option PXE.discovery-control code 6 = unsigned integer 8;

option PXE.discovery-mcast-addr code 7 = ip-address;

class "pxeclients" {

match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";

option vendor-class-identifier "PXEClient";

vendor-option-space PXE;

# At least one of the vendor-specific PXE options must be set in

# order for the client boot ROMs to realize that we are a PXE-compliant

# server. We set the MCAST IP address to 0.0.0.0 to tell the boot ROM

# that we can't provide multicast TFTP (address 0.0.0.0 means no

# address).

option PXE.mtftp-ip 0.0.0.0;

# This is the name of the file the boot ROMs should download.

filename "linux-install/pxelinux.0";

# This is the name of the server they should get it from.

next-server 192.168.1.2;            

}

ddns-update-style interim;

ignore client-updates;

subnet 192.168.1.0 netmask 255.255.255.0 {

# --- default gateway

    option routers          192.168.1.1;

    option subnet-mask      255.255.255.0;

    option nis-domain       "chaoyi.org";

    option domain-name      "chaoyi.org";

    option domain-name-servers  192.168.1.1;

    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 dynamic-bootp 192.168.1.100 192.168.1.254;

    default-lease-time 21600;

    max-lease-time 9943200;

    # we want the nameserver to appear at a fixed address

#如果需为某块网卡绑定IP,取消下面的注释标记#,并作相应修改

#   host ns {

#       next-server marvin.redhat.com;

#       hardware ethernet 12:34:56:78:AB:CD;

#       fixed-address 207.175.42.254;

#   }

}

   3.   保存dchpd.conf,退出vi

四、配置tftp服务

1.       vi /etc/xinetd.d/tftp;

2.       修改tftp为如下:

       service tftp

{

        disable = no

        socket_type             = dgram

        protocol                = udp

        wait                    = yes

        user                    = root

        server                  = /usr/sbin/in.tftpd

        server_args             = -u nobody -s /tftpboot

        per_source              = 11

        cps                     = 100 2

        flags                   = IPv4

}

   3.  保存tftp, 退出vi

五、配置PXE

1.       mkdir –p /tftpboot/linux-install

2.       cp /usr/lib/syslinux/pxelinux.0 /tftpboot/linux-install/  

3.       cd /tftpboot/linux-install/

4.       mkdir msgs

5.       将第一张安装光盘上isolinux目录下的所有扩展名为msg的文件复制到msgs目录下;

6.       cd msgs

7.       vi boot.msg

8.       修改boot.msg文件如下:

    Enter number of the Operation System you wish to install:

0          Local OS restart

1          Redhat AS 4.0 i386

[F1-Main] [F2-General] [F3-Expert] [F4-Kernel] [F5-Rescue] [F7-Snake]

9.       保存boot.msg, 退出 vi

10.    cd ..   

11.    mkdir linux

12.    cd linux

13.    mkdir as4.0_i386

14.    将第一张安装光盘上image/pxeboot目录下的四个文件(initrd.imgvmlinuzTRANS.TBLREADME)复制到新建的as4.0_i386目录下(也可只复制initrd.img vmlinuz两个文件)

六、配置PXE系统选择配置文件default

1.       cd /tftpboot/linux-install

2.       mkdir pxelinux.cfg

3.       cd pxelinux.cfg

4.       vi default

#以下为default文件内容:

default local

timeout 10000

prompt 1

display msgs/boot.msg

F1 msgs/boot.msg

F2 msgs/general.msg

F3 msgs/expert.msg

F4 msgs/param.msg

F5 msgs/rescue.msg

F7 msgs/snake.msg

label local

  localboot 1

 

label 0

  localboot 1

label 1

          kernel linux/as4.0_i386/vmlinuz

  append initrd=linux/as4.0_i386/initrd.imgks=nfs:192.168.1.2:/os/linux/kickstart/ as4.0_i386/ks.cfg ramdisk_size=10000 #append 和ramdisk_size=10000是同一行的

                                             # 内容,不分行。

5.       保存default, 退出vi

七、配置kickstart文件

1.       cd /os/linux/

2.       mkdir –p kickstart/as4.0_i386

3.       vi ks.cfg

   #以下是ks.cfg文件内容

nfs --server=192.168.1.2 --dir=/os/linux/ As4.0_i386

4.       保存ks.cfg,退出vi

 

八、启动有关服务

1.       service nfs restart

2.       service dhcpd restart

3.       chkconfig dhcpd on

4.       /sbin/chkconfig --level 345 xinetd on

5.       /sbin/chkconfig --level 345 tftp on
#
该命令配置 tftp xinetd 服务被立即启用,还把配置它们在运行级别345的引导期#间启动

九、PXE网络安装测试

将要从网络安装linux 的计算机在CMOS 中设为从LAN PXE 启动,就可以进行网络安装了。(测试用电脑为acer TravelMate 230, 在启动时按F12, 5.Realtek Boot Agent

首先计算机获取IP地址,然后会进入如下操作系统选择界面:

Enter number of the Operation System you wish to install:

0          Local OS restart

1          Redhat AS 4.0 i386

[F1-Main] [F2-General] [F3-Expert] [F4-Kernel] [F5-Rescue] [F7-Snake]

 

在提示符后可以输入通过光盘安装时相同的命令:只是需用编号来代替linux, 比如:1; 1 dd ;1 text 。

 

 

以上面的方法为模板,还可以制作多个linux版本的选择安装网络服务器。只需做如下工作(以增加redhat As4.2为例):

1.       mkdir /os/linux/As4.2_i386

2.       复制各镜像文件到As4.2_i386目录下

3.       在boot.msg中添加行:2 Redhat AS 4.2 i386

4.       mkdir /tftpboot/linux-install/linux/as4.2_i386

5.       将第一张安装光盘上image/pxeboot目录下的四个文件(initrd.imgvmlinuzTRANS.TBLREADME)复制到新建的as4.2_i386目录下

6.       default文件中添加如下内容:

 label 2

 kernel linux/as4.2_i386/vmlinuz

  append initrd=linux/as4.2_i386/initrd.imgks=nfs:192.168.1.2:/os/linux/kickstart/ as4.2_i386/ks.cfg ramdisk_size=10000

7.       mkdir p /os/linux/kickstart/as4.2_i386

8.       cd /os/linux/kickstart/as4.2_i386/

9.       vi ks.cfg

#ks.cfg内容为:

nfs --server=192.168.1.2 --dir=/os/linux/ As4.2_i386

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