Chinaunix首页 | 论坛 | 博客
  • 博客访问: 171949
  • 博文数量: 29
  • 博客积分: 2110
  • 博客等级: 大尉
  • 技术积分: 325
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-01 11:32
文章分类

全部博文(29)

文章存档

2012年(3)

2010年(4)

2009年(5)

2007年(16)

2006年(1)

我的朋友

分类: LINUX

2010-01-10 10:41:08

无人值守网络安装linux系统(centos5.4)

1、  安装介绍

1.1、        安装中用到的技术

1)  启动服务器的配置dhcptftp

2)  安装服务器的配置nfsftphttp

3)  待安装pc网卡带有pxe支持

1.2、        安装原理

下图是网络安装环境的一个原理示意图。整个安装环境由一个局域网,和连接到该局域网的三台机器组成:启动服务器(Boot Server),安装服务器(Installation Server),和待安装机器(Client)。其中启动服务器和安装服务器可以部署在同一台物理机上。表1列出了对这些机器的软硬件要求,和其上负载的服务与数据。

1.3、        安装步骤

1)  配置启动服务器

2)  配置安装服务器

3)  从网络启动并安装系统

2、  配置启动和安装服务器

本实例中启动和安装服务器为同一台服务器,操作系统为centos5.4 x86_32

ip192.168.5.200 

2.1启动服务器的配置

  2.1.1 dhcp服务器的安装与配置

        a)安装dhcp服务器

               从光盘或网络下载dhcp server安装包 dhcp-3.0.5-18.el5.i386.rpm

               rpm – ivh dhcp-3.0.5-18.el5.i386.rpm  #安装dhcp server

        b)配置dhcp 服务器

               dhcp server配置文件默认为 /etc/dhcpd.conf 编辑内容如下:

               option domain-name "aklus";

ddns-update-style none;

default-lease-time 600;

max-lease-time 7200;

server-name "bootserver";

subnet 192.168.5.0 netmask 255.255.255.0 {

                  range   192.168.5.2 192.168.5.100;

                  allow unknown-clients;

                   allow booting;

                 allow bootp;

                 option routers 192.168.5.1;

                  option subnet-mask 255.255.255.0;

                  option domain-name-servers 8.8.8.8;

                  filename "pxelinux.0";  

                  next-server 192.168.5.200;

}

              上述配置文件中 定义了子网为 192.168.5.0/24 ip分配范围: 192.168.5.2-100,

pxelinux.0(tftp根目录/tftpboot/) 将作为启动映像被网卡ROM里的PXE客户端载入内存并运行。Next-server 192.168.5.200 指定了tftp server的地址。

c)启动dhcp服务器

    [root@localhost ~]# service dhcpd restart

              2.1.2 tftp服务器的安装与配置

                     a)安装tftp服务器

                  从光盘或网络下载tftp server安装包 tftp-server-0.42-3.1.el5.centos.i386.rpm

                  rpm – ivh dhcp-3.0.5-18.el5.i386.rpm  #安装tftp server

                  安装后,tftp默认根目录为/tftpboot

               b)配置tftp server

                 编辑/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             = -u nobody -s /tftpboot

                disable                 = no  #红色字体为修改部分

                 per_source              = 11

                 cps                     = 100 2

                 flags                   = IPv4

}

c)启动tftp server

       [root@localhost ~]# service xinetd restart   

              2.1.3 制作启动文件

                     a)从安装光盘中复制linux的内核/根文件系统文件

                            [root@localhost ~]#cp /mnt/isolinux/initrd.img  /tftpboot/

                            [root@localhost ~]#cp /mnt/isolinux/vmlinuz  /tftpboot/

                            [root@localhost ~]#cp /mnt/isolinux/boot.msg /tftpboot/

                     b)安装syslinux后(centos5.4默认已安装),复制pxelinux.0 /tftpboot/

                            [root@localhost ~]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot

c)编辑pxelinux.0的配置文件,用来pxelinux可以正确载入Red Hat Linux安装程序。

[root@localhost ~]#mkdir /tftpboot/pxelinux.cfg

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

                     编辑 default文件内容如下:

                     default linux

prompt 1

timeout 600

#display boot.msg

label linux

kernel vmlinuz

                           append ks=nfs:192.168.5.200:/linuxos/kickstart/ks.cfg  initrd=initrd.img

label text

                           kernel vmlinuz

                           append initrd=initrd.img text

3、  配置安装服务器

3.1.1准备系统安装文件

        [root@localhost~]mkdir -p /linuxos/install

        [root@localhost~]mount /dev/cdrom /linuxos/install #挂载linux安装介质

3.1.2 制作kickstart文件

     制作kickstart文件有两种方法,1、利用系统自带kickstart工具制作。2、编辑系统安装时自动生成的anaconda-ks.cfg文件,我们这里使用的是后者

      [root@localhost~]mkdir /linuxos/kickstart

      [root@localhost~]cp /root/anaconda-ks.cfg /linuxos/kickstart/ks.cfg

编辑ks.cfg文件内容如下

 

# Kickstart file automatically generated by anaconda.

install

nfs --server=192.168.5.200 --dir=/linuxos/install

#url --url=  #http方式安装

#url --url=ftp://install:install@192.168.5.200/linuxos #ftp方式安装

lang en_US.UTF-8

keyboard us

xconfig --startxonboot

network --device eth0 --bootproto dhcp

rootpw --iscrypted $1$NpzzKWWp$DwUkDbNqWjyQhR/SHOc2w1

firewall --enabled --port=22:tcp

authconfig --enableshadow --enablemd5

selinux --enforcing

timezone --utc Asia/Shanghai

bootloader --location=mbr --driveorder=hda --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 --linux

part /boot --fstype ext3 --size=100

part / --fstype ext3 --size=3000

part swap --size=1024

 

%packages

@office

@editors

@text-internet

@gnome-desktop

@dialup

@core

@base

@games

@base-x

@graphics

@printing

@sound-and-video

@graphical-internet

device-mapper-multipath

xorg-x11-server-Xnest

libsane-hpaio

 

3.1.3 配置nfs服务器

      a)编辑nfs配置文件 /etc/exports 内容如下:

/linuxos/install * (ro)

/linuxos/kickstart * (ro)

4、  开始无人值守安装

4.1重启启动服务器和安装服务器的下列服务,确保配置生效

[root@localhost etc]#service nfs restart

[root@localhost etc]#service dhcpd restart

[root@localhost etc]#service xinetd restart

4.2 设置待安装pc启动方式 为网络启动

4.3 重启待安装pc,开始无人值守安装,安装步骤如下图

1、设置从网络启动

2、自动获取ip

3、读取pxelinux.0配置信息,此处Enter键后自动选择默认安装 详见default文件配置

5、  已进入自动安装图形界面

 

注①          启动服务器和安装服务器建议先关掉防火墙,以免后期安装时会获取不到ip tftp中的数据

 

 

 

注②          在安装RHAS4 for ppc 这里filename 后的 pxelinux.0改为netboot.img(netboot.img 文件在安装介质images/pseries/netboot.img)RHAS5 for ppc 时这里filename后的 pxelinux.0改为ppc64.img (ppc64.img文件在安装介质 images/netboot/ppc64.img)

 

注③          next-server 指定了tftp服务器的地址

 

 

参考资料:

1

                 PXE Documentation Version 1.0

              2http://www.ibm.com/developerworks/cn/linux/l-autoinstl/

基于网络的 Red Hat 无人值守安装

 

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

chinaunix网友2010-03-04 00:09:41

写的真是详细。收藏参考了。