设置 Jumpstart 服务器
这篇文章的设置细节如图所示:
快速启动设置
设置操作系统镜像目录
我将使用 Solaris 10 iso 镜像来设置操作系统镜像目录。
首先挂载 Solaris 10 镜像,然后将 Solaris 10 OS 镜像复制到 /export/install 目录中。
jumpstart # mkdir /export/install jumpstart # mount -F hsfs -o ro `lofiadm -a /path/to/image.iso` /mnt jumpstart # cd /mnt/Solaris_10/Tools/ jumpstart # ./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 netboot hierarchy... Install Server setup complete
创建配置目录
我们需要在 Jumpstart 服务器上创建配置目录。
此目录包含用于自动安装的配置文件和配置文件。
我们会将示例文件从 Solaris 10 DVD 复制到 /export/config 目录中。
jumpstart # mkdir /export/config jumpstart # cp -r /mnt/Solaris_10/Misc/jumpstart_sample/* /export/config/ jumpstart # ls -lrt /export/config jumpstart # ls -lrt /export/config/ total 152 -r--r--r-- 1 root root 182 Jan 13 10:45 any_machine -r-xr-xr-x 1 root root 64357 Jan 13 10:45 check -r--r--r-- 1 root root 243 Jan 13 10:45 host_class -r--r--r-- 1 root root 227 Jan 13 10:45 net924_sun4c -r--r--r-- 1 root root 4884 Jan 13 10:45 rules -r--r--r-- 1 root root 24 Jan 13 10:45 upgrade -r--r--r-- 1 root root 685 Jan 13 10:45 x86-begin dr-xr-xr-x 2 root root 512 Jan 13 10:45 x86-begin.conf -r--r--r-- 1 root root 267 Jan 13 10:45 x86-class -r--r--r-- 1 root root 896 Jan 13 10:45 zfsrootsimple
为客户创建配置文件
配置文件包含有关要在客户端安装哪个软件集群的信息。
它还明确提供磁盘分区参数。
我们还可以在配置文件中指定 SVM 镜像根磁盘。
我将在这个例子中使用一个简单的磁盘分区。
操作系统将安装 c0t0d0s0 分片,并为根分片提供 1 GB 交换和剩余空间。
jumpstart # cd /export/config jumpstart # vi profile install_type initial_install system_type standalone partitioning explicit cluster SUNWCXall filesys c0t0d0s0 free / filesys c0t0d0s1 1024 swap
我们还可以明确指定要添加或者删除的包。
创建 sysidcfg
sysidcfg 文件用于配置客户端并包含 IP 地址、主机名、时区等信息。
自动安装所需的最少信息是:
Host Name IP address system locale time zone netmask IPv6 terminal type security policy name service timeserver
一个常见的 sysidcfg 文件如下所示:
jumpstart # vi sysidcfg system_locale=C timezone=US/Eastern timeserver=192.168.1.30 network_interface=primary {ip_address=192.168.1.20 protocol_ipv6=no netmask=255.255.255.0 default_route=NONE} terminal=xterm root_password='9RVWhgjsPHWhkY' name_service=NONE security_policy=NONE
编辑规则文件
规则文件用于创建 rules.ok 文件
它包含一个或者多个规则,用于根据客户端的系统属性定义如何安装客户端。
jumpstart # cat /export/config/rules # rules keyword & values begin script profile finish script #---------------------------------------------------------------------- any - - profile
检查规则文件
运行config目录下的check脚本,检查rules文件的语法。
jumpstart # cd /export/config jumpstart # ./check Validating rules... Validating profile any_machine... The custom Jumpstart configuration is ok.
检查 rules.ok 文件中是否有任何不需要的行
jumpstart # cat rules.ok any - - profile
NFS 共享 jupstart 目录
确保将配置和安装目录添加到 dfstab 以便 NFS 共享它们。
jumpstart # cat /etc/dfs/dfstab share -F nfs -o ro,anon=0 /export/install share -F nfs -o ro,anon=0 /export/config
使用 shareall 共享 /etc/dfs/dfstab 中提到的条目
jumpstart # shareall
安装客户端
最后,我们可以开始安装客户端系统了。
为此,从 OK 提示符运行命令:
ok> boot net -v - install
快速启动的工作原理
当我们在 OK 提示符下运行“boot net -v install”命令时,客户端开始寻找 Jumpstart 服务器。
Jumpstart 服务器使用 rarpd 守护进程 (in.rarpd) 响应 RARP(反向地址解析协议)请求。
Jumpstarts 服务器使用 /etc/ethers 和 /etc/hosts 文件来查找客户端的 IP 地址并将主机名、IP 地址传达给客户端。获得这些信息后,jumpstart 客户端使用 tftp 协议从 JumpStart 服务器(从 /tftpboot 目录)下载最小内核(miniroot),并将其加载到内存中。
一旦客户端从 miniroot 启动,就会检查 rules.ok 文件以确认客户端匹配其中的规则之一。
一旦找到匹配项,就会执行启动脚本。
然后安装相应的配置文件,最后执行完成脚本。
快速启动文件
重要的 Jumpstart 文件及其用途:
profile - 定义软件集群、磁盘分区
rules 和 rules.ok - 定义规则以匹配客户端的特定配置文件。
Start and Finish scripts - 安装客户端前后运行的脚本
sysidcfg - 客户端配置信息,如主机名、IP 地址等。
关于客户端/etc/bootparams - Jumpstart 客户端用来引导的文件。
当我们运行 add_install_client 脚本时,此文件会使用客户端信息进行更新。/etc/ethers - 包含 Jumpstart 客户端的 MAC 地址映射。
设置 Jumpstart 客户端
完成 Jumpstart 服务器设置后,我们需要在文件 /etc/ethers、/etc/hosts 等中添加客户端的详细信息。
在 Jumpstart 服务器中添加客户端 MAC 地址和主机名
jumpstart # vi /etc/hosts 192.168.1.20 onitroad
jumpstart # vi /etc/ethers 0:c:29:f6:ef:7b onitroad
添加 Jumpstart 客户端
现在我们可以使用 add_install_client 脚本开始设置 Jumpstart 客户端。
jumpstart # cd /export/install jumpstart # ./add_install_client -e 8:0:20:ab:cd:ef -i 192.168.1.20 -s jumpstart:/export/install -c jumpstart:/export/config -p jumpstart:/export/config onitroad sun4u
各种参数及其含义:
-e --> add the client system's MAC address to /etc/etheres file -i --> adds the clients info in /etc/hosts file -s --> the NFS path to OS image (/export/install on jumpstart server) -c --> the path to configuration files (/export/config on jumpstart server) -p --> the path to the profile file (/export/config on jumpstart server) onitroad --> name of the jumpstart client sun4u --> architecture type of the client system
Jumpstart 通过自动安装 Solaris 操作系统使系统管理员的生活变得轻松。
使用 jumpstart,我们可以使用非捆绑软件进行无人值守的 solaris 安装。