在共享位置创建系统信息库。创建系统信息库文件系统时,请将 atime 设置为 off。请参见创建和使用本地 IPS 软件包系统信息库的最佳做法。
$ zfs create -o atime=off rpool/export/IPSpkgrepos $ zfs create rpool/export/IPSpkgrepos/Solaris $ zfs get atime rpool/export/IPSpkgrepos/Solaris NAME PROPERTY VALUE SOURCE rpool/export/IPSpkgrepos/Solaris atime off inherited from rpool/export/IPSpkgrepos
可以从下载系统安装映像的位置下载 Oracle Solaris IPS 软件包系统信息库 .zip 文件,或者在介质包中找到系统信息库 DVD。连同 .zip 文件一起下载 install-repo.ksh 脚本和 .txt 文件(README 及校验和文件)。
$ ls install-repo.ksh sol-11_2-ga-repo-3of4.zip README-zipped-repo.txt sol-11_2-ga-repo-4of4.zip sol-11_2-ga-repo-1of4.zip sol-11_2-ga-repo.txt sol-11_2-ga-repo-2of4.zip
$ chmod +x install-repo.ksh
系统信息库安装脚本 install-repo.ksh 将每个系统信息库 .zip 文件解压缩到指定目录。该脚本有选择地执行以下额外任务:
验证下载的 .zip 文件的校验和。如果验证校验和时未指定 -c 选项,请在运行系统信息库安装脚本之前手动验证校验和。运行以下 digest 命令,并将输出与 .md5 文件中的相应校验和进行比较:
$ digest -a md5 file
如果指定目标已经包含系统信息库,则将系统信息库内容添加到现有内容。
验证最终系统信息库。如果验证系统信息库时未指定 -v 选项,请在运行系统信息库安装脚本之后,使用 pkgrepo 命令的 info、list 和 verify 子命令验证系统信息库。
创建 ISO 映像文件以供挂载和分发。如果使用 -I 选项创建 .iso 文件,则 .iso 文件和说明如何使用 .iso 文件的 README 文件位于指定的目标目录中。
如果未在上一步骤中指定 -v 选项,则使用 pkgrepo 命令的 info、list 和 verify 子命令检查是否已正确复制系统信息库。如果 pkgrepo verify 命令报告了错误,请尝试使用 pkgrepo fix 命令修复这些错误。有关更多信息,请参见 pkgrepo(1) 手册页。
$ zfs snapshot rpool/export/IPSpkgrepos/Solaris@sol-11_2_0
在本示例中,解压缩 zip 文件之前,不存在系统信息库。脚本可以采用以下选项:
可选。指定 .zip 文件所在目录的完整路径。缺省值:当前目录。
必填。指定希望系统信息库所在的目录的完整路径。
可选。指定用于填充此系统信息库的文件。源目录可以包含多个 .zip 文件集。缺省值:源目录中可用的最新映像。
可选。将 .zip 文件的校验和与指定文件中的校验和进行比较。如果指定不带参数的 -c,则使用的缺省文件为源目录中的 -i 映像的 .md5 文件。
可选。验证最终系统信息库。
可选。在源目录中创建系统信息库的 ISO 映像。还请在源目录中保留 mkiso.log 日志文件。
可选。显示用法消息。
$ ./install-repo.ksh -d /export/IPSpkgrepos/Solaris -c -v -I Comparing checksums of downloaded files...done. Checksums match. Uncompressing sol-11_2-ga-repo-1of4.zip...done. Uncompressing sol-11_2-ga-repo-2of4.zip...done. Uncompressing sol-11_2-ga-repo-3of4.zip...done. Uncompressing sol-11_2-ga-repo-4of4.zip...done. Repository can be found in /export/IPSpkgrepos/Solaris. Initiating repository verification. Building ISO image...done. ISO image and instructions for using the ISO image are at: /tank/downloads/sol-11_2-ga-repo.iso /tank/downloads/README-repo-iso.txt $ ls /export/IPSpkgrepos/Solaris COPYRIGHT NOTICES pkg5.repository publisher README-iso.txt
系统信息库重建和验证可能需要一些时间才能完成,但是在看到 "Repository can be found in"(在以下位置中可以找到系统信息库)消息后,即表明可以检索系统信息库内容。
示例 2-2 从 zip 文件添加现有系统信息库在本示例中,将系统信息库 zip 文件的内容添加到现有软件包系统信息库中的内容。
$ pkgrepo -s /export/IPSpkgrepos/Solaris info PUBLISHER PACKAGES STATUS UPDATED solaris 4764 online 2014-03-18T05:30:57.221021Z $ ./install-repo.ksh -d /export/IPSpkgrepos/Solaris -c -v -I IPS repository exists at destination /export/IPSpkgrepos/Solaris Current version: 0.175.2.0.0.35.0 Do you want to add to this repository? (y/n) y Comparing checksums of downloaded files...done. Checksums match. Uncompressing sol-11_2-ga-repo-1of4.zip...done. Uncompressing sol-11_2-ga-repo-2of4.zip...done. Uncompressing sol-11_2-ga-repo-3of4.zip...done. Uncompressing sol-11_2-ga-repo-4of4.zip...done. Repository can be found in /export/IPSpkgrepos/Solaris. Initiating repository rebuild. Initiating repository verification. Building ISO image...done. ISO image and instructions for using the ISO image are at: /tank/downloads/sol-11_2-ga-repo.iso /tank/downloads/README-repo-iso.txt $ pkgrepo -s /export/IPSpkgrepos/Solaris info PUBLISHER PACKAGES STATUS UPDATED solaris 4768 online 2014-06-02T18:11:55.640930Z