通常人們在安裝Linux操作系統中,常使用是「光碟安裝」的傳統方式.目前,U盤安裝的方法也逐漸盛行.但是,上述的兩種方法只適用於單機部署,對於大規模化的安裝操作系統,推薦使用網路引導無人值守的自動化安裝操作系統的方式. 我曾經在 "/> 通常人們在安裝Linux操作系統中,常使用是「光碟安裝」的傳統方式.目前,U盤安裝的方法也逐漸盛行.但是,上述的兩種方法只適用於單機部署,對於大規模化的安裝操作系統,推薦使用網路引導無人值守的自動化安裝操作系統的方式. 我曾經在 "/>
歡迎您光臨本站 註冊首頁

自動化安裝Linux系統之「SystemImager」(上)

←手機掃碼閱讀     火星人 @ 2014-03-09 , reply:0
自動安裝Linux系統之"SystemImager」 <?xml:namespace prefix = o /> 通常人們在安裝Linux操作系統中,常使用是「光碟安裝」的傳統方式.目前,U盤安裝的方法也逐漸盛行.但是,上述的兩種方法只適用於單機部署,對於大規模化的安裝操作系統,推薦使用網路引導無人值守的自動化安裝操作系統的方式. 我曾經在

Linux KickStart無人值守安裝》一文中介紹了Red Hat公司基於腳本方式安裝的KickStart如何自動化部署Red Hat Linux操作系統.使用該方法的優點就是操作系統的軟體包只需要一份拷貝;根據不同的組配置,不同的配置文件,當待安裝節點通過

PXE網路引導后,就可以安裝配置文件指定的軟體包,從而完成安裝工作.
在實際的部署過程中,我們經常會遇到不僅僅需要成功的安裝系統,關鍵是系統上的應用.(例如:高性能集群、計算機實驗室、公司桌面環境.)如何快速、簡單、高效地完成整個部署值得大家思考.本文將介紹基於鏡像方式安裝的SystemImager部署Linux操作系統. 一、

SystemImager簡介 SystemImagerSystem Installation Suite的一部份,創始人Brian Elliott Finley.目前的維護者和項目小組的領導者是Andrea Righi.該軟體支持所有的GUN/Linux版本,發布軟體及快速部署生產環境.其主要特點如下:

SystemImager的一個主要特徵是與發行版本無關,並且能支持不同種類的硬體.這一特徵可以讓我們將任何種類的GNU/Linux(標準的發行版本或者自定義的版本)部署到目標機器.此項目的主要目標是實現輕鬆,快捷的部署大量的節點.典型的應用環境包括計算機實驗室,render farms(註:視覺農場,很多大片在後期製作所使用的圖形渲染的工作站,類似於超級計算機),Internet伺服器中心,資料庫伺服器中心,公司桌面環境等.SystemImager已經被證實了在集群計算環境中很流行,如:網格計算和高性能計算.

另一個設計上便於GNU/Linux發行以及不依賴於硬體的特點是SystemImager處理的是基於系統鏡像的文件.鏡像以文件形式儲存目錄體系節構,即為樣本節點的一個全面的快照,包含節點根文件系統中所有文件及目錄.鏡像以多種方法獲得,包括從目標系統(golden client)中獲得,或應用第三方工具直接在鏡像伺服器中生成. 二、SystemImager工作原理

SystemImager
軟體包需要從一台安裝好操作系統的節點抓取映像,利用這個映像就可以為多個相同硬體配置的計算機節點安裝操作系統. 三、部署systemimager服務 要部署systemimager服務,一共需要一下幾個步驟:

(1) 安裝鏡像伺服器 (2) 安裝黃金客戶端

(3)
製作黃金客戶端鏡像 (4)配置systemimager服務 (5)克隆操作系統 1、安裝鏡像伺服器: 首先,到

