批量部署Linux操作系统systemimager 使用(2)

因为需要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";
}

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3defff43ae91e5c8d8daa5c650ac59fb.html