免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1944 | 回复: 0
打印 上一主题 下一主题

Systemimager+PXE快速安装多台机器 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-12-27 19:28 |只看该作者 |倒序浏览

                Systemimager+PXE快速安装多台机器
肠子(changzi100)
mailto:changzi100@yahoo.com.cn
实验环境:
server:CentOS5.1(192.168.1.63)用来作镜像服务器。
client:虚拟机N台,将其中一台作为golden-client,用si_getimage抽取镜像。
以上golden-client端的准备以及抽取镜像操作省掉了,在笔者另外两个实验中有介绍,具体步骤可以参见下面两个链接。
用SystemImager克隆系统(一)
用SystemImager克隆系统(二)
注意:(在SystemImager(3.4以上)中,所有的命令都要加
上"si_",所以getimage将要写成si_getimage,
prepareclient要写成si_prepareclient,mkautoinstalldiskette写成
si_mkautoinstalldiskette等.)
软件要求:systemimager软件
下载
注意:systemimager是用perl编写的,所以要求一些perl模块。如AppConfig,MLDBM,XML-Simple,可以自己下载安装。
实验步骤:
前提是已经做完镜像
一,si_mkbootserver制作启动服务器
# 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...
/var/lib/tftpboot exists and is a symlink to /usr/share/systemimager/boot.
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... 3262.
Looking for update-inetd... not found.
Backing up /etc/xinetd.d/tftp...
Moving /etc/xinetd.d/tftp to /etc/xinetd.d/tftp.si_mkbootserver.bak1...done.
Restaring xinetd ...
停止 xinetd:                                              [确定]
启动 xinetd:                                              [确定]
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.
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]?
Backing up /var/lib/tftpboot/pxelinux.cfg...
Moving /var/lib/tftpboot/pxelinux.cfg to /var/lib/tftpboot/pxelinux.cfg.si_mkbootserver.bak24...done.
Copying /var/lib/tftpboot/X86PC/UNDI/linux-install/pxelinux.cfg to /var/lib/tftpboot/pxelinux.cfg...Ok, configuration complete.
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
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
Trying to probe your DNS domain. Please wait...
Type your response or hit  to accept [defaults].  If you don't
have a response, such as no first or second DNS server, just hit
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? []: changzi.centos
What is your network number? [192.168.1.0]:
What is your netmask? [255.255.255.0]:
What is the starting IP address for your dhcp range? [192.168.1.1]: 192.168.1.50
What is the ending IP address for your dhcp range? [192.168.1.254]: 192.168.1.80
What is the IP address of your first DNS server? []:
What is the IP address of your default gateway? [192.168.1.254]: 192.168.1.1
What is the IP address of your image server? [192.168.1.254]: 192.168.1.63
What is the IP address of your boot server? [192.168.1.254]: 192.168.1.63
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  to continue...
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:                          changzi.centos
Network number:                           192.168.1.0
Netmask:                                  255.255.255.0
Starting IP address for your DHCP range:  192.168.1.50
Ending IP address for your DHCP range:    192.168.1.80
First DNS server:                        
Second DNS server:                        
Third DNS server:                        
Default gateway:                          192.168.1.1
Image server:                             192.168.1.63
Boot server:                              192.168.1.63
Log server:                              
Log server port:                          
Flamethrower directory port:
Use tmpfs staging on client:              n
SSH files download URL:
#######################################################################

Are you satisfied? (y/[n]): y
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
关闭 dhcpd:                                               [确定]
启动 dhcpd:                                               [确定]
二,si_addclients加入主机名与IP对应
# si_addclients
笔者在此将主机名设置成www50-www80
对应的IP地址为192.168.1.50-192.168.1.80
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
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? []: changzi.centos
What is the hosts range that you want me to use? []: www50-www80


I will work with hostnames:  www50-www80
             in the domain:  changzi.centos

Are you satisfied? (y/[n]): y
si_addclients -- Section 2 (soft links to master script)
--------------------------------------------------------------------------------

Would you like me to create soft links to a "master" script so that hosts:

  www50-www80

can be autoinstalled with one of the available images? ([y]/n): y

Here is a list of available autoinstall scripts:

backup

Which script would you like these hosts to be installed with?
[backup]:

Your soft links have been created.

Press  to continue...
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: www50-www80

What is the IPs address range (e.g. 10.0.0.1-10.0.0.100,10.0.0.101)?
[]:192.168.1.50-192.168.1.80
I will work with IP addresses:  192.168.1.50-192.168.1.80
                and hostnames:  www50-www80

Are you satisfied? (y/[n]): y

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  to continue...

si_addclients: successfully completed.
三,si_mkclientnetboot制作启动媒介
  考虑到安装N台机器,如果量较大的话最好还是用PXE的方法,当然网卡要支持,如果不支持的话还是用USB或是CD制作启动媒介。所以笔者用来进行实验的是虚拟机。
# si_mkclientnetboot --netboot --clients www50-www80
[netboot] using the kernel and initrd.img for architecture: i386
[netboot] using the flavor: standard
以上在Server端已经完成工作了。
    在以上步骤中出现问题可以google一下,我遇到的问题无非是perl模块的一些东西,总之是缺少什么软件就下载安装什么软件。另外记得要把防火墙关掉。
最后一步是启动虚拟机。即可安装,速度还是很快的,我安装了两台虚拟机。
镜像大小:
# du -sh backup/
1.6G    backup/
服务器是P4 1.7/256M,100Mbits网络,另一台P4 2.8/1G装上两个虚拟机,每个分256M内存,同时进行安装,12分钟左右。
如有问题可以mailto:changzi100@yahoo.com.cn
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/56880/showart_1751691.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP