- 論壇徽章:
- 0
|
4.設(shè)置 installation server
4.1 加入第一個文件 (對應(yīng) 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 加入其余文件 (對應(yīng) 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系統(tǒng)文件及設(shè)置NFS 服務(wù)器
# 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 創(chuàng)建Jumpstart server所需的文檔及腳本
Jumpstart server所需的腳本及文檔樣板等, 一定要從加載了Solaris10 CD images 的地方復(fù)制過來。Soalris9 的不可以用在Solairs10 上。
# cp –pr /export/install/solaris.10/Solaris_10/Misc/jumpstart_sample /jumpstart
# cd /jumpstart/jumpstart_sample
# cp -pr ./[a-]* ../
#
以下是建好的腳本及幾個文檔。
在以下的sysidcfg里,網(wǎng)絡(luò)服務(wù)只有DNS, 沒有其它的。預(yù)設(shè)的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塊盤的各個分區(qū)都可以看到。需要說明的是,這里分區(qū)的大小是以是MB來計算,但是metadb 的大小是以 blocks來計算。這里 每塊盤上都設(shè)了metadb, 還設(shè)了大。8MB)及count =5。 這只是為了在盤上給分區(qū)6留出足夠的空間。因為在profile里,沒法直接設(shè)置metadb所在的分區(qū)使用多少 空間。兩個給hot spare pool用的分區(qū) 沒有設(shè)置掛載點。每塊盤上剩余的空間都劃給分區(qū) 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
$
現(xiàn)在Solairs10 Jumpstart 可以安裝補丁。 下載的補丁可以放在 NFS server, HTTP server, 或local device 上的文件夾里。還要建一個文件, 里面列出所要安裝的補丁的名字,比如, 118371-98。
前面 profile.u45 的最后一行, 作用就是安裝補丁。這里利用了 Sun補丁包里自帶的文件patch_order。如果想加一個新的補丁到Recommended patch cluster 里, 比如118371-99,要把下載的補丁118371-99放到安裝服務(wù)器上的文件夾 /export/install/10_Recommended 里,還要在文件patch_order 里加上一行: 118371-99。安裝補丁這個功能很好用, 已經(jīng)裝了4臺機器, 沒發(fā)生過任何問題。
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 形式的包轉(zhuǎn)換成SUNWtcpd 形式的包(a datastream to a file system format)。但實際使用起來,轉(zhuǎn)換還是比較麻煩。因此, 在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 這一段, 如果不想做, 就可以刪掉。有些機器只有一個網(wǎng)卡, 就不需要設(shè)local-mac-address, 所以也可把這一行刪掉。
關(guān)于在JumpStart 安裝中設(shè)置boot PROM,在Sun 的安裝文檔里沒有找到例子。在網(wǎng)上搜了一下, 也沒有找到有關(guān)文章。使用了幾次, 到目前為止還沒有發(fā)現(xiàn)問題.。希望用過這種方法的朋友指教。
關(guān)于 # Avoid the NFS4 question的更多內(nèi)容可參見參考文章 (10)。
在腳本finish.u45里有幾處需要用到事先準(zhǔn)備好的文件,下面把它們的內(nèi)容列出來:
$ 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 服務(wù)設(shè)置為online。如果安裝了Solaris10 全部內(nèi)容
“cluster SUNWCXall # Entire+OEM, 3.8gb. Take about 35 min”,
那么Solaris10 SMF 是會把ntp, ftp和 telnet 服務(wù)預(yù)設(shè)為 disabled。用site.xml可以對SMF 管理的服務(wù)做適當(dāng)?shù)恼{(diào)整。有關(guān)設(shè)置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 中安裝第三方提供的軟件包準(zhǔn)備的。安裝時要讓 pkgadd 去讀這個文件(installation administration file),得到全部問題的答案,這樣在與系統(tǒng)的互動問答上就不會發(fā)生問題。
5. 加入 Client 及檢查Jumpstart server的設(shè)置
# 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設(shè)置得是否正確,還有其他方法。參考文章 (1), (5)里面有比較詳細的介紹。
6.測試及正式安裝
如果Jumpstart server 是新建的,一般在正式安裝之前,要測試一下。因為硬件的連接和軟件的設(shè)置都可能會有問題。在前面的profile.u45 里,有這樣一行,用它來做測試就很合適:
cluster SUNWCreq # Core, 260mb. Take about 10 min. Good for testing.
因為這樣只裝了一個最基本的Core, 許多服務(wù)是沒有的,啟動時會看到一些報錯信息。做測試時,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
如果遇到問題,就要根據(jù)報錯內(nèi)容去找出原因,然后把問題解決。本文末尾的參考文章 (5) 和 (3) 提供了排錯的理論及實例。
安裝結(jié)束后一定要在Client 上檢查以下文件,確認安裝中是否有問題出現(xiàn)。
$ 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 上執(zhí)行以下命令:
# /etc/init.d/nfs.server stop
#
# cd /export/install/solaris.10/Solaris_10/Tools
# ./rm_install_client jpclient
removing jpclient from bootparams
#
結(jié)束語
一個系統(tǒng)安裝好了, 往往還要做一些安裝后的設(shè)置。比如, 提高或加強系統(tǒng)的安全性(Hardening system),設(shè)置root用戶的環(huán)境變量等。在網(wǎng)上看到過幾個腳本, 但都不很完善。參考文章 (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的網(wǎng)絡(luò)安裝服務(wù)器以及遇到問題的解決 race, 2003-11-5
(4) Solaris9的jumpstart服務(wù)器配置中文詳解(從原理到實踐) yanghz, 2004-12-3
(5) Solaris 9網(wǎng)絡(luò)安裝實例及說明 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 編輯 ] |
|