免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2310 | 回复: 0
打印 上一主题 下一主题

无人值守网络安装linux系统(centos5.4) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-01-10 10:41 |只看该作者 |倒序浏览

无人值守网络安装linux系统(centos5.4)
1、  安装介绍
1.1、        安装中用到的技术
1)  启动服务器的配置dhcp和tftp
2)  安装服务器的配置nfs或ftp或http
3)  待安装pc网卡带有pxe支持
1.2、        安装原理
下图是网络安装环境的一个原理示意图。整个安装环境由一个局域网,和连接到该局域网的三台机器组成:启动服务器(Boot Server),安装服务器(Installation Server),和待安装机器(Client)。其中启动服务器和安装服务器可以部署在同一台物理机上。表1列出了对这些机器的软硬件要求,和其上负载的服务与数据。
1.3、        安装步骤
1)  配置启动服务器
2)  配置安装服务器
3)  从网络启动并安装系统
2、  配置启动和安装服务器
本实例中启动和安装服务器为同一台服务器,操作系统为centos5.4 x86_32,
ip:192.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://192.168.5.200/install  #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
http://www.cosc.canterbury.ac.nz/adrian.white/docs/pxe/index.html

                 PXE Documentation Version 1.0
              2
http://www.ibm.com/developerworks/cn/linux/l-autoinstl/
基于网络的 Red Hat 无人值守安装



本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/21335/showart_2144776.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP