批量部署linux操作系统systemimager 使用

systemimager 可以把一个所有软件都安装完成的系统(黄金客户端)镜像到server 端, 在通过PXE 启动,再同过rsync同步到裸机上

因为systemimager大部分由perl编写,所有需要一些依赖包

perl-AppConfig

perl-XML-SAX

perl-XMLSimpel

主程序 ----服务器端

systemconfigurator

systemimager-common

systemimager-server

systemimager-x84-64boot-standard

systemimager-x84-64initrd_template

所有程序均可以在www.rpmfind.net中找到

服务器端安装完成后会有以下命令

[root@localhost ~]# si_
si_addclients           si_mkautoinstalldisk    si_mkdhcpstatic         si_pcp
si_clusterconfig        si_mkautoinstallscript  si_mkrsyncd_conf        si_psh
si_cpimage              si_mkbootpackage        si_monitor              si_pushinstall
si_getimage             si_mkbootserver         si_monitortk            si_pushoverrides
si_lsimage              si_mkclientnetboot      si_mvimage              si_pushupdate
si_mkautoinstallcd      si_mkdhcpserver         si_netbootmond          si_rmimage
这说明服务器端已经安装完成了

下一步来安装黄金客户端,

需要的安装程序为

systemconfigurator

systemimager-common

systemimager-client

systemimager-x84-64initrd_template

安装完成后命令

[root@mysql1 ~]# si_
si_lsimage        si_prepareclient       si_updateclient

黄金客户端已经安装完成,在客户端上启动同步服务

[root@localhost ~]# si_prepareclient --server 192.168.1.1

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 
客户端服务启动完成
服务器端抓取客户端系统镜像
基本的语法是:“si_getimage -golden-client [client_hostname] -image [image_name]
[root@localhost ~]#si_getimage --golden-client 192.168.1.2 -image vfast_backup  
--post-install reboot  --directory /systemimager/

    
    
This program will get the  "vfast_backup" system image from  "192.168.1.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]): y 因为需要PXE启动,所以服务器端需要安装DHCP server 和 TFTP RPM可以在自己的安装光盘中找到 一.配置服务器端
1 )执行 si_mkbootserver 命令后,提示我们这个脚本将要修改的配置文件以及重新启动的服务,输入“ y ”继续。
   
   
[root@localhost ~]# si_mkbootserver   
WARNING: this script may modify the following files:  
  --> /etc/services  
  --> /etc/inetd.conf  
  --> /etc/xinetd.d/tftp  
And can restart inetd, xinetd or tftp servers.  
Do you wish to continue (y/[n])? y  
Ok, continuing...  
Checking for a tftp server... found.  
Checking if tftp server is H. Peter Anvin's tftp server... yup - right on!  
Checking for a running inetd... Not found.  
Checking for a running xinetd... 16428.  
Looking for update-inetd... not found.  
Backing up /etc/xinetd.d/tftp...  
Moving /etc/xinetd.d/tftp to /etc/xinetd.d/tftp.si_mkbootserver.bak0...done.  
Restaring xinetd ...  
Stopping xinetd:                                           [  OK  ]  
Starting xinetd:                                           [  OK  ]  
done.  
Looking for a tftp client... found.  
Checking for loopback interface... up.  
Does tftp server work... yes.  
Looking for a pxe daemon... which: no pxe in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin)  
not found. 
 (2)接下来,将要为BootServer配置Pxe,在询问“pxelinux bootloader”路径时,由于“/usr/lib/syslinux/pxelinux.0”路径是syslinux安装后的默认路径,直接回车即可。
   
   
WARNING: your bootserver will be configured without a pxe daemon!  
         (ignore this warning if you're using a recent distro)  
done.  
What is the path to the pxelinux bootloader [/usr/lib/syslinux/pxelinux.0]?   #直接回车
Copying /usr/lib/syslinux/pxelinux.0 to /var/lib/tftpboot/X86PC/UNDI/linux-install/linux.0 ... done.  
Linking /var/lib/tftpboot/pxelinux.bin to /var/lib/tftpboot/X86PC/UNDI/linux-install/linux.0 ...done.  
Copying /var/lib/tftpboot/X86PC/UNDI/linux-install/pxelinux.cfg to /var/lib/tftpboot/pxelinux.cfg...Ok, configuration complete. 
3)在询问你是否运行si_mkdhcpserver命令配置DHCP Server,这里直接输入“y”回车。si_mkdhcpserver命令能够帮助我们自动的完成对DHCP配置文件的修改,主要包含了你的域名、网段、子网掩码和将要给客户端分配的有效地址范围等信息。
   
   
Once you're DHCP server is configured, you should be all set.  
Do you want to run si_mkdhcpserver to configure your DHCP server ([y]/n)? y  输入“y”
   
Welcome to the SystemImager "si_mkdhcpserver" command.  This command will  
prepare this computer to be a DHCP server by creating a dhcpd.conf file  
for use with your ISC DHCP server (v2 or v3).  
   
If there is an existing file, it will be backed up with the   
.beforesystemimager extension.  
   
Continue? (y/[n]): y 
4)程序使用了交互式的方式,询问你使用的DHCP软件包的版本、配置文件名称、输入域名、网段、子网掩码、地址池等信息,根据实际环境填写。
   
   
Trying to probe your DNS domain. Please wait...  
Type your response or hit <Enter> to accept [defaults].  If you don't  
have a response, such as no first or second DNS server, just hit   
<Enter> and none will be used.  
   
What is your DHCP daemon major version number (2 or 3)? [3]:   
What is the name of your DHCP daemon config file? [/etc/dhcpd.conf]:   
What is your domain name? [localdomain]:   
What is your network number? [192.168.1.0]: 172.16.0.0  
What is your netmask? [255.255.0.0]:   
What is the starting IP address for your dhcp range? [172.16.0.1]: 172.16.0.11  
What is the ending IP address for your dhcp range? [172.16.255.254]: 172.16.0.200  
What is the IP address of your first DNS server? []:   
What is the IP address of your default gateway? [172.16.255.254]: 172.16.0.1  
What is the IP address of your image server? [172.16.255.254]: 172.16.0.10  
What is the IP address of your boot server? [172.16.255.254]: 172.16.0.10  
What is the IP address of your log server? []:   
Use tmpfs staging on client?  (If unsure, choose "n") [n]:   
Do you want to use Flamethrower (multicast) to install your clients? [n]:   
   
What... is the air-speed velocity of an unladen swallow? []:   
   
Wrong!!! (with a Monty Python(TM) accent...)  
   
Press <Enter> to continue... 
(5)下图中列出了你刚刚填写的信息,确认无误后,输入“y”完成配置。
   
   
Ahh, but seriously folks...  
Here are the values you have chosen:  
   
#######################################################################  
ISC DHCP daemon version:                  3  
ISC DHCP daemon config file:              /etc/dhcpd.conf  
DNS domain name:                          localdomain  
Network number:                           172.16.0.0  
Netmask:                                  255.255.0.0  
Starting IP address for your DHCP range:  172.16.0.11  
Ending IP address for your DHCP range:    172.16.0.200  
First DNS server:                           
Second DNS server:                          
Third DNS server:                           
Default gateway:                          []  
Image server:                             172.16.0.10  
Boot server:                              172.16.0.10  
Log server:                                 
Log server port:                            
Flamethrower directory port:                
Use tmpfs staging on client:              n  
SSH files download URL:                     
#######################################################################  
   
Are you satisfied? (y/[n]): y 
6)开始创建DHCP服务的配置文件,并提示使用si_mkdhcpserver命令修改该配置文件。输入“y”重新启动DHCP服务,至此,DHCP服务,pxe服务配置完成。
   
   
The dhcp server configuration file (/etc/dhcpd.conf) file has been   
created for you.  Please verify it for accuracy.  
   
If this file does not look satisfactory, you can run this command again  
to re-create it: "si_mkdhcpserver" 
   
