BigAdmin System Administration Portal
对适用于 x86/x64 平台的 Solaris 10 操作系统使用 Solaris JumpStart
Print-friendly VersionPrint-friendly Version

对适用于 x86/x64 平台的 Solaris 10 操作系统使用 Solaris JumpStart

Craig Winter 和 Dale Layfield,2007 年 3 月


摘要

Sun Microsystems 的 Solaris JumpStart 技术用于在网络的多个节点上自动安装 Solaris 操作系统和其他关联的软件。

在适用于 x86/x64 平台的 Solaris 10 操作系统上使用 Solaris JumpStart 软件与在适用于 SPARC 平台的 Solaris 10 操作系统上使用该软件基本上相同。但是,需要说明一些细微的差异,以确保正确操作。

本文档提供为 Sun x86/x64 计算机上的 Solaris 10 操作系统设置 JumpStart 服务器以及为两个或更多客户机配置 JumpStart 的必要步骤和说明。

作为一般参考,请参阅 Sun 联机文档使用自定义 JumpStart


简介

本文介绍使用适用于 x86/x64 平台的 Solaris 10 操作系统创建 JumpStart 服务器的分步过程。此版本的 Solaris 10 操作系统可用于在服务器上运行的操作系统以及 JumpStart 安装服务器上的操作系统。基于 AMD Opteron 和 Intel 处理器的计算机都曾用作服务器和客户机,但未给出针对每个计算机使用哪种处理器类型的相关首选项。

为以下内容提供了说明:

必须在客户机上启用预引导执行环境 (Pre-boot Execution Environment, PXE),以便使客户机从网络中进行引导。在某些客户机上,需要在 BIOS 中启用 PXE。

创建客户机引导文件时出现的错误将在最后清理部分加以说明。


Solaris JumpStart 过程

这些说明用于设置 JumpStart 安装服务器,该服务器将在两个客户机上安装适用于 x86/x64 平台的 Solaris 10 操作系统。

在此练习中,JumpStart 服务器的节点名为 stinger2,其 IP 地址为 172.16.64.194。缺省路由器的 IP 地址为 172.16.64.1。JumpStart 服务器所在的网络地址为 172.16.64.0

如果需要,您可以下载 Solaris 10 操作系统

1. 创建 JumpStart 安装服务器

a. 在服务器上创建安装目录:

# mkdir -p /export/install

b. 在服务器上的 DVD 播放器中放入适用于 x86/x64 平台的 Solaris 10 操作系统 DVD。转到 DVD 上的 Solaris_10/Tools 目录并运行 setup_install_server 命令以创建安装服务器。Solaris 软件将被复制到新创建的目录中。将绝对路径名指定为参数。

# cd /cdrom/cdrom0/Solaris_10/Tools
  # ./setup_install_server /export/install
  Verifying target directory...
  Calculating the required disk space for the Solaris_10 product
  \|/-\|/-
  Calculating space required for the installation boot image
  \|/-\|/-
  Copying the CD image to disk...
  \|/-\|/-
  Copying Install Boot Image hierarchy...
  \|/-\|/-
  Copying /boot x86 netboot hierarchy...
  \|/-\|/-
  Install Server setup complete
  #

c. 验证 install 目录已被填充。

  # du -sk /export/install

  3083278 /export/install

d. 从 DVD 播放器中取出 DVD。

  # cd /;eject

创建客户机配置文件

客户机配置文件用于控制自定义 JumpStart 安装。

a. 在这些文件所在的位置创建配置目录:

  # mkdir /export/config

b. 创建 sysidcfg 文件:

要创建的第一个文件为 sysidcfg 文件。必须以正确信息适当地设置此文件的格式,否则将忽略此文件,并异常中止无人干预的 JumpStart 安装。安装随后将缺省转为标准的 Solaris 交互式安装。