SystemImager官方網站下載安裝鏡像伺服器所需的軟體包,官方提供了sis-install腳本,可以快速的下載所需的軟體包.當然,也可以到網站上單個的下載.鏡像伺服器所需的軟體包列表如下所示:
server  |-- perl-AppConfig-1.52-4.noarch.rpm  |-- systemconfigurator-2.2.11-1.noarch.rpm  |-- systemimager-common-4.1.6-1.noarch.rpm  |-- systemimager-i386boot-standard-4.1.6-1.noarch.rpm  `-- systemimager-server-4.1.6-1.noarch.rpm 
在安裝的過程中,注意軟體包的依賴關係,確保以安裝perl-XML-Simple

perl-XML-Parser等軟體包.執行如下命令開始安裝:
[root@localhost server]# rpm -ivh *.rpm  error: failed to stat /media/RHEL_5.4 i386 DVD: No such file or directory  Preparing...                ########################################### [100%]     1:perl-AppConfig         ########################################### [ 20%]     2:systemconfigurator     ########################################### [ 40%]     3:systemimager-common    ########################################### [ 60%]     4:systemimager-server    ########################################### [ 80%]  Stopping xinetd: [  OK  ]  Starting xinetd: [  OK  ]     5:systemimager-i386boot-s########################################### [100%]  [root@localhost server]# 
2、安裝黃金(Golden)客戶端: 要創建golden client,你必須安裝

systemimager-client包.黃金客戶端所需的軟體包列表如下所示:
client/  |-- perl-AppConfig-1.52-4.noarch.rpm  |-- systemconfigurator-2.2.11-1.noarch.rpm  |-- systemimager-client-4.1.6-1.noarch.rpm  |-- systemimager-common-4.1.6-1.noarch.rpm  `-- systemimager-i386initrd_template-4.1.6-1.noarch.rpm 
執行rpm –ivh *.rpm完成黃金客戶端的安裝:
[root@qiuri client]# rpm -ivh *.rpm  Preparing...                ########################################### [100%]     1:perl-AppConfig         ########################################### [ 20%]     2:systemconfigurator     ########################################### [ 40%]          

3:systemimager-common ########################################### [ 60%] 4:systemimager-client ########################################### [ 80%] 5:systemimager-i386initrd########################################### [100%] [root@qiuri client]#
3、製作黃金客戶端鏡像 當你安裝完畢后,就可以以root身份執行si_prepareclient命令,執行後會在/etc/systemimager目錄下生成許多文件,其中包含分區方案,文件系統類型等.同時si_prepareclient也會在黃金客戶端上啟動一個

rsync進程,以便SystemImager伺服器可以獲取訪問它的文件的許可權,並通過網路複製文件到鏡像伺服器中.
[root@qiuri ~]# si_prepareclient --server 172.16.0.10  Welcome to the SystemImager si_prepareclient command.  This command may modify the following files to prepare your golden client for having it's image   retrieved by the imageserver.  It will also create the /etc/systemimager   directory and fill it with information about your golden client.  All modified  files will be backed up         

with the .before_systemimager-4.1.6 extension. /etc/services: This file defines the port numbers used by certain software on your system. Entries for rsync will be added if necessary. /tmp/fileO0rkKZ: This is a temporary configuration file that rsync needs on your golden client in order to make your filesystem available to your SystemImager server. inetd configuration: SystemImager needs to run rsync as a standalone daemon on your golden client until it's image is retrieved by your SystemImager server. If rsyncd is configured to run

as a service started by inetd, it will be temporarily disabled, and any running rsync daemons or commands will be stopped. Then, an rsync daemon will be started using the temporary configuration file mentioned above. See "si_prepareclient --help" for command line options. Continue? (y/[n]): y #輸入「y」,繼續. *********************************** WARNING *********************************** This utility starts an rsync daemon that makes all of your files accessible by anyone who can connect to the rsync port of this machine. This is the case until you reboot, or kill the 'rsync --daemon' process by

hand. By default, once you use si_getimage to retrieve this image on your imageserver, these contents will become accessible to anyone who can connect to the rsync port on your imageserver. See rsyncd.conf(5) for details on restricting access to these files on the imageserver. See the systemimager-ssh package for a more secure method of making images available to clients. *********************************** WARNING *********************************** Continue? (y/[n]): y #再次輸入"y". -rw-r--r-- 1 root root 1855956 Apr 10 21:31 /etc/systemimager/boot/kernel Starting or re-starting rsync

as a daemon..... done! This client is ready to have its image retrieved. You must now run the "si_getimage" command on your imageserver. Your client has been successfully prepared. Boot kernel (copied from this Linux distribution) and an initrd.img (generated by the initrd_template package) can be found in /etc/systemimager/boot. Automatically create configuration file for systemconfigurator: >> /etc/systemconfig/systemconfig.conf [root@qiuri ~]#
我們可以使用ps –ef命令來檢查si_prepareclient

