- 论坛徽章:
- 0
|
4.设置 installation server
4.1 加入第一个文件 (对应 CD1)
# /cdrom/s0/Solaris_10/Tools/setup_install_server /export/install/solaris.10
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...
Install Server setup complete
#
# umount /cdrom/s0
# umount /cdrom/s1
# /usr/sbin/lofiadm -d /u02/10_isos/sol-10-u2-ga-sparc-v1-s1.iso
# /usr/sbin/lofiadm -d /u02/10_isos/sol-10-u2-ga-sparc-v1.iso
#
4.2 加入其余文件 (对应 CD 2-5)
# cd /u02/10_isos
#
# for ISO in sol-10-u2-ga-sparc-v2.iso sol-10-u2-ga-sparc-v3.iso \
> sol-10-u2-ga-sparc-v4.iso sol-10-u2-ga-sparc-v5.iso
> do
> echo "---------------------------------------"
> echo "Adding the file $ISO ..."
> /usr/sbin/lofiadm -a /u02/10_isos/$ISO
> sleep 3
> /sbin/mount -F hsfs -o ro /dev/lofi/1 /cdrom
> sleep 3
> /cdrom/Solaris_10/Tools/add_to_install_server /export/install/solaris.10
> sleep 3
> umount /cdrom
> sleep 3
> /usr/sbin/lofiadm -d /u02/10_isos/$ISO
> sleep 3
> done
---------------------------------------
Adding the file sol-10-u2-ga-sparc-v2.iso ...
/dev/lofi/1
The following Products will be copied to /export/install/solaris.10/Solaris_10/Product:
Solaris_2
If only a subset of products is needed enter Control-C
and invoke /cdrom/Solaris_10/Tools/add_to_install_server with the -s option.
Checking required disk space...
-
Copying Top Level installer...
132688 blocks
Copying Tools Directory...
4320 blocks
Processing completed successfully.
---------------------------------------
Adding the file sol-10-u2-ga-sparc-v3.iso ...
/dev/lofi/1
The following Products will be copied to /export/install/solaris.10/Solaris_10/Product:
Solaris_3
If only a subset of products is needed enter Control-C
and invoke /cdrom/Solaris_10/Tools/add_to_install_server with the -s option.
Checking required disk space…
|
Copying Top Level installer...
132688 blocks
Copying Tools Directory...
4320 blocks
Processing completed successfully.
---------------------------------------
Adding the file sol-10-u2-ga-sparc-v4.iso ...
/dev/lofi/1
The following Products will be copied to /export/install/solaris.10/Solaris_10/Product:
Solaris_4
If only a subset of products is needed enter Control-C
and invoke /cdrom/Solaris_10/Tools/add_to_install_server with the -s option.
Checking required disk space...
\
Copying Top Level installer...
132688 blocks
Copying Tools Directory...
4320 blocks
Processing completed successfully.
---------------------------------------
Adding the file sol-10-u2-ga-sparc-v5.iso ...
/dev/lofi/1
The following Products will be copied to /export/install/solaris.10/Solaris_10/Product:
Solaris_5
If only a subset of products is needed enter Control-C
and invoke /cdrom/Solaris_10/Tools/add_to_install_server with the -s option.
Checking required disk space...
\
Copying the Early Access products...
56368 blocks
Copying Top Level installer...
132688 blocks
Copying Tools Directory...
4320 blocks
Processing completed successfully.
#
# rm -r /cdrom/s0 /cdrom/s1
#
# du -k -s /export/install/solaris.10
2513095 /export/install/solaris.10
#
4.3 修改Jumpstart server系统文件及设置NFS 服务器
# vi /etc/inet/hosts
…
192.168.1.45 jpclient jpclient.mydomain.com
(added one line)
#
# vi /etc/ethers
…
0:17:4f:0f:42:b0 jpclient
(added one line)
#
# cat /etc/dfs/dfstab | grep share | grep -v "^#"
share -F nfs -o ro,anon=0 /jumpstart
share -F nfs -o ro,root=jpclient /export/install
#
# /etc/init.d/nfs.server stop
# /etc/init.d/nfs.server start
#
4.4 创建Jumpstart server所需的文档及脚本
Jumpstart server所需的脚本及文档样板等, 一定要从加载了Solaris10 CD images 的地方复制过来。Soalris9 的不可以用在Solairs10 上。
# cp –pr /export/install/solaris.10/Solaris_10/Misc/jumpstart_sample /jumpstart
# cd /jumpstart/jumpstart_sample
# cp -pr ./[a-]* ../
#
以下是建好的脚本及几个文档。
在以下的sysidcfg里,网络服务只有DNS, 没有其它的。预设的root_password 是 “ilovecu”。
$ cd /jumpstart
$ cat sysidcfg
name_service=DNS {domain_name= mydomain.com
name_server=192168.1.1, 192168.1.2, 192168.1.3
search= mydomain.com }
network_interface=PRIMARY {hostname=jpclient
default_route=192.168.1.10
ip_address=192.168.1.45
netmask=255.255.255.0
protocol_ipv6=no}
root_password=Zftjq7R1BwPdE
security_policy=NONE
system_locale=en_US
terminal=sun-cmd
timeserver=localhost
timezone=Asia/Shanghai
$
$ cat rules
hostname jpclient - profile.u45 finish.u45
$
下面的profile.u45 里,3块盘的各个分区都可以看到。需要说明的是,这里分区的大小是以是MB来计算,但是metadb 的大小是以 blocks来计算。这里 每块盘上都设了metadb, 还设了大小(8MB)及count =5。 这只是为了在盘上给分区6留出足够的空间。因为在profile里,没法直接设置metadb所在的分区使用多少 空间。两个给hot spare pool用的分区 没有设置挂载点。每块盘上剩余的空间都划给分区 7。
$ cat profile.u45
# profile.u45
# susbin@chinaunix.net
# 122706
install_type initial_install
system_type standalone
partitioning explicit
cluster SUNWCreq # Core, 260mb. Take about 10 min. Good for testing.
#cluster SUNWCuser # End user, 2.7gb. Take about 25 min.
#cluster SUNWCprog # Developer, 3.5gb
#cluster SUNWCXall # Entire+OEM, 3.8gb. Take about 35 min.
geo Asia
filesys mirror:d10 c1t0d0s0 c1t1d0s0 16384 / logging
filesys mirror:d20 c1t0d0s1 c1t1d0s1 8192 swap
filesys c1t0d0s3 16384 /arch1 logging
filesys c1t0d0s4 16384 /arch2 logging
filesys c1t0d0s5 16384 /arch3 logging
filesys c1t0d0s7 free /data0 logging
filesys c1t1d0s3 16384 /u04 logging
filesys c1t1d0s4 16384 /u05 logging
filesys c1t1d0s5 16384 /u06 logging
filesys c1t1d0s7 free /data1 logging
# hot spare pool for d10 and d20
filesys c1t2d0s0 16384
filesys c1t2d0s1 8192
filesys c1t2d0s3 16384 /u01 logging
filesys c1t2d0s4 16384 /u02 logging
filesys c1t2d0s5 16384 /u03 logging
filesys c1t2d0s7 free /data2 logging
metadb c1t0d0s6 size 16384 count 5
metadb c1t1d0s6 size 16384 count 5
metadb c1t2d0s6 size 16384 count 5
# Install Recommended patch cluster. Take about 15 min. or more.
#patch patch_order nfs 192.168.1.48:/export/install/10_Recommended retry 5
$
现在Solairs10 Jumpstart 可以安装补丁。 下载的补丁可以放在 NFS server, HTTP server, 或local device 上的文件夹里。还要建一个文件, 里面列出所要安装的补丁的名字,比如, 118371-98。
前面 profile.u45 的最后一行, 作用就是安装补丁。这里利用了 Sun补丁包里自带的文件patch_order。如果想加一个新的补丁到Recommended patch cluster 里, 比如118371-99,要把下载的补丁118371-99放到安装服务器上的文件夹 /export/install/10_Recommended 里,还要在文件patch_order 里加上一行: 118371-99。安装补丁这个功能很好用, 已经装了4台机器, 没发生过任何问题。
Solairs10 Jumpstart 还新增了一项 “安装软件包” 的功能, 但它只能安装有这类名字的软件包: SUNWname。 以常用软件tcp_wrappers 为例, Jumpstart能安装软件包SUNWtcpd, 但它不能安装从www.sunfreeware.com 下载的tcp_wrappers-7.6-sol10-sparc-local。
使用命令pkgtrans 可以把一个tcp_wrappers-7.6-sol10-sparc-local 形式的包转换成SUNWtcpd 形式的包(a datastream to a file system format)。但实际使用起来,转换还是比较麻烦。因此, 在finish.u45 的最后部分, 专门写了一小段来直接安装从www.sunfreeware.com 下载的软件包。
$ cat finish.u45
#!/bin/sh
# susbin@chinaunix.net
# 122706
# Set variables
src_dir=${SI_CONFIG_DIR}/client.files
base=/a
base_etc=/a/etc
base_sc=/a/usr/local/scripts
base_cron=/a/var/spool/cron/crontabs
t_stamp=`date '+%m_%d_%y-%H:%M:%S'`
echo "Starting finish script at $t_stamp ... "
echo " "
# Create a directory for scripts on the jumpstart client
mkdir -p $base_sc
chmod 777 $base_sc
# Disable power mangement
touch ${base}/noautoshutdown
ls -l ${base}/noautoshutdown
# Avoid the NFS4 question
/usr/bin/touch ${base_etc}/.NFS4inst_state.domain
ls -l ${base_etc}/.NFS4inst_state.domain
echo " "
# Configure boot PROM
altdisk=/dev/rdsk/c1t1d0s0
alts0=`ls -l ${base}$altdisk $altdisk | sed 's/devices/,/' | cut -d ',' -f2,3,4`
eeprom > ${base_sc}/eeprom.$t_stamp
eeprom "local-mac-address?"=true
eeprom nvramrc="devalias altdisk ${alts0}"
eeprom "use-nvramrc?"=ture
eeprom boot-device="disk altdisk disk1 net"
eeprom > ${base_sc}/eeprom.$t_stamp
echo " "
eeprom | grep local-mac-address
eeprom | grep nvramrc
eeprom | grep boot-device
# Make the altdisk bootable, even when disk0 is gone.
installboot ${base}${altdisk}/usr/platform/`uname -i`/lib/fs/ufs/bootblk $altdisk
cp –p ${base_etc}/system ${base_etc}/system.$t_stamp
echo "set md:mirrored_root_flag=1" >> ${base_etc}/system
echo " "
tail -1 ${base_etc}/system
# Configuring network and inetd service
cp ${base_etc}/inet/netmasks ${base_etc}/inet/netmasks.$t_stamp
cp ${src_dir}/netmasks ${base_etc}/inet
touch ${base_etc}/notrouter
cp ${src_dir}/hosts.[a-d]* ${base_etc}
cp ${src_dir}/site.xml ${base}/var/svc/profile
echo " "
ls -l ${base_etc}/hosts.[a-d]*
ls -l ${base}/var/svc/profile/site.xml
# Confuguring ntp
cp ${src_dir}/ntp.conf ${base_etc}/inet
if [ ! -d ${base}/var/ntp ]; then
mkdir ${base}/var/ntp
fi
touch ${base}/var/ntp/ntp.drift
echo " "
ls -l ${base}/var/ntp/ntp.drift
# Setup crontab of root
cp -p ${base_cron}/root ${base_cron}/root.$t_stamp
cp ${src_dir}/crontab.root $base_cron/root
chown root:sys ${base_cron}/root
chmod 600 ${base_cron}/root
echo " "
ls -l ${base_cron}/root
# Copy my scripts to the jumpstart client
cp ${src_dir}/[a-z]*.*sh $base_sc
chmod 755 ${base_sc}/[a-z]*.*sh
mkdir ${base}/usr/local/bin
cp ${src_dir}/mdsave ${base}/usr/local/bin
chmod 755 ${base}/usr/local/bin/mdsave
mkdir ${base_etc}/lvm/recover
# Copy other files to the new system
cp ${src_dir}/kshrc $base_sc
cp ${src_dir}/[a-z]*.profile $base_sc
cp ${src_dir}/pkg.adm.file $base_sc
echo " "
ls -l ${base_sc}/pkg.adm.file
# Install third-party packages
jp_server=192.168.1.48
pkg_dir=/export/install/10_pkgs
adm_file=${base_sc}/pkg.adm.file
local_pkg_dir=/tmp/3rd.pkgs
mkdir $local_pkg_dir
# mount ${jp_server} pkg_dir $local_pkg_dir 因为有表情符号,所以换成下面一行。
mount ${jp_server}:/export/install/10_pkgs $local_pkg_dir
if [ $? = 0 ] ; then
echo " "
echo "Installing third party packages... "
pkg_list=`ls ${local_pkg_dir}`
for PKG in $pkg_list
do
pkgadd -n -a $adm_file -R $base -d ${local_pkg_dir}/$PKG all
done
umount $local_pkg_dir
rm -r $local_pkg_dir
echo " "
echo "Third party packages installation is done. "
else
echo "Could not mount $local_pkg_dir ."
echo "No third party packages are installed."
fi
echo " "
echo "Ended finish script at $t_stamp ."
exit 0
$
以上脚本里每一段都是相对独立的。如果不想做某一段, 可以把这一段删去。比如,
# Configure boot PROM 这一段, 如果不想做, 就可以删掉。有些机器只有一个网卡, 就不需要设local-mac-address, 所以也可把这一行删掉。
关于在JumpStart 安装中设置boot PROM,在Sun 的安装文档里没有找到例子。在网上搜了一下, 也没有找到有关文章。使用了几次, 到目前为止还没有发现问题.。希望用过这种方法的朋友指教。
关于 # Avoid the NFS4 question的更多内容可参见参考文章 (10)。
在脚本finish.u45里有几处需要用到事先准备好的文件,下面把它们的内容列出来:
$ cd /jumpstart/client.files
$ cat hosts.allow
ALL: 192.168.1. .mydomain.com
$
$ cat hosts.deny
ALL:ALL
$
$ cat ntp.conf
driftfile /var/ntp/ntp.drift
server 1.cn.pool.ntp.org
server 0.asia.pool.ntp.org
server 2.asia.pool.ntp.org
$
$ cat site.xml
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='profile' name='default'>
<service name='network/ntp' type='service' version='0'>
<instance name='default' enabled='true'/>
</service>
<service name='network/ftp' type='service' version='0'>
<instance name='default' enabled='true'/>
</service>
</service_bundle>
前面site.xml 文件的作用是把ntp和 ftp 服务设置为online。如果安装了Solaris10 全部内容
“cluster SUNWCXall # Entire+OEM, 3.8gb. Take about 35 min”,
那么Solaris10 SMF 是会把ntp, ftp和 telnet 服务预设为 disabled。用site.xml可以对SMF 管理的服务做适当的调整。有关设置SMF的讨论可参见参考文章 (9)。
$ cat pkg.adm.file
mail=
instance=unique
partial=nocheck
runlevel=nocheck
idepend=nocheck
rdepend=nocheck
space=nocheck
setuid=nocheck
conflict=nocheck
action=nocheck
networktimeout=60
networkretries=3
authentication=nocheck
keystore=${BASE}/var/sadm/security
proxy=
basedir=default
$
上面自建的pkg.adm.file,是为在Jumpstart 中安装第三方提供的软件包准备的。安装时要让 pkgadd 去读这个文件(installation administration file),得到全部问题的答案,这样在与系统的互动问答上就不会发生问题。
5. 加入 Client 及检查Jumpstart server的设置
# cd /jumpstart
# ./check
Validating rules...
Validating profile profile.u45...
The custom JumpStart configuration is ok.
#
# cd /export/install/solaris.10/Solaris_10/Tools
# ./add_install_client -s jpserver:/export/install/solaris.10 \
> -c jpserver:/jumpstart -p jpserver:/jumpstart jpclient sun4u
updating /etc/bootparams
#
检查Jumpstart server设置得是否正确,还有其他方法。参考文章 (1), (5)里面有比较详细的介绍。
6.测试及正式安装
如果Jumpstart server 是新建的,一般在正式安装之前,要测试一下。因为硬件的连接和软件的设置都可能会有问题。在前面的profile.u45 里,有这样一行,用它来做测试就很合适:
cluster SUNWCreq # Core, 260mb. Take about 10 min. Good for testing.
因为这样只装了一个最基本的Core, 许多服务是没有的,启动时会看到一些报错信息。做测试时,profile.u45 里的最后一行也可以不让它起作用,因为安装补丁比较费时间。
#patch patch_order nfs 192.168.1.48:/export/install/10_Recommended retry 5
另外,# Configure boot PROM 这一段如果在测试的时候做过,在正式安装时就不用再做了。
开始在 Client 上安装,要打入命令:
ok boot net – install nowin
如果遇到问题,就要根据报错内容去找出原因,然后把问题解决。本文末尾的参考文章 (5) 和 (3) 提供了排错的理论及实例。
安装结束后一定要在Client 上检查以下文件,确认安装中是否有问题出现。
$ ls –l /var/sadm/system/logs
total 332
lrwxrwxrwx 1 root root 20 Dec 21 16:29 begin.log -> begin.log_2006_12_21
-rw-r--r-- 1 root root 90 Dec 21 15:48 begin.log_2006_12_21
lrwxrwxrwx 1 root root 21 Dec 21 16:29 finish.log -> finish.log_2006_12_21
-rw-r--r-- 1 root root 524 Dec 21 16:29 finish.log_2006_12_21
-rw-r--r-- 1 root root 232 Dec 21 16:34 install_launch.log_2006_12_21_1632
-rw-r--r-- 1 root root 108108 Dec 21 16:28 install_log
-rw-r--r-- 1 root root 39932 Dec 21 16:37 sysidtool.log
$
正式安装完成后,还需要在 Jumpstart server 上执行以下命令:
# /etc/init.d/nfs.server stop
#
# cd /export/install/solaris.10/Solaris_10/Tools
# ./rm_install_client jpclient
removing jpclient from bootparams
#
结束语
一个系统安装好了, 往往还要做一些安装后的设置。比如, 提高或加强系统的安全性(Hardening system),设置root用户的环境变量等。在网上看到过几个脚本, 但都不很完善。参考文章 (7) 就给出了一个例子。
Sun 也提供了一个工具 JumpStart Enterprise Toolkit http://www.sun.com/bigadmin/content/jet/
因为从来没用过这个工具, 希望将来在本版能看到这方面的讨论。
参考文章:
A. CU
(1) Jumpstart安装实例 bear, 2002-6-13
(2) lofsadm的用法,可以用这个命令不光盘装oracle和其它软件 南非蜘蛛 , 2002-8-2
(3) 用DVD制作9的网络安装服务器以及遇到问题的解决 race, 2003-11-5
(4) Solaris9的jumpstart服务器配置中文详解(从原理到实践) yanghz, 2004-12-3
(5) Solaris 9网络安装实例及说明 Philmoon, 2006-12-28
B. Internet
(6) Automatically Mirroring the Boot Disk with Custom JumpStart Matthew Cheek, Apr, 2004
(7) jumpstart finish script Paveza, Gary, Apr, 2005
( 8 ) A CD-Free Installer for the Solaris OS Mohd Akhbar Jamaludin, May, 2005
(9) Liane Praza's Weblog Liane Praza, Jun, 2005
(10) override the system's default NFS version 4 domain name chilimonkey , Dec 2005
(11) Using Solaris JumpStart With the Solaris 10 OS for x86/x64 Platforms
Craig Winter and Dale Layfield, March 2007
[ 本帖最后由 susbin 于 2007-6-4 11:06 编辑 ] |
|