在操作系统安装开始之前,JumpStart 客户机将查找名为 sysidcfg 的文件。必须将此文件命名为 "sysidcfg",以便拥有该文件的多个版本,每个 sysidcfg 文件必须位于单独的目录中。每个客户机可有其自身的 sysidcfg 文件,多个客户机也可以使用同一个 sysidcfg 文件。sysidcfg 文件通过 add_install_client 命令分配给客户机。下面说明了两个 sysidcfg 文件的创建过程:

  # cd /export/config
  # mkdir sysidcfg1
  # cd sysidcfg1
  # vi sysidcfg

  system_locale=en_US.ISO8859-1
  timezone=US/Pacific
  timeserver=localhost
  terminal=vt100
  name_service=NONE
  security_policy=NONE
  root_password=<encrypted from /etc/shadow>
  network_interface=bge0 {hostname=client1
                          netmask=255.255.255.0
                          protocol_ipv6=no
                          default_route=172.16.64.1}

  :wq

  # cd ../
  # mkdir sysidcfg2
  # cd sysidcfg2
  # vi sysidcfg

  system_locale=en_US.ISO8859-1
  timezone=US/Pacific
  timeserver=localhost
  terminal=vt100
  name_service=NONE
  security_policy=NONE
  root_password=<encrypted from /etc/shadow>
  network_interface=bge0 {hostname=client2
                          netmask=255.255.255.0
                          protocol_ipv6=no
                          default_route=172.16.64.1}

  :wq

c. 创建 rules 文件:

要创建的下一个文件为 rules 文件。这是一个包含规则的文本文件,该规则适用于将安装 Solaris 操作系统的每个客户机或每组客户机。rules 文件的每个行通知 JumpStart 要对每个客户机或每组客户机使用哪个 beginprofilefinish 文件。

只有一个 rules 文件。该文件可以包含多个行,具体取决于需要多少唯一配置。下面显示了包含两个不同客户机信息的 rules 文件的内容:

  # cd /export/config
  # vi rules

  hostname client1 begin1 profile1 finish1
  hostname client2 begin2 profile2 finish2

  :wq

check 脚本在创建 rules.ok 文件时要使用 rules 文件。要执行自定义 JumpStart 安装,必须成功创建 rules.ok 文件。

d. 创建 begin 文件:

begin 文件是用户定义的 Bourne shell 脚本,用于在 Solaris 操作系统安装开始之前在客户机上执行任务。典型的任务包括在升级之前创建派生配置文件以及备份文件。

如果需要,可以使用多个 begin 文件。下面说明了两个 begin 文件的创建过程:

  # cd /export/config
  # vi begin1

  #!/bin/sh
  echo "Begin Script for JumpStart client1..."

  :wq

  # vi begin2

  #!/bin/sh
  echo "Begin Script for JumpStart client2..."

  :wq

  # chmod 755 begin*

在客户机上安装期间,来自 begin 文件的输出将被写入 /tmp/begin.log 中。完成安装后,可在 /var/sadm/system/logs/begin.log 中找到日志文件。

《Solaris 10 安装指南》中包括自定义 JumpStart 环境变量部分,该部分介绍了可在 begin 脚本中使用的变量。

e. 创建 finish 文件:

finish 文件是用户定义的 Bourne shell 脚本,用于在完成 Solaris 操作系统安装后在客户机上执行任务。此脚本通常用于添加其他文件、添加软件包和修补程序、自定义根环境以及安装其他软件。

如果需要,可以使用多个 finish 文件。下面说明了两个 finish 文件的创建过程:

  # cd /export/config
  # vi finish1

  #!/bin/sh
  echo "Finish Script for JumpStart client1..."
  echo "Get rid of the nfs prompt during the initial boot"
  touch /a/etc/.NFS4inst_state.domain

  :wq

  # vi finish2

  #!/bin/sh
  echo "Finish Script for JumpStart client2..."
  echo "Get rid of the nfs prompt during the initial boot"
  touch /a/etc/.NFS4inst_state.domain

  :wq

  # chmod 755 finish*

