BigAdmin System Administration Portal
為 SPARC 平台與 ZFS 設定適用於 Solaris 10 作業系統的 JumpStart
Print-friendly VersionPrint-friendly Version
This content is submitted by a BigAdmin user. It has not been reviewed for technical accuracy by Sun Microsystems, though it may have been lightly edited to improve readability. If you find an error or would like to comment on the article, please contact the submitter or use the comment field at the bottom of the article. Community submissions may not follow Sun trademark guidelines. For information on Sun trademarks, please see http://www.sun.com/suntrademarks/.
 
 

為 SPARC 平台與 ZFS 設定適用於 Solaris 10 作業系統的 JumpStart

Lucas Williams,2008 年 1 月

簡介

我所具備的設定,是一部執行 Solaris 10 作業系統 (適用於 SPARC 平台與 ZFS) 的 Sun Enterprise 3500 伺服器,以及一部用戶端機器 (Sun Netra X1 伺服器)。對於公司準備要開始的專案,我必須在用戶端上安裝 Solaris 10 作業系統。

我希望此程序的逐步解說對於需要執行類似作業的人有所幫助。

注意:我所使用的是 Solaris 10 08/07 版本,但 03/05 之後的舊版亦適用。

目錄

此文包含下列主題:

先決條件

確實以超級使用者或其他系統管理員的身份登入。

您還應將啟動伺服器設為 DHCP 伺服器。但是,由於我的機器是從其他伺服器取得 DHCP,而且我在伺服器上是以靜態 IP 進行設定,所以我並未執行此動作。

此外,您還必須執行 tftpnfs 服務。當我在伺服器上安裝 Solaris 10 作業系統時,一開始先啟用 NFS,但必須建立 tftp 的服務。可喜的是,此作業極為容易,因為它幾乎已設定妥當。您只需進行一些快速變更即可,如下所示:

1. 編輯 inetd.conf 檔案。若您很熟悉 vi,請加以使用。否則,請使用其他文字編輯器。我從 SSH 終端機執行下列作業,因為我的機器既未連接顯示器,也沒有鍵盤。

# cd /etc
# vi inetd.conf

2. 向下捲動至檔案底部的下列幾行:

# TFTPD - tftp server (primarily used for booting)
# tftp dgram  udp6  wait root  /usr/sbin/in.tftpd  in.tftpd -s
/tftpboot

3. 取消最後一行的註釋並儲存文件,使其如下所示:

tftp  dgram  udp6  wait root /usr/sbin/in.tftpd  in.tftpd -s
/tftpboot

4. 鍵入 :wq 以儲存檔案,然後退出 vi

5. 執行 inetconv,以取得已加至 Service Management Facility (SMF) 的服務:

# inetconv

6. 然後執行 svcadm 以取得已啟用的服務,您便已準備就緒:

# svcadm enable tftpd

此時您可以設定 ZFS 儲存池、複製檔案,以及設定配置檔案等有趣的內容。

設定 ZFS 儲存池

我在 Solaris JumpStart 伺服器上建立了新的儲存池:

# zpool create install c1t7d0

我在伺服器中有未使用的備用磁碟,因此我將此磁碟設為 Solaris JumpStart 伺服器池。接著我建立共用。

# zfs create install/config
# zfs create install/boot
# zfs set sharenfs=ro,anon=0 install
# zfs set sharenfs=ro,anon=0 install/config
# zfs set sharenfs=ro,anon=0 install/boot

然後進行檢查,以確認此處含有我所有的目錄,且所有項目皆已正確共用:

# cd /install
# ls -l
drwxr-xr-x   4 root     sys       5 Jan  8 10:25 boot
drwxr-xr-x   2 root     sys       9 Jan  8 10:16 config
#
# share
-               /install   ro,anon=0   ""
-               /install/config   ro,anon=0   ""
-               /install/boot   ro,anon=0   ""

複製檔案

接著,我在 Sun Enterprise 3500 伺服器的 CD-ROM 光碟機中放入 Solaris 10 HW807 SPARC 的第一片 CD。然後切換至 CD 上的 cdrom 目錄,並執行 setup_install_server 程序檔:

# cd /cdrom/cdrom0/s0/Solaris_10/Tools
# ./setup_install_server /install