腳本工作是否正常,可以看到一個正在運行的rsync守護進程(使用/tmp/rsyncd.conf文件作為配置文件)在等待發送文件到網路的請求.
[root@qiuri ~]# ps -ef |grep rsync   root      3812     1  0 15:46 ?        00:00:00 rsync --daemon --port=873 --config=/tmp/filerqgMEG  root      3846  3539  0 15:47 pts/2    00:00:00 grep rsync 
現在可以在鏡像伺服器上執行si_getimage,將鏡像(即:黃金客戶端上的內容)從黃金客戶端複製到鏡像伺服器.默認情況下,鏡像被存儲在

SystemImager伺服器上的/var/lib/SystemImager/images目錄.
注意:鏡像伺服器上有足夠的磁碟空間用於存儲黃金客戶端鏡像. 基本的語法是:「si_getimage -golden-client [client_hostname] -image [image_name] 其中

[client_hostname]golden client的主機名或IP地址,[image_name]是你想要給存儲鏡像的名稱.--post-install reboot選項指定克隆一台機器后客戶端重新啟動計算機,-directory選項可以指定鏡像存儲的路徑.可以用「

man si_getimage」查看更多其它的選項.
[root@localhost ~]# si_getimage --golden-client 172.16.0.2 -image vfast_backup   --post-install reboot -directory /systemimager/     This program will get the "vfast_backup" system image from "172.16.0.2" making the assumption that all filesystems considered part  of the system image are using ext2, ext3, jfs, FAT, reiserfs, or xfs.     This program will not get /proc, NFS, or other filesystems  not mentioned above.     *********************************** WARNING ***********************************   All files retrieved from a golden client are, by default, made accessible to   anyone who can         

connect to the rsync port of this machine. See rsyncd.conf(5) for details on restricting access to these files on the imageserver. See the systemimager-ssh package for a more secure (but less effecient) method of making images available to clients. *********************************** WARNING *********************************** See "si_getimage --help" for command line options. Continue? ([y]/n):y #輸入"y"繼續
黃金客戶端開始複製文件到鏡像伺服器,如下所示:
usr/share/zoneinfo/right/Navajo => usr/share/zoneinfo/right/US/Mountain  usr/share/zoneinfo/        

right/America/Denver => usr/share/zoneinfo/right/US/Mountain usr/share/zoneinfo/right/America/Shiprock => usr/share/zoneinfo/right/US/Mountain usr/share/zoneinfo/right/America/Los_Angeles => usr/share/zoneinfo/right/US/Pacific usr/share/zoneinfo/right/Pacific/Pago_Pago => usr/share/zoneinfo/right/US/Samoa usr/share/zoneinfo/right/Pacific/Samoa => usr/share/zoneinfo/right/US/Samoa sent 3524467 bytes received 3232535951 bytes 1941830.43 bytes/sec total size is 3411616325 speedup is 1.05 ------------- vfast_backup IMAGE RETRIEVAL FINISHED ------------- Press <Enter> to continue...
複製完成後,提示按「Enter」鍵繼續,鍵入「

Enter」后,需要讓我們選擇為克隆客戶端選擇獲取IP地址的方式.有以下三種方式供大家選擇:
l DHCP:伺服器安裝完成後會使用DHCP獲得IP,非靜態

l STATIC:安裝過程中使用的IP會成為安裝客戶端的靜態IP l REPLICANT:安裝后不會配置網路,作為備份或者快速恢復單機的機制

根據實際情況選擇,這裡我選擇使用DHCP,直接回車即可.
There are three ways to assign IP addresses to the client systems on an  ongoing basis:     1) DHCP     ----------------------------------------------------------------     A DHCP server will assign IP addresses to clients installed with    this image.  They may be assigned a different address each time.     If you want to use DHCP, but must ensure that your clients     receive the same IP address each time, see "man si_mkdhcpstatic".     2)         

STATIC ---------------------------------------------------------------- The IP address the client uses during autoinstall will be permanently assigned to that client. 3) REPLICANT ---------------------------------------------------------------- Don't mess with the network settings in this image. I'm using it as a backup and quick restore mechanism for a single machine. Which method do you prefer? [1]: #直接回車You have chosen method 1 for assigning IP addresses.
接下來,讓我們確認配置以及馬上配置si_clusterconfig命令,直接回車即可.到此,整個黃金客戶端鏡像製作完成.可以到存儲鏡像的目錄查看創建好的鏡像.

Are you satisfied? ([y]/n):   Would you like to run the "si_clusterconfig" utility now? (y/[n]): 
文章上半部分完成,查看整篇文章請看(下)


[火星人 ] 自動化安裝Linux系統之「SystemImager」(上)已經有953次圍觀

http://coctec.com/docs/linux/show-post-51560.html