WARNING!:  If you have multiple physical network interfaces, be sure to   
edit the init script that starts dhcpd to specify the interface that   
is connected to your DHCP clients.  Here's an example:  
   
 Change "/usr/sbin/dhcpd" to "/usr/sbin/dhcpd eth1".  
   
Depending on your distribution, you may be able to set this with the   
"INTERFACES" variable in "/etc/default/dhcp", "/etc/default/dhcp3-server",  
or similar, or in your dhcpd initialization script ("/etc/init.d/dhcpd",   
"/etc/init.d/dhcp3-server", or similar).  
   
Also, be sure to start or restart your dhcpd daemon.  This can usually  
be done with a command like "/etc/init.d/dhcpd restart" or similar.  
   
Would you like me to restart your DHCP server software now? (y/[n]): y  
Starting dhcpd:                                            [ok] 
7)如果镜像服务器中有多个镜像的话,就要告知哪一个节点安装哪一个镜像。si_addclients为镜像的安装脚本创建符号链接。si_addclients改写镜像服务器的/etc/hosts
/var/lib/systemimager/scripts/hosts文件。Hosts文件为自动安装客户端查阅他们的主机名提供默认的机制。
   
   
[root@localhost ~]# si_addclients   
Welcome to the SystemImager "si_addclients" utility    
--------------------------------------------------------------------------------  
   
This utility has 3 sections.    
   
"Section 1" will ask you for your hostname information.  
   
"Section 2" will allow you to create softlinks from each client hostname to 
your "master" script in the "/var/lib/systemimager/scripts" directory.    
   
  Example: www297.sh -> web_server_image_v1.master  
   
"Section 3" will ask you for IP address information that will be combined   
with the hostname information provided in Section 1 to create entries in   
"/etc/hosts" for each of these same clients.  New entries will be appended   
to the end of "/etc/hosts".  If you specify new hostnames for existing IP   
addresses, those entries will be re-written in place to reflect the new   
host names.  
   
Continue? ([y]/n): y   #输入“y”,继续。
8)在si_addclients的第一个配置部分,需要指出自动安装节点的主机名称样式。一个主机范围的字段和一个域名用来定义我们要自动安装的节点的主机名;
   
   
si_addclients -- Section 1 (hostname information)  
--------------------------------------------------------------------------------  
   
The next series of questions will be used to create a range of hostnames.    
You will be asked for your domain name, the base host name, a beginning   
number, and an ending number.  
   
For example, if you answer:  
  domain name     = systemimager.org  
  host range      = www7-www11,www20  
   
Then the result will be a series of hostnames that looks like this:  
  www7.systemimager.org  
  www8.systemimager.org  
  www9.systemimager.org  
  www10.systemimager.org  
  www11.systemimager.org  
  www20.systemimager.org  
   
What is your domain name? []: vfast.com  
What is the hosts range that you want me to use? []: node11-node200  
   
I will work with hostnames:  node11-node200  
             in the domain:  vfast.com  
   
Are you satisfied? (y/[n]): y 
9)在第二个配置部分,将前一部分定义的节点映射到到镜像;
   
   
si_addclients -- Section 2 (soft links to master script)  
--------------------------------------------------------------------------------  
   
Would you like me to create soft links to a "master" script so that hosts:  
   
  node11-node200  
   
can be autoinstalled with one of the available images? ([y]/n): y  
   
Here is a list of available autoinstall scripts:  
   
vfast_backup   
   
Which script would you like these hosts to be installed with?  
[vfast_backup]:   
   
Your soft links have been created.  
   
Press <Enter> to continue... 
10)在第三个配置部分,si_addclients命令请求IP地址范围,这个IP保存在/etc/hosts和/var/lib/systemimager/scripts/hosts文件中。当自动安装客户端启动时,它会从镜像服务器中检索后面的文件并应用它查找主机名。
   
   
si_addclients -- Section 3 (adding or modifying /etc/hosts entries)  
--------------------------------------------------------------------------------  
   
Your target machines need to be able to determine their host names from their  
IP addresses, unless their host name is specified in a local.cfg file.    
   
The preferred method for doing this is with DNS.  If you have a working DNS   
that has IP address to hostname resolution properly configured for your   
target machines, then answer "n" here.  
   