程序檔接著執行,並將必要的檔案複製到我的 /install 目錄。程序檔完成後,我切換到根目錄並取出 CD:

# cd /
# eject cdrom

然後,我在 CD-ROM 光碟機中放入第二片 CD,切換至 Tools 目錄,並執行 add_to_install_server 程序檔:

# cd /cdrom/cdrom0/Solaris_10/Tools
# ./add_to_install_server /install

我重複執行類似的步驟,直到五片作業系統 CD 與語言 CD 的所有檔案皆複製到 /install 目錄為止。

我再次將第一片光碟放入 Sun Enterprise 3500 伺服器的 CD-ROM 光碟機中,然後切換至 Misc 目錄。接著,複製 check 程序檔,以便用此程序檔驗證我打算在後續幾個步驟中建立的 profilerules 檔案:

# cd /cdrom/cdrom0/s0/Solaris_10/Misc/jumpstart_sample
# cp check /install/config
# cd /install/config

設定配置檔案

接下來的部分很有趣,我們會實際寫入檔案,使 Solaris JumpStart 伺服器在關閉後執行。

您可以從光碟複製範例,並視需要加以修改。由於我很清楚所要的系統用途,因此自行撰寫檔案,然後執行 check 程序檔以驗證檔案確實可運作,以及建立 rules.ok 檔案。

我第一個建立的檔案是 sysidcfg。此檔案會告知用戶端,在初始開機後用戶端將會有哪些設定。若您並未新增資訊至此檔案,系統會要求您提供所有請求的資訊。我使用 vi/install/config 中建立我的檔案:

# vi sysidcfg
system_locale=en_US.ISO8859-1
timezone=US/Pacific
timeserver=localhost
terminal=vt100
name_service=NONE
security_policy=NONE
root_password=<encrypted password from /etc/shadow>
network_interface=dmfe0 {hostname=<hostname of client>
                         netmask=<your network's netmask>
                         protocol_ipv6=no
                         default_route=<your gateway>}

:wq

接下來是 rules 檔案。此檔案對我的設定作業而言極為容易,因為我只需要設定一部伺服器。rules 檔案可讓您執行許多作業。若您看看 Solaris CD 所包含的 rules 檔案範例,即可瞭解能夠利用此檔案執行哪些作業。以下是我所使用的項目。

# vi rules
hostname <hostname of client> - profile -

:wq

上述程式碼中必須要有兩個「-」符號,除非您使用 begin 程序檔與 finish 程序檔。在此情況下,您會以程序檔的名稱取代「-」符號。

在啟動您的用戶端前,請確實使用 chmod 755 變更程序檔的權限。如需其詳細資訊,請參考 Solaris CD 的 /Solaris_10/Misc/jumpstart_samples 下的 rules 程序檔範例。

接著,您必須使用您在 rules 檔案中指定的檔案名稱,建立您的 profile 檔案。各個項目彼此參考的方式很有趣。您必須使用您在 rules 檔案中指定的項目,做為設定檔的名稱。由於我在 rules 檔案中將 profile 指定為檔案名稱,因此我的檔案名為 profile。我的 profile 檔案會指定用戶端的設定方式,包括分割區大小、安裝類型與用戶端類型。

我再次使用 vi 建立檔案,但 Solaris CD 上其實有很多可讓您依本身需求編輯的範例。重點是您必須瞭解正確的安裝類型。

cluster 選項會根據軟體群組指定安裝類型。下表描述可用的值。

表 1:軟體群組與群組名稱的值

精簡的網路支援軟體群組
SUNWCrnet
核心系統支援軟體群組
SUNWCreq
一般使用者 Solaris 軟體群組
SUNWCuser
開發人員 Solaris 軟體群組
SUNWCprog
整個 Solaris 軟體群組
SUNWCall
整個 Solaris 軟體群組與 OEM 支援
SUNWCXall

以下是我所使用的項目:

# vi profile
install_type      initial_install
cluster           SUNWCXall
partitioning      explicit
filesys           c0t0d0s0 14000 /
filesys           c0t0d0s1 2048 /var
filesys           c0t0d0s3 1024 swap
filesys           c0t0d0s7 19500 /export/home
system_type       standalone

:wq

下一個步驟在於確認我的檔案中沒有任何錯誤。為了這麼做,我執行了 check

# ./check

