Solaris10-x86-DVD

来自开放百科 - 灰狐
跳转到: 导航, 搜索

自己动手制作Solaris 10 x86自动安装DVD

前言

在安装Solaris的过程中,最让人感到头疼的就是那些无法回避的人机交互步骤。比如选择安装类型、提供系统identification信息、划分磁盘分区等等。这些操作对安装者来说,既费时又费力,而且没什么乐趣。为了解决这个问题,使Solaris的安装变得更加轻松,笔者在总结无数次试验失败教训的基础上,摸索出了一套在 x86/x64机器上用一张DVD光盘实现Solaris 10自动安装的方法。现在把它整理出来,和大家一起分享。

原理

Solaris 10自动安装光盘的实现,主要基于Flash Archive和JumpStart技术:使用Flash Archive工具生成一个现有Solaris 10操作系统的归档(映像)文件,将其存放到安装光盘上;再对安装光盘中JumpStart安装程序的行为进行定制,使其读取我们在配置文件中设置的系统 identifications信息(这样JumpStart就不会再向安装者索取信息),最后由JumpStart将操作系统的归档文件释放到目标系统上,从而完成Solaris 10的自动安装。

步骤

以下操作均在Solaris 10 1/06 x86中以root用户进行

一. 生成当前Solaris 10操作系统的归档文件

# mkdir /s10
# touch /s10/xfile

在xfile文件中加入如下内容:

/s10/ /etc/X11/xorg.conf /etc/X11/.xorg.conf /tmp/

# flar create -S -n s10_u1_x86 -c -I -X /s10/xfile /s10/s10.archive

说明:用flar creat命令生成当前系统的归档文件。"-c"参数表示对生成的归档文件进行压缩。"-X /s10/xfile"表示xfile文件中所包含的目录和文件需要被排除掉。

二. 创建用来生成自动安装DVD映像文件的工作区

1. 创建工作区目录

# mkdir /dvd

2. 在光驱中放入Solaris 10 1/06 x86安装光盘(DVD安装盘或CD安装盘的第一张),将光盘内容复制到工作区目录

# cd /cdrom/cdrom0
# find . -depth -print | cpio -vpdm /dvd

3. 将Solaris的归档文件复制到工作区的Solaris_10/Product子目录,删除无关内容

# rm -rf /dvd/Solaris_10/Product/*
# cp /s10/s10.archive /dvd/Solaris_10/Product

三. 创建JumpStart使用的配置文件和脚本文件

JumpStart使用的安装规则文件rules.ok、安装配置文件profile、以及安装完成执行的脚本文件均存放在.install_config目录下

1. 删除/dvd/.install_config/目录下原有文件

# rm -rf /dvd/.install_config/*

2. 创建rules.ok文件

# echo "any - - flash.profile finish.sh" > /dvd/.install_config/rules.ok

3. 创建flash.profile文件

# touch /dvd/.install_config/flash.profile

flash.profile配置文件应包含的内容:安装类型的选择(flash),归档文件存放位置,以及为文件系统分配空间大小。

在flash.profile中加入如下内容:

install_type flash_install archive_location local_file /cdrom/Solaris_10/Product/s10.archive

partitioning explicit filesys c0d0s0 free / filesys c0d0s1 1024 swap filesys c0d0s7 2048 /export/home

4. 创建安装完成时执行的脚本文件

安装完成后需要自动弹出光盘托盘,提示将光盘取出,以免重启后再次安装

# touch /dvd/.install_config/finish.sh

加入如下内容

#!/bin/sh
#
BOOT_DEV=`/usr/sbin/install.d/find_device -c`
eject -f /dev/rdsk/${BOOT_DEV} >/dev/null 2>&1
/usr/bin/echo "Please remove the DVD from the tray , "
/usr/bin/echo "otherwise the installation will resume after reboot"
/usr/bin/echo "Type return to reboot \c"
read z

reboot

四. 修改x86.miniroot

1. /dvd/boot/x86.miniroot,是个gzip压缩文件,解压后将块文件关联到一个lofi设备

# gzcat /dvd/boot/x86.miniroot > /tmp/miniroot
# lofiadm -a /tmp/miniroot
# mount /dev/lofi/1 /mnt

2. 修改miniroot中/usr/sbin/install.d/profind文件

JumpStart 使用${SI_CONFIG_DIR}环境变量,来设置安装配置文件存放的目录。该环境变量的缺省值是/tmp/install_config,可以通过将目录/tmp/install_config链接到/cdrom/sol_10_106_x86/.install_config,使 JumpStart使用.install_config中的配置文件进行安装。

编辑/mnt/usr/sbin/install.d/profind脚本文件,在该文件的cdrom()函数的末尾加入

gettext " <<< using DVD install_config >>>"; echo # flash install

rmdir ${SI_CONFIG_DIR} # flash install # deltel the old one

ln -s /cdrom/.install_config ${SI_CONFIG_DIR}

3. 在miniroot 的/etc/sysidcfg文件,提供缺省的系统identification信息

# rm /mnt/etc/sysidcfg
# vi /mnt/etc/sysidcfg

加入以下内容:

system_locale=zh_CN.GBK
timezone=PRC
network_interface=primary {hostname=sunhost
ip_address=10.1.1.1
netmask=255.255.25
default_route=none
protocol_ipv6=no}
terminal=vt100
security_policy=NONE
root_password=VrVxGtl6ilp3Y
name_service=NONE

root用户的口令是root,VrVxGtl6ilp3Y是加密后的值

4. 修改miniroot的/sbin/install-discovery文件,使安装程序直接以JumpStart方式安装

在/mnt/sbin/install-discovery文件中找到set -- `/sbin/getbootargs 2>/dev/null`一行,在它下面添加如下一行代码

set -- install

5. 修改完成后,替换原来的/dvd/boot/x86.miniroot

# umount /mnt
# lofiadm -d /dev/lofi/1
# gzip /tmp/miniroot
# cp /tmp/miniroot.gz /dvd/boot/x86.miniroot

五. 修改grub菜单timeout值

编辑/dvd/boot/grub/menu.lst 将缺省的timeout值60改小一些,或者改为0

六. 制作DVD image

# /usr/bin/mkisofs -D -R -U -l -J \
-b boot/grub/stage2_eltorito \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
-c .catalog \
-V "sol_10_106_x86" \
-o /s10_flash_install.iso \
/dvd

七. 刻录DVD

将空白DVD光盘放入刻录机中,

# cdrw -l

找到刻录机对应的设备名,比如cdrom0,使用如下命令进行刻录:

# cdrw -d cdrom0 -i /s10_flash_install.iso

结束语

将Flash Archive和JumpStart技术在一张DVD上进行结合,不但实现了Solaris 10在x86/x64机器上的自动安装,而且我们还可以这种方法来对Solaris 10进行备份和恢复。事实证明,使用这种方式安装Solaris,可比标准方式安装节约一半的时间。

来源: http://isv.sun.com.cn/message/common/msgview.jsp?msgid=10389

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