If you don't have a working DNS, or you want to override the information in 
DNS, then answer "y" here to add entries to the "/etc/hosts" file on your  
image server.  After adding these entries, the /etc/hosts file will be   
copied to "/var/lib/systemimager/scripts" where it can be retrieved by your   
target machines.  
   
I will ask you for your clients' IP addresses one subnet at a time.  
   
   
Would you like me to continue? (y/[n]): y  
   
si_addclients -- Section 3 (adding or modifying /etc/hosts entries -- continued...)  
--------------------------------------------------------------------------------  
   
Hostnames range is: node11-node200  
   
What is the IPs address range (e.g. 10.0.0.1-10.0.0.100,10.0.0.101)?  
[]: 172.16.0.11-172.16.0.200  
I will work with IP addresses:  172.16.0.11-172.16.0.200  
                and hostnames:  node11-node200  
   
Are you satisfied? (y/[n]): y  
Use of uninitialized value in concatenation (.) or string at /usr/sbin/si_addclients line 552.  
   
These entries have been added to /etc/hosts, and /etc/hosts has been copied  
to /var/lib/systemimager/scripts for use by your auto-install clients.  
   
Press <Enter> to continue...  
   
si_addclients: successfully completed. 
11)执行si_mkclientnetboot来制作多台要克隆机器通过网络安装的对应启动介质:
   
   
[root@localhost ~]# si_mkclientnetboot --netboot --clients node11-node200  
[netboot] using the kernel and initrd.img for architecture: i386  
[netboot] using the flavor: standard  
[root@localhost ~]# 
12)启动systemimager-server-rsyncd服务,使用rsync服务克隆系统。将以下服务设置重启自动启动。
   
   
[root@localhost ~]# /etc/init.d/systemimager-server-rsyncd start  
Starting rsync daemon for systemimager: already running.  
[root@localhost ~]# chkconfig systemimager-server-rsyncd on 
[root@localhost ~]# chkconfig dhcpd on 
[root@localhost ~]# chkconfig xinetd on
二.裸机设置为网卡启动

不需要人工干预,便可安装完成


第9章. FAQ (常见问题解答)
Q: 镜像存储在哪里?
A: 存在/var/lib/systemimager/images。
注意: 如果你硬盘的这个分区不哆,将目录移到其它分区:
mv /var/lib/systemimager/images /home/systemimager_images
然后创建一个软链接到新的目录。
ln -s /home/systemimager_images /var/lib/systemimager/images
Q: 我怎样制做一个自动安装CD?
A: 在镜像服务器中执行si_mkautoinstallcd命令。
Q: 怎样创建一个自动安装USB盘:
A: 在镜像服务器中执行si_mkautoinstalldisk命令。
Q: 当我从dhcp传递参数,客户端出现请使用十六进制数字代替。我该如何用代点的IP地址代替。
A: 十六进行地址实际上是是你IP地址的十六进制表示(可以用gethostip命令更改)。这通常是引用的问题,在配置文件的IP地址中加上引号。
Q: 我执行了si_netbootmond,但是它没有工作,怎么回事儿?
A: 为了让si_netbootmond能正常工作,必须启动rsync进程:
"/etc/init.d/systemimager-server-rsyncd start".
Q: 如何配置服务器可以用网络启动ia64客户端?
A:
1. 在启动服务器中安装tftp(推荐tftp-hpa >= 0.28)。
2. 配置inetd或xinetd使tftp可用。
&#8226; 配置inetd,在/etc/inetd.conf中找到tftp词条,将它修改:
tftp dgram udp wait root /usr/sbin/in.tftpd -v -v -v -s /var/lib/tftpboot
如果你安装到了不同的目录,将"/usr/sbin/in.tftpd"改你的tftp服务器的完整路径。
-v并不是严格要求,只是让ftp服务器更详细,更容易检测问题。
最张,发送一个HUP信号给inetd(这会重新装载它的配置文件)。 # killall -HUP inetd
&#8226; 配置xinetd,修改:
    service tftp
{
         socket_type = dgram
         protocol    = udp
         wait        = yes
         user        = root
         server      = /usr/sbin/in.tftpd
         server_args = -s /home/tftp
         disable     = no
}
to:
service tftp
{
         socket_type = dgram
         protocol    = udp
         wait        = yes
         user        = root
         server      = /usr/sbin/in.tftpd
         server_args = -s /var/lib/tftpboot -r blksize
         disable     = no
}
最终,发送一个USR2信号给xinetd (这会重新装载它的配置文件)。
3. 配置你的DHCP服务器,它将为客户端提供启动参信息。安装DHCP服务器时要小心--如果它用来解决动态地址并在一个公共子网中,它会给其它网络中的机器发送假信息,可以会损坏那些机器上的数据。如果用网络安装的话推荐在私网内进行。如果可能的话,应该配置DHCP服务器只回答基于MAC地址的已知机器。
为启动客户端在/etc/dhcpd.conf中加入一个词条
host mcmuffin {
hardware ethernet 00:30:6e:1e:0e:83;
fixed-address 10.0.0.21;
filename "elilo.efi";
}
4. 从IA-64机器中复制elilo.efi到你的tftpboot目录,并让它全局可读。这个文件通常在/boot/efi或/usr/lib/elilo子目录中。同样也可在IA64发行版的elilo包中获得。
必须在tftpboot目录中创建一个elilo.conf文件。样例在/usr/share/doc/systemimager-doc/examples中,或者输入下面的。
5. 编辑/var/lib/tftpboot/elilo.conf:
#
# Sample elilo.conf for netbooting ia64 systemimager clients
#
# Inside your tftp directory you may also want to do this:
#
#   mkdir -p ia64/standard
#   cp /usr/share/systemimager/boot/ia64/standard/* ia64/standard/
#
default=systemimager
image=ia64/standard/kernel
    label=systemimager
    initrd=ia64/standard/initrd.img
    root=/dev/ram
    append="vga=extended ramdisk_blocksize=4096 console=tty0"
    #
    # Uncomment APPEND line below, and comment out APPEND line above, to use
    # both monitor (tty0) and first serial port (ttyS0) as console at the
    # same time.
    #
    # NOTE: Be sure your serial port speed is appropriate (57600, 9600, etc.)
    #
    #append="vga=extended ramdisk_blocksize=4096 console=tty0 console=ttyS0,9600n8"
    read-only