若作業結果正常,您的 /install/config 目錄中將會產生名為 rules.ok 的檔案。

# ls -l
-rwxr-xr-x   1 root     root   59701 Jan  8 10:16 check
-rw-r--r--   1 root     root     232 Jan  8 10:14 profile
-rw-r--r--   1 root     root      32 Jan  8 10:15 rules
-rw-r--r--   1 root     root      57 Jan  8 10:16 rules.ok
-rw-r--r--   1 root     root     278 Jan  8 09:33 sysidcfg

設定伺服器以便正確啟動

接下來我們將實際設定要啟動的伺服器。您必須取得用戶端的 MAC 位址。取得方式有兩種:在用戶端上執行 ifconfig -a,或從 openboot 提示取得。

取得 MAC 位址後,請將此地址增加至您的 /etc/ethers 檔案。若您像我一樣沒有此檔案,請直接建立:

# cd /etc
# vi ethers
0a:3b:ba:f5:d1:e6 <client hostname>

:wq

接著,請將您的用戶端增加至 /etc/hosts 檔案:

# vi hosts
<ip.address.for.client> <client hostname>

:wq

現在您必須建立啟動伺服器。確認 Solaris 10 作業系統的光碟 1 位於 CD-ROM 中,然後再次執行 setup_install_server,這次指定 -b 選項與 /install/boot 目錄:

# cd /cdrom/cdrom0/s0/Solaris_10/Tools
# ./setup_install_server -b /install/boot

完成此動作後,您可以取出 CD:

# cd /
# eject cdrom

設定用戶端

現在您可以設定用戶端。我執行了下列指令。我從先前從 CD 的 /install 目錄複製的檔案,直接執行這些指令。

注意:您必須從安裝影像執行下列指令,而不是從 CD 執行,因為指令的執行位置會決定用戶端將在何處尋找開機影像。若您從 CD 進行安裝,用戶端即會在 CD 上尋找開機影像,而除非您使用 NFS 以共用伺服器上的 CD-ROM 光碟機,否則指令會失敗。

# cd /install/Solaris_10/Tools
# ./add_install_client -e 0a:3b:ba:f5:d1:e6 -s
<server hostname>:/install -c
<server hostname>:/install/config -p
<server hostname>:/install/config <client hostname>
sun4u

前述指令會建立所有必要的檔案,讓用戶端能夠啟動,並尋找開始安裝 Solaris 作業系統所需的一切。以下描述旗標的意義:

  • -e 指定用戶端的 MAC 位址。
  • -s 指定伺服器安裝檔案的位置。
  • -c 指定 Solaris JumpStart 配置位置。
  • -p 指定 sysidcfg 檔案的位置。
  • sun4u 指定用戶端的架構。

啟動用戶端

現在您已準備好啟動用戶端,並使其尋找伺服器。

注意:在我的 Sun Netra X1 伺服器上,我只要按 # 並在 LOM> 提示鍵入 break,即可進入 lights on management (LOM) 主控台。請執行必要動作以進入 OpenBoot 提示。

在用戶端上,請進入 OpenBoot OK 提示並執行下列指令:

ok> boot net - install

當我執行此指令時,用戶端會連線至我的伺服器、下載作業系統,並開始進行安裝。我只需要指示用戶端使用偵測到的預設 IPv4 設定,它即會完成其餘工作,包括重新開機並進入主控台模式。

關於作者

Lucas Williams 擔任 UNIX 與 Microsoft Windows 系統管理員超過 15 年。他在各種形式的 Linux、Solaris 作業系統 (2.6 至 10 版)、Novell Networking,以及 Microsoft Windows NT 3.51 乃至於 Microsoft Windows Server 2008 方面,都有豐富的經驗。他所撰寫的程序檔簡化了各種系統的管理工作,而且也在新技術部署至生產環境之前,對新技術進行測試。目前,他正在研究可將虛擬化運用於在生產環境中部署伺服器的各種方法。

The information and links on this page have been provided by a BigAdmin user. The submitter is solely responsible for such information and links. Sun is not responsible for the availability of external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. Sun will not be responsible or liable, directly or indirectly, for any actual or alleged damage or loss caused by or in connection with use of or reliance on the information posted here, or goods or services available on or through any external site or resource.
 
 
BigAdmin
  
 
BigAdmin Upgrade Hub