Solaris 安装程序在 /a 上挂载客户机系统的文件系统。finish 脚本可用于添加、更改或删除与 /a 有关的文件。在进行初始系统重新引导之前,这些文件系统将始终挂载于 /a 上。

JumpStart 目录(即 /export/install)挂载于由 SI_CONFIG_DIR 变量指定的目录上。缺省情况下,该目录被设置为 /tmp/install_config。通过在 finish 脚本中运行命令,可以将文件从 JumpStart 目录复制到客户机。要添加到已安装系统的文件将被放入 JumpStart 目录中,然后客户机即可访问这些文件。

finish 脚本中的以下行可将文件复制到客户机上新安装的文件系统分层结构中:

  cp /tmp/install_config/<file_name> /a/<path_name>/

f. 创建 profile 文件:

profile 文件是一个文本文件,定义如何在客户机上安装 Solaris 操作系统。

可以创建多个 profile 文件。多个客户机可以使用同一个 profile 文件,每个客户机也可以有其自身的 profile 文件。下面说明了两个 profile 文件的创建过程:

  # cd /export/config
  # vi profile1

  # install_type MUST be first
  install_type      initial_install

  # start with the minimal required number of packages
  cluster           SUNWCXall
  cluster           SUNWCapache delete
  cluster           SUNWCpcmc   delete
  cluster           SUNWCpcmcx  delete
  cluster           SUNWCthai   delete
  cluster           SUNWClp     delete
  cluster           SUNWCnis    delete
  cluster           SUNWCppp    delete

  # format the entire disk for Solaris
  fdisk   all   solaris all

  # define how the disk is partitioned
  partitioning      explicit
  filesys           rootdisk.s0 6144  /
  filesys           rootdisk.s1 1024  swap
  filesys           rootdisk.s7 free  /state/partition1

  # install systems as standalone
  system_type standalone

  # specify patches to install
  patch 119281-06 nfs 172.16.64.194:/export/patches

  # specify packages to install
  package SPROcc add nfs 172.16.64.194:/export/packages

  :wq

  # vi profile2

  # install_type MUST be first
  install_type      initial_install

  # start with the minimal required number of packages
  cluster           SUNWCXall
  cluster           SUNWCapache delete
  cluster           SUNWCpcmc   delete
  cluster           SUNWCpcmcx  delete
  cluster           SUNWCthai   delete
  cluster           SUNWClp     delete
  cluster           SUNWCnis    delete
  cluster           SUNWCppp    delete

  # format the entire disk for Solaris
  fdisk   all   solaris all

  # define how the disk is partitioned
  partitioning      explicit
  filesys           rootdisk.s0 6144  /
  filesys           rootdisk.s1 4096  swap
  filesys           rootdisk.s7 free  /state/partition1

  # install systems as standalone
  system_type standalone

  # specify patches to install
  patch 119281-06 nfs 172.16.64.194:/export/patches

  # specify packages to install
  package SPROcc add nfs 172.16.64.194:/export/packages

  :wq

g. 创建 check 脚本:

check 脚本用于验证是否正确设置了 rulesprofile 文件。首先将 check 脚本复制到本地目录,即 /export/config,如下所示:

  # cd /export/config
  # cp /export/install/Solaris_10/Misc/jumpstart_sample/check .

h. 运行 check 脚本:

  # ./check
  Validating rules...
  Validating profile profile1...
  Validating profile profile2...
  The custom JumpStart configuration is ok.

如果未发现错误,将创建 rules.ok 文件。此文件与 rules 文件相同,但删除了注释和空行。check 脚本将以下注释添加到 rules.ok 文件的结尾部分:

  # version=2 checksum=<num>

3. 共享安装和配置目录

a. 修改 dfstab 以共享 JumpStart 目录。

b. 编辑 /etc/dfs/dfstab 文件:

  # vi /etc/dfs/dfstab

  #       Place share(1M) commands here for automatic execution
  #       on entering init state 3.
  #
  #       Issue the command 'svcadm enable network/nfs/server' to
  #       run the NFS daemon processes and the share commands, after
  #       adding the very first entry to this file.
  #
  #       share [-F fstype] [ -o options] [-d "<text>"] <pathname>
  #       [resource]
  #       for example,
  #       share  -F nfs  -o rw=engineering  -d "home dirs"  /export/home2

  share -F nfs -o ro,anon=0 /export/install
  share -F nfs -o ro,anon=0 /export/config
  share -F nfs -o ro,anon=0 /export/patches
  share -F nfs -o ro,anon=0 /export/packages

  :wq

c. 启动 NFS 服务器。

  # /etc/init.d/nfs.server start

d. 共享这些目录。

  # shareall
  # share
  -               /export/install   ro,anon=0   ""
  -               /export/config   ro,anon=0   ""
  -               /export/patches   ro,anon=0   ""
  -               /export/packages   ro,anon=0   ""

e. 验证文件共享。

  # showmount -e localhost
  export list for localhost:
  /export/install  (everyone)
  /export/config   (everyone)
  /export/patches  (everyone)
  /export/packages (everyone)

4. 创建客户机 tftpboot 文件

a. 对每个客户机运行 add_install_client 脚本。

b. 转到 add_install_client 脚本所在的位置:

  # cd /export/install/Solaris_10/Tools

c. 对网络上执行 JumpStart 安装的每个客户机运行 add_install_client 脚本。请确保对每个客户机使用正确的参数。-e 参数是客户机的 MAC 地址,-p 参数显示由客户机使用的 sysidcfg 文件的目录名称。下面说明了如何对两个不同的客户机运行 add_install_client

  # ./add_install_client \
      -d \
      -e 00:0a:e4:37:16:4d \
      -s 172.16.64.194:/export/install \
      -c 172.16.64.194:/export/config \
      -p 172.16.64.194:/export/config/sysidcfg1 i86pc

  enabling tftp in /etc/inetd.conf
  Converting /etc/inetd.conf
  enabling network/tftp/udp6 service
  copying boot file to /tftpboot/pxegrub.I86PC.Solaris_10-1

  If not already configured, enable PXE boot by creating
  a macro named 01000AE429C1FD with:
    Boot server IP (BootSrvA) : 172.16.64.194
    Boot file      (BootFile) : 01000AE429C1FD

  # ./add_install_client \
      -d \
      -e 00:0a:e4:2a:33:f8 \
      -s 172.16.64.194:/export/install \
      -c 172.16.64.194:/export/config \
      -p 172.16.64.194:/export/config/sysidcfg2 i86pc

  enabling tftp in /etc/inetd.conf
  Converting /etc/inetd.conf
  enabling network/tftp/udp6 service
  copying boot file to /tftpboot/pxegrub.I86PC.Solaris_10-1

  If not already configured, enable PXE boot by creating
  a macro named 01000AE42A33F8 with:
    Boot server IP (BootSrvA) : 172.16.64.194
    Boot file      (BootFile) : 01000AE42A33F8

以后在 dhcpmgr 运行的同时创建宏时,将使用 Boot server IPBoot file 值。

5. 配置和运行 DHCP 服务器

a. 运行 dhcpmgr

  # /usr/sadm/admin/bin/dhcpmgr
  Java Accessibility Bridge for GNOME loaded.

将出现第一个屏幕:
(单击图像以将其放大)

b. 选择“配置为 DHCP 服务器”并单击“确定”。

将出现 DHCP 配置向导:

c. 选择“文本文件”并单击“下一步”。

d. 验证存储路径并单击“下一步”。

e. 选择名称服务并单击“下一步”。

f. 验证租用信息并单击“下一步”。

g. 验证 DNS 域信息并单击“下一步”。

h. 验证网络信息并单击“下一步”。

i. 选择网络类型和路由选项,并单击“下一步”。

j. 验证 NIS 域信息并单击“下一步”。

k. 验证 NIS+ 域信息并单击“下一步”。

l. 查看设置并单击“完成”。

将出现 DHCP 管理器,并要求您启动地址向导:

m. 单击“是”。

将出现地址向导:

n. 键入 IP 地址的数目并单击“确定”。

o. 验证服务器信息并单击“下一步”。

p. 验证 IP 地址并单击“下一步”。

q. 验证客户机配置信息并单击“下一步”。

r. 选择租用类型并单击“下一步”。

s. 查看设置并单击“完成”。

dhcpmgr 仍处于运行状态时,创建 BootFileBootSrvA 宏。要访问“创建宏”表单,请首先在“DHCP 管理器”表单中选择“宏”选项卡。然后,在顶部菜单中选择“编辑”->“创建”。

将出现“创建宏”表单:

t. 在“名称”字段中键入由第一个客户机的 add_install_client 脚本生成的名称,以创建宏的 BootFile 部分。此名称还会用在“选项值”字段中。键入信息后,请单击“添加”。

u. 在“选项值”字段中键入 JumpStart 服务器的网络 IP 地址,以创建宏的 BootSrvA 部分。键入信息后,请单击“添加”。然后单击“确定”完成第一个宏的创建。

v. 重复相同的过程,以创建第二个宏。

x. 单击“添加”。

y. 单击“添加”,然后单击“确定”。

z. 生成第二个宏之后,在“DHCP 管理器”窗口中选择“文件”->“退出”以结束 dhcpmgr 实用程序。

最后清理

运行 add_install_client 脚本时,该脚本为每个客户机创建了 menu.lst<filename> 文件。

由于在创建 /tftpboot/menu.lst<BootFile: Name> 文件时出现错误,因此必须在第 4 行的 kernel/unix 后添加以下文本:

- install dhcp

因此,请将文件由:

default=0
timeout=30
title Solaris_10 Jumpstart
    kernel /I86PC.Solaris_10-1/multiboot kernel/unix -B \
install_config=172.16.64.194:/export/config, \
sysid_config=172.16.64.194:/export/config/sysidcfg1, \
install_media=172.16.64.194:/export/install, \
install_boot=172.16.64.194:/export/install/boot
    module /I86PC.Solaris_10-1/x86.miniroot

更改为:

default=0
timeout=4
title Solaris_10 Jumpstart
    kernel /I86PC.Solaris_10-1/multiboot kernel/unix - install dhcp -B \
install_config=172.16.64.194:/export/config, \
sysid_config=172.16.64.194:/export/config/sysidcfg1, \
install_media=172.16.64.194:/export/install, \
install_boot=172.16.64.194:/export/install/boot
    module /I86PC.Solaris_10-1/x86.miniroot

执行无人干预的 JumpStart 安装

    引导客户机。

    显示提示符后,在客户机的键盘上按 F12。

    Network Boot Request....
    
    CLIENT MAC ADDR: 00 0A E4 2A 33 F8  GUID: 11223344 556 7788 99AA \
                                              BBCCDDEEFF00
    
    DHCP....\|/-\|/-
    

    如果正确设置了所有内容,安装将一直运行到完成为止。如果出现问题,安装程序将退出并进入 shell。错误原因记录在 install_log 文件中。


安装后

下面是 JumpStart 安装的日志文件:

  /var/sadm/system/logs/install_log
                        begin_log
                        finish_log
                        sysidtool.log

关于作者

Craig Winter 和 Dale Layfield 是 Sun Microsystems, Inc 市场开发工程部 MDE Verticals 小组的高级工程师。


Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License.


BigAdmin
  
 
BigAdmin Upgrade Hub