Chinaunix首页 | 论坛 | 博客
  • 博客访问: 385056
  • 博文数量: 136
  • 博客积分: 4010
  • 博客等级: 上校
  • 技术积分: 1410
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-14 14:11
文章分类

全部博文(136)

文章存档

2008年(16)

2007年(27)

2006年(93)

我的朋友

分类: LINUX

2007-12-04 10:55:43

网络无人职守安装linux

Writen BY HPLJ-2007.12.4

 

 

1 配置启动安装服务器

 

1install and configure dhcp service

/etc/dhcpd.conf

such as

 

 

option domain-name "mydomain";

ddns-update-style none;

 

max-lease-time 7200;

server-name "bootserver";

default-lease-time 600;

 

allow booting;

allow bootp;

 

subnet 192.168.138.0 netmask 255.255.255.0 {

    range 192.168.138.1 192.168.138.254;

   

}

 

group pxe {

    filename "/pxelinux.0";

    host client1 { hardware ethernet 00:0C:29:70:24:5B;             

                       fixed-address    192.168.138.30;

                    }

}

 

 

#文件 pxelinux.0(在 TFTP 服务器的根目录中)将作为启动映像被网卡ROM里的PXE客户端载入内存并运行。

 

每增加一台需安装的机器,我们需在dhcpd.conf中增加一条host条目,将客户机的MAC地址输入进去,同时分配一个IP地址,如果

不输入MAC地址,客户机将无法通过DHCP取的IP地址。

 

 

2)install and configure tftp service

 

/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

}

 

#disable = yes 改成disable = no

重启xinetd服务,以使tftp服务生效;

 

#service xinetd restart

 

2 将启动镜像文件pxelinux.0复制到TFTP服务器根目录,这是客户端机器刚开始启动的时候,pxe协议的引导文件。

启动镜像pxelinux.0可以在syslinux安装包里获得。安装好syslinux安装包后,将pxelinux.0复制到TFTP服务器根目录。

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

 

3   Linux安装程序的内核/根文件系统文件复制到 TFTP 服务器的根目录。对于每一个要被安装的Red Hat Linux版本,都需要执行一次该操作。

Red Hat Linux第一张安装光盘/isolinux目录下会包含Linux安装程序的内核/根文件系统文件。下面一段命令将这些文件复制到TFTP服务器的根目录下,并按照版本重新命名。initrd.imgvmlinuz,这两个文件是用来引导机器的内核和ramdisk文件,这两个文件可以改成别的文件名,需要在第五步中提高的/tftpboot/pxelinux.cfg/default文件中指定文件名即可;

[root@bsvr]#mkdir /mnt/iso

[root@bsvr]#mount -o loop,ro RHEL4-U2-i386-AS-disc1.iso  /mnt/iso

[root@bsvr]#cp /mnt/iso/isolinux/initrd.img /tftpboot

[root@bsvr]#cp /mnt/iso/isolinux/vmlinuz /tftpboot

 

4  nfs install

  cp linux iso file to nfs-path

#cp disk1.iso /tftpboot/iso/rhel4u3/

#cp disk2.iso /tftpboot/iso/rhel4u3/

#cp disk3.iso /tftpboot/iso/rhel4u3/

#cp disk4.iso /tftpboot/iso/rhel4u3/

 

vi /etc/exports

/tftp/iso/thel4u3/  *(r0,no_root-squash)

 

#service nfs restart

 

service nfs reload

#检查共享时候已经正确输出

#showmount –e

 

5 编辑启动菜单,或安装多个版本的linux

客户端通过pxe协议引导起来之后,会在服务器的/tftpboot/pxelinux.cfg/目录(该目录需要手工建立)下寻找启动配置文件,启动配置文件中定义了应该引导哪个版本的Linux,文件名默认为default,可以将第一张安装光盘中 /isolinux/isolinux.cfg文件复制到/tftpboot/pxelinux.cfg/,并改名为default,格式写法请参考里面已有的格式。

 

default  rhel4u3            默认启动项

display pxelinux.cfg/list       显示的启动菜单,供用户选择

prompt 1

timeout 30

display boot.msg

F1 boot.msg

F2 options.msg

F3 general.msg

F4 param.msg

F5 rescue.msg

F7 snake.msg

label  rhel4r3           具体的启动项目名称,一个label对应一个linux版本

  kernel vmlinuzrhel4r3   #这个文件对应的是/tftpboot目录下的相应版本的linux vmlinuz

  append ks=nfs:172.16.201.25:/tftpboot/iso/rhel4r3/ks-rhel4r3.cfg initrd=initrdrhel4r3.img ramdisk_size=8192            #initrd的文件对应的是/tftpboot/目录下相应的Linux版本的“initrd.img”文件,

label  rhel5r1           具体的启动项目名称,一个label对应一个linux版本

  kernel vmlinuzrhel5r1   #这个文件对应的是/tftpboot目录下的相应版本的linux vmlinuz

  append ks=nfs:172.16.201.25:/tftpboot/iso/rhel5r1/ks-rhel5r1.cfg initrd=initrdrhel5r1.img ramdisk_size=8192            #initrd的文件对应的是/tftpboot/目录下相应的Linux版本的“initrd.img”文件,

#/tftpboot目录下应该存在以下5个文件(这五个文件名中不能有大写的,否则客户端在启动的时候会报找不到相应的文件):pxelinux.0 vmlinuzrhel4r3initrdrhel4r3.img

vmlinuzrhel5r1initrdrhel5r1.img

 

/tftpboot/pxelinux.cfg目录下手工建立list文件,如下:

choose one name of the following linux distribution for your installation

Name     Distribution      Install location

rhel4r3    rhel4           172.16.201.25:/tftpboot/iso/rhel4r3/

rhel5r1    rhel5           172.16.201.25:/tftpboot/iso/rhel5r1/

 

这里的name 的名字要和default文件中的label相对应,大小写应一致。

 

 

6 制作ks.cfg文件,在服务器上有个图形界面的程序可以制作,如果没有可以在第二张光盘中找到这个包:system-config-kickstart-2.5.16.1-1.noarch.rpm,安装一下即可;

 

可以定义语言选项,网卡IP,分区信息,安装的软件包,安装选项选择NFS,输入nfs服务器的IP,路径,最后保存文件,复制到/tftpboot/iso/rhel4r3目录下,其他相应版本的linuxks.cfg文件也要复制到相应的目录下,然后在default文件中指定该文件即可。

 

7 将客户机从网卡启动,安装linux

 

 

 

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