如果ABCDEFGH是客户端十六进制IP地址,elilo.efi将会用下面文件中的第一个。   
&#8226;  ABCDEFGH.conf
&#8226;  ABCDEFG.conf
&#8226;  ABCDEF.conf
&#8226;  ...
&#8226;  A.conf
&#8226;  elilo.conf
你可以用ipcalc功能,在syslinux包中可以获得,来计算十六进制的IP地址。
6. 配置客户端支持TFTP启动。
a. 启动到EFI(译者注:可扩展固件接口)
b. 进入启动选择维护菜单
c. 加入启动选项
d. 按在出现"Load file [Acpi/.../Mac()]"时按回车
e. 调用Netboot词条或其它相似的
f. 保存并退出,Netboot在启动菜单中可以用了。
Q: 如何安装自动安装客户端,使得控制台可以通过串口使用。
A: si_mkautoinstallcd和si_mkautoinstalldisk把持-append选项,准许为自动安装内核指定安装参数,包括串口控制台选项。例如:
si_mkautoinstallcd -out-file autoinstall.iso -append "console=ttyS0"
Q: DHCP服务器必须在镜像服务器上么?
A: 不是。如果你使用DHCP,可以用"option-140"并对镜像服务器的IP地址设置它的值。如果你使用si_mkdhcpstatic来配置dhcpd.conf文件,它会询问你镜像服务器的IP地址并为你加入适当的词条。
因为这不是option-140的官方用法,要么获得一个官方分配的号或应用一个私有范围的号来完成工作。
Q: SystemImager可以用在哪个发行版中?
A: SystemImager设计上可以在任何发行版中使用。镜像配置登记由System Configurator处理,它通过使用"footprinting"技术区别使用的系统配置文件类型,并配置网络,启动和其它一些信息。如果你发现哪个发行版本中不能使用SystemImager,请提交问题报告。
Q: 如何在自动安装内核中加入特殊板卡驱动?
A: 如果标准的启动包中不包含你需要驱动的硬件,可以使用UYOK特性自己创建一个定制的启动包。见http://wiki.systemimager.org/index.php/UYOK (http://wiki.systemimager.org/index.php/UYOK)).
Q: 我需要对用来获得镜像的客户端准备些什么?
A: 当然,你要安装systemimager-client包。如果这个包已经安装,只需要在从镜像服务器中执行si_getimage前执行si_prepareclient命令。可以安装任何软件,配置任何文件,按照你的选择对系统进行定制。
Q: 我可以在超过一台机器上使用自动安装磁盘或是自动安装CD么?
A: 当然可以。自动安装介质是通用的,可以在任何机器上自动安装。
Q: 如果将镜像送到客户端?
A: 用3.8.0版本启动,可以使用si_pushinstall命令,它会从镜像服务器上打开一个SSH通道到客户端。然后每个客户端使用镜像服务器打开的SSH通道进行下载镜像。这是在不安全的网络中进行的最安全的安装客户端的方法。
Q: 如何将镜像拉到客户端?How do I pull an image to a client?
A: 如果你执行si_mkdhcpserver来配置你的dhcp信息,如果你回答了所有执行si_getimage时被问的问题,包括主机名和IP地址,然后你要做的就是用下面的3种形式的自动安装介质之一启动客户端:
1. 自动安装CD - 它启动时间短并且持久性佳,但是必须有刻录机并且客户端可以读CD盘。i
2. 自动安装磁盘 - 启动时间短,但是要求客户端的BIOS支持从USB设备启动。
3. 网络启动 - 启动时间很显著,但是这个方法要求客户端网卡具有PXE功能和服务器端的配置。
见本手册的命令参考章中si_mkautoinstallcd和si_mkautoinstalldisk词条获得更多信息。
Q: 安动安装客户端如何知道要安装哪个镜像?
A: 通过读自动安装客户端的步骤来更好的理解这个答案:
1. 启动自动安装介质
2. 从DHCP获得一个IP地址
3. 通过DHCP来决定镜像服务器的IP地址
4. 从镜像服务器要求一个hosts文件
5. 在hosts文件中找到基于IP地址的主机名
6. 从镜像服务器中得到一个基于主机名的(例如:www237.sh)脚本。
7. 执行这个脚本。
正在说的这个脚本是当你执行si_getimage时动态创建的$image.master脚本的一个软链接。这个脚本明确地指出从镜像服务器中取得哪个镜像。打开它看看。
这些脚本和$image.master脚本可以在/var/lib/systemimager/scripts中找到。
Q: 如果想给客户端分配静态IP可以么?怎么做?
A: 可以。si_getimage会问你是否要用静态IP。
Q: 我想用DHCP来分配静态IP给我的客户端,但是我不想手工输入1000个mac地址。我该怎样做?
A: SystemImager有si_mkdhcpstatic功能。你启动客户系统,DHCP服务器会连续地分配地址。按照你想要它们接收IP地址的顺序启动系统,你可以确保它们获得你想要给它们分配的IP地址。启动系统后,执行si_mkdhcpstatic。它会重写/etc/dhcpd.conf文件,按照每个客户端的主机名及MAC地址。然后重启DHCP进程。因此,每次客户端要从DHCP获得一个IP地址,它总会被分配到适合的静态IP地址。
注意:应用客户主机名代替明确的IP地址,所以要更改DHCP服务器(或者DNS,NIS等)中的hosts文件来更改客户端接收到的IP地址。
注意:通过DHCP分配静态IP地址是作者选择的一种在大量系统中管理IP的好方法。
Q: 我能期望什么样的性能?
A: Ole Holm Nielsen,物理系,丹麦技术大学报告:
在我们的SystemImager安装中,我们可以在6分钟内安装1.8G的镜像到18个客户端。请见The NIFLHEIM SystemImager Page(http://www.fysik.dtu.dk/CAMP/Niflheim/systemimager.html)。我们的服务器拥有Gigabit网络,2GB的RAM,dual Intel Xeon 2.4 GHz,而客户端是Intel P4和100 Mbit网络。.
James Braid 报告:
从一个Celeron 700/512Mb服务器,100Mbit网络,我们做到了7~10分钟安装大概1G的镜像。硬盘是设置了LVM的5x 120Gb Seagate Barracuda V(non striped),文件系统为ReiserFS。
Q: 如何更新镜像服务器中的镜像?
A: 有两种方法更新镜像服务器中的镜像:
1. 在客户端进行一些改变然后再次执行si_getimage。
- 指定相同的镜像名称,在当前镜像将要被更新的情况下(只有更改的部分被考走)。
- 或者你可以指定一个新的镜像名称而且具有版本控制(强烈推荐这种方法)。
注意:每次执行si_getimage,重新创建一$image.master脚本。如果你自定义了$image.master脚本,确保再次执行si_getimage前保存它。
2. 直接更改文件。可以cd到此适当的镜像目录并更改文件,或者(推荐)cd到镜像目录然后执行‘chroot.sh’。这将会改变你工作的根目录到你想要操作镜像的根目录。然后在镜像中执行rpm或是其它命令并不用担心损坏或是弄混镜像服务器。改完后,输入exit你将会回到正常的shell中。
Q: 如何更新客户端来匹配镜像?
A: 一旦你更新了镜像服务器中的镜像,就可以更新服务器端。(不需要完全的重新安装)可以在客户端用si_updateclient命令,将镜像服务器的名称和想要更新到客户端的镜像做为命令的参数。执行si_updateclient -help获得更多关于这个命令的信息。推荐使用“如何更新镜像服务器中的镜像?”FAQ中版本控制方将执行完si_updateclient以测试镜像的生产环境恢复到已知状态。(例如,对上一个可以工作的镜像执行si_updateclient)。
客户端/etc/systemimager/updateclient.local.exclude文件是用来从被si_updateclient命令正在更新的文件中排除文件和目录。可以更改它以适应自己的环境。
Q: updateclient.local.exclude这个文件是用来干什么的?
A: si_updateclient命令使用它。见"如何更新客户端来匹配镜像?"FAQ获得更多信息。
Q: 如何使用SystemImager更新一小部分文件?例如,我应用了安全补丁,想将所有机器都安装。
A: 在客户端使用si_updateclient命令。
1.选用下面的一个方法更新服务器中的镜像:
a. 直接在镜像中应用补丁apply the patch to the image directly
b. 在一个客户端上应用补丁,然后执行si_getimage指定相同的镜像名(不会花费太长时间更新镜像)
c. 在一个客户端上应用补丁,然后执行si_getimage指定不同的镜像名。选择这个可以对版本控制。
2. 在你想要更新的客户端执行si_updateclient。执行si_updateclient -help来获得语法帮助。
Q: 有没有保存自动安装客户端状态的日志文件?
A: 有。SystemImager日志可以在镜像服务器中的/var/log/systemimager中找到。
Q: SystemImager基于其它什么软件?
A: SystemImager大部分由Perl编写,要用以下的软件:
&#8226; busybox
&#8226; bc
&#8226; devfsd
&#8226; ISC dhcp
&#8226; discover
&#8226; dosfstools
&#8226; e2fsprogs
&#8226; jfsutils
&#8226; xfsprogs
&#8226; Linux kernel
&#8226; parted
&#8226; pxelinux
&#8226; rsync
&#8226; syslinux
&#8226; raidtools
&#8226; reiserfsprogs
&#8226; systemconfigurator
&#8226; uClibc
为了确定还是看一下System Installation Suite (SIS),其中包括SystemInstaller,SystemImager和System Configurator。SystemInstaller是准许你安装镜像目录到镜像服器中的软件。标准的SystemImager版本中使用System Configurator,执行配置目标机,如IP地址,网卡,安装后用来启动客户端的初始化RAM盘。
Q: 什么是override目录?
A: override目录是一个在主镜像传输完后复制到目标机的目录。override目录中所有内容复制到目标机的新文件系统的根目录中。 所有文件的属性被复制,包括目录,权限和属主。这允许对镜像中的文件取代。Overrides目录在/var/lib/systemimager/overrides/。
简单地编辑master自动安装脚本并改变override变量来包含适当的overrides目录。例如,可以改变OVERRIDES="my_image"为OVERRIDES="my_image-ide"。
如果所有机器使用相同的override,就没必要更改自动安装脚本。只要把你想要override的文件放到同你的镜像有相同名称的overrides目录中,并执行它。
也可以使用多重override目录,用于你指定的顺序--每一个目录取代前一个目录。可以在多类机器中有少量不同的高度复杂的环境中使用这种方法,但是它们都源于一个镜像。例如,OVERRIDES="my_image-ide web_app"。
Q: 如何扩展文件系统?
A: 见"如查更改一个分区的大小?"
Q: 如查更改一个分区的大小?
A:
1. 用你喜欢的编辑器打开autoinstallscript.conf文件。
注意: 由si_prepareclient创建默认的autoinstallscript.conf文件在你镜像的/etc/systemimager目录。
2. 找到部分,其中dev设置含有要更改分区信息的磁盘。
3. 找到词条,其中num是我们现在说的分区号。
4. 更改size,改变新分区的大小,如果你分配的空间不足以容纳存储的文件,自动安装将会失败。
注意:每个部分可以用MB (megabytes)或% (percentages)来指定分区大小。 参见man autoinstallscript.conf 获得更多信息。
5. 用新的参数执行si_mkautoinstallscript创建新的自动安装脚本。
注意:默认,si_mkautoinstallscript使用镜像的./etc/systemimager目录中的autoinstallscript.conf文件。参见man si_mkautoinstallscript和man autoinstallscript.conf获得更多信息。
Q: 如可更改文件系统目标机才能使用?
A:
1. 确保内核支持你想用的文件系统。
2. 在你喜欢的编辑器中打开autoinstallscript.conf文件。
注意:由si_prepareclient创建默认的autoinstallscript.conf文件存储在镜像的./etc/systemimager目录。
3. 找到词条,其中mp (mount point)是用来设置你想要更改的文件系统。
4. 将fs更改成你想使用的文件系统。参见man autoinstallscript.conf查看支持的文件系统列表。
你必需明白你选择的文件系统的功能。依赖于你选择的文件系统,还要更改文件的挂载点,通过options词条来设置。如果选择了不支持的选项,自动安装会失败。
迄今所知道的案例,更改文件系统类型时没有必要更改部分的fs词条。部分的fs词条实际上不决定创建于那些分区上的文件系统,而是SystemImager所使用的parted工具创建分区时使用那个参数。
5. 用新的参数执行si_mkautoinstallscript创建一个新的自动安装脚本。默认,si_mkautoinstallscript使用镜像的./etc/systemimager目录中的autoinstallscript.conf文件。参见man si_mkautoinstallscript和man autoinstallscript.conf获得更多信息。
Q: 如何更改磁盘类型目标机才能使用?
A:
1. 确保镜像中的内核中包含你想用的磁盘类型的驱动。
2. 执行si_mkautoinstallscript --autodetect-disks ...创建一个新可以在客户端安装镜像时自动检测硬盘类型的自动安装脚本
3. 另一种方法是手工更改autoinstallscript.conf并重新执行si_mkautoinstallscript。
Q: 对不同的磁盘或分区配置可以使用一个镜像么?
A: 可以。如果在客户端有不同的硬盘类型,使用si_getimage或si_mkautoinstallscript时确保使用—autodetect-disks参数,并对你想使用的每个分区表创建不同的autoinstallscript.conf和master脚本
9.1. 参见
参考SystemImager站点中的疑难解答指南
http://wiki.systemimager.org/index.php/Troubleshooting and the online FAQ at
http://wiki.systemimager.org/index.php/FAQ for details.
               





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值