SystemImager”(下)
在《自动安装Linux系统之“SystemImager”》中,我们已经完成镜像服务器和黄金客户端的安装并成功的制作了一份黄金客户端镜像。本文接下来介绍如何配置镜像服务器和要安装系统的客户端,最终完成客户端的自动安装。
SystemImager支持从PXE、CD、USB或硬盘等方法完成自动安装操作系统,这里主要介绍使用PXE方式安装。这就需要安装DHCP服务器来给客户端提供IP地址以及其它信息;安装TFTP服务器完成客户端使用TFTP协议下载引导文件并执行。
在镜像服务器上,依次执行如下命令完成DHCP和TFTP的安装:

[root@ localhost Server]# rpm -ivh dhcp-3.0.5-13.el5.i386.rpm
[root@ localhost Server]# rpm -ivh tftp-server-0.42-3.1.i386.rpm

4、配置SystemImager服务
SystemImager提供了si_mkbootserver命令,利用交互的方式可以帮助我们自动的完成镜像服务器网络启动服务器的安装和配置。主要包括PxeLinux、TFTP和DHCP等服务的配置。在整个过程中会自动执行测试功能用于检查配置是否正常,如果发现错误会宣告失败并生成错误日志,根据错误提示能够方便用户快速的更正错误。
(1)执行si_mkbootserver命令后,提示我们这个脚本将要修改的配置文件以及重新启动的服务,输入“y”继续。
[root@localhost ~]# si_mkbootserver   
WARNING: this script may modifythe following files:  
--> /etc/services
--> /etc/inetd.conf
--> /etc/xinetd.d/tftp
Andcan restart inetd, xinetd ortftp servers.  
Do you wish tocontinue(y/[n])? y  
Ok, continuing...  
Checking fora tftp server... found.  
Checking if tftp server isH. Peter Anvin's tftp server... yup - righton!  
Checking fora running inetd... Notfound.  
Checking fora running xinetd... 16428.  
Looking forupdate-inetd... notfound.  
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 fora tftp client... found.  
Checking forloopback interface... up.  
Does tftp server work... yes.  
Looking fora pxe daemon... which: nopxe in(/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin)  
notfound. 
 (2)接下来,将要为BootServer配置Pxe,在询问“pxelinux bootloader”路径时,由于“/usr/lib/syslinux/pxelinux.0”路径是syslinux安装后的默认路径,直接回车即可。
WARNING: your bootserver will be configured without a pxe daemon!  
(ignorethis warning if you're using a recent distro)  
done.  
What isthe path tothe 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 torun si_mkdhcpserver toconfigure your DHCP server ([y]/n)? y  输入“y”
Welcome tothe SystemImager "si_mkdhcpserver"command.  This command will  
preparethis computer tobe a DHCP server bycreating a dhcpd.conf file  
foruse withyour ISC DHCP server (v2 orv3).  
If there isan existing file, it will be backed up withthe   
.beforesystemimager extension.  
Continue? (y/[n]): y 
(4)程序使用了交互式的方式,询问你使用的DHCP软件包的版本、配置文件名称、输入域名、网段、子网掩码、地址池等信息,根据实际环境填写。
Trying to probe your DNS domain. Please wait...  
Type your response orhit <Enter> toaccept [defaults].  If you don't  
have a response, such asnofirstorsecondDNS server, just hit   
<Enter> andnone will be used.  
What isyour DHCP daemon major version number (2 or3)? [3]:   
What isthe nameofyour DHCP daemon config file? [/etc/dhcpd.conf]:   
What isyour domain name? [localdomain]:   
What isyour network number? [192.168.1.0]: 172.16.0.0  
What isyour netmask? [255.255.0.0]:   
What isthe starting IP address foryour dhcp range? [172.16.0.1]: 172.16.0.11  
What isthe ending IP address foryour dhcp range? [172.16.255.254]: 172.16.0.200  
What isthe IP address ofyour firstDNS server? []:   
What isthe IP address ofyour defaultgateway? [172.16.255.254]: 172.16.0.1  
What isthe IP address ofyour image server? [172.16.255.254]: 172.16.0.10  
What isthe IP address ofyour boot server? [172.16.255.254]: 172.16.0.10  
What isthe IP address ofyour log server? []:   
Use tmpfs staging onclient?  (If unsure, choose "n") [n]:   
Do you want touse Flamethrower (multicast) toinstall your clients? [n]:   
What... isthe air-speed velocity ofan unladen swallow? []:   
Wrong!!! (witha Monty Python(TM) accent...)  
Press <Enter> tocontinue... 
(5)下图中列出了你刚刚填写的信息,确认无误后,输入“y”完成配置。
Ahh, but seriously folks...  
Here are the valuesyou 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 foryour DHCP range:  172.16.0.11  
Ending IP address foryour DHCP range:    172.16.0.200  
FirstDNS server:                           
SecondDNS server:                          
Third DNS server:                           
Defaultgateway:                          []  
Image server:                             172.16.0.10  
Boot server:                              172.16.0.10  
Log server:                                 
Log server port:                            
Flamethrower directory port:                
Use tmpfs staging onclient:              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 foryou.  Please verify it foraccuracy.  
If this file does notlook satisfactory, you can run this command again  
tore-createit: "si_mkdhcpserver"
WARNING!:  If you have multiple physical network interfaces, be sure to
edit the init script that starts dhcpd tospecify the interface that   
isconnected toyour DHCP clients.  Here's an example:  
Change "/usr/sbin/dhcpd"to"/usr/sbin/dhcpd eth1".  
Depending onyour distribution, you may be able tosetthis withthe   
"INTERFACES"variable in"/etc/default/dhcp", "/etc/default/dhcp3-server",  
orsimilar, orinyour dhcpd initialization script ("/etc/init.d/dhcpd",   
"/etc/init.d/dhcp3-server", orsimilar).  
Also, be sure tostart orrestart your dhcpd daemon.  This can usually  
be done witha command like"/etc/init.d/dhcpd restart"orsimilar.  
Would you likeme torestart 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 tothe SystemImager "si_addclients"utility    
--------------------------------------------------------------------------------
This utility has 3 sections.    
"Section 1"will ask you foryour hostname information.  
"Section 2"will allow you tocreatesoftlinks fromeach client hostname to
your "master"script inthe "/var/lib/systemimager/scripts"directory.    
Example: www297.sh -> web_server_image_v1.master  
"Section 3"will ask you forIP address information that will be combined   
withthe hostname information provided inSectiontocreateentries in
"/etc/hosts"foreach ofthese same clients.  New entries will be appended   
tothe endof"/etc/hosts".  If you specify new hostnames forexisting IP   
addresses, those entries will be re-written inplace toreflect the new   
host names.  
Continue? ([y]/n): y   #输入“y”,继续。
(8)在si_addclients的第一个配置部分,需要指出自动安装节点的主机名称样式。一个主机范围的字段和一个域名用来定义我们要自动安装的节点的主机名;
si_addclients -- Section 1 (hostname information)  
--------------------------------------------------------------------------------
The nextseries ofquestions will be used tocreatea range ofhostnames.    
You will be asked foryour domain name, the base host name, a beginning   
number, andan ending number.  
Forexample, if you answer:  
domain name= systemimager.org  
host range      = www7-www11,www20  
Thenthe result will be a series ofhostnames that looks likethis:  
www7.systemimager.org  
www8.systemimager.org  
www9.systemimager.org  
www10.systemimager.org  
www11.systemimager.org  
www20.systemimager.org  
What isyour domain name? []: vfast.com  
What isthe hosts range that you want me touse? []: node11-node200  
I will workwithhostnames:  node11-node200  
inthe domain:  vfast.com  
Are you satisfied? (y/[n]): y 
(9)在第二个配置部分,将前一部分定义的节点映射到到镜像;
si_addclients -- Section 2 (soft links to master script)  
--------------------------------------------------------------------------------
Would you likeme tocreatesoft links toa "master"script so that hosts:  
node11-node200  
can be autoinstalled withone ofthe available images? ([y]/n): y  
Here isa list ofavailable autoinstall scripts:  
vfast_backup   
Which script would you likethese hosts tobe installed with?  
[vfast_backup]:   
Your soft links have been created.  
Press <Enter> tocontinue... 
(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 tobe able todetermine their host names fromtheir  
IP addresses, unless their host nameisspecified ina local.cfg file.    
The preferred method fordoing this iswithDNS.  If you have a working DNS   
that has IP address tohostname resolution properly configured foryour   
target machines, thenanswer "n"here.  
If you don't have a working DNS, oryou want tooverride the information in
DNS, thenanswer "y"here toaddentries tothe "/etc/hosts"file onyour  
image server.  Afteradding these entries, the /etc/hosts file will be   
copied to"/var/lib/systemimager/scripts"whereit can be retrieved byyour   
target machines.  
I will ask you foryour clients' IP addresses one subnet ata time.  
Would you likeme tocontinue? (y/[n]): y  
si_addclients -- Section 3 (adding or modifying /etc/hosts entries -- continued...)
--------------------------------------------------------------------------------
Hostnames range is: node11-node200  
What isthe 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 workwithIP addresses:  172.16.0.11-172.16.0.200  
andhostnames:  node11-node200  
Are you satisfied? (y/[n]): y  
Use ofuninitialized value inconcatenation (.) orstring 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 foruse byyour auto-install clients.  
Press <Enter> tocontinue...  
si_addclients: successfully completed. 
(11)执行si_mkclientnetboot 来制作多台要克隆机器通过网络安装的对应启动介质:
[root@localhost ~]# si_mkclientnetboot --netboot --clients node11-node200  
[netboot] using the kernel andinitrd.img forarchitecture: 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 forsystemimager: already running.  
[root@localhost ~]# chkconfig systemimager-server-rsyncd on
[root@localhost ~]# chkconfig dhcpd on
[root@localhost ~]# chkconfig xinetd on
5、克隆操作系统
最后设置客户端BIOS选择从网卡启动。具体方法因BIOS版本不同而异。

网卡中的PXE代码会联系DHCP服务器来获取IP地址以及启动镜像,然后启动镜像被载入并运行。
     本文转自yjlsy 51CTO博客,原文链接:http://blog.51cto.com/baidu/309457,如需转载请自行联系原作者

SystemImager自动化安装Linux系统(下)相关推荐

  1. linux自动化安装linux系统,Linux下—自动化boot引导安装linux系统安装-Go语言中文社区...

    系统光盘中isolinux目录列表 1.solinux.bin:光盘引导程序,在mkisofs的选项中需要明确给出文件路径,这个文件属于SYSLINUX项目 2.isolinux.cfg: isoli ...

  2. PXE+KickStart自动化安装Linux系统

     PXE+kickstart模式自动安装系统  PXE介绍 预启动执行环境(Preboot eXecution Environment,PXE)也被称为预执行环境,提供了一种使用网络接口(Netw ...

  3. cobbler自动化安装Linux系统

    cobbler简介 Cobbler是一个Linux服务器快速网络安装的服务,而且在经过调整也可以支持网络安装windows.该工具使用python开发,小巧轻便(才15k行python代码),可以通过 ...

  4. linux系统qt中make安装,Linux系统下Qt的基本安装和配置

    Qt Creator支持中文,启动速度比Eclipse.Netbeans更快,界面也更美观,跟输入法Fcitx协作良好(光标跟随). 你既可以把Qt Creator当代码编辑器作为vim辅助,好处在于 ...

  5. 简书 u盘安装linux,Linux基础之自动化安装Linux系统第三篇

    简介 这一篇本地安装CentOS6.9 当然也不需要用到FTP服务器和网络源了 所以就有点麻烦了需要修改很多地方 所以这一篇会有点多,要耐心看啊,当然我也要耐心的写 下一篇就开始说全自动网络安装了,但 ...

  6. 【Linux】使用U盘自动化安装Linux(VMware虚拟机)

    文章目录 前言 一.准备 二.新建虚拟机 2.1 创建虚拟机 2.2 新增硬盘 2.3 系统启动项 三.加电运行 四.EFI方式 五.总结 前言 一.准备 基于之前的基础[Linux]Kickstar ...

  7. Linux下添加计划任务,Linux系统下使用crontab添加计划任务的方法

     在服务器中添加定期执行的任务,在很多情况下是非常必要的.比如,每天清理一次/tmp目录下的文件;没几分钟检查某一守护进程是否正常等等.这样计划任务就显得尤为方便.下面将介绍如何在Linux系统中 ...

  8. OK6410开发板学习之安装linux系统至开发板

    说来惭愧,OK6410开发板自从买来就一直在躺灰,当时连教程也花了1千多大洋了,近来感觉前途迷茫,遂决定将其拿出来研究研究,看是否能够给我新出路. 废话不多说,先上一张OK6410开发板大图: 不要问 ...

  9. vm虚拟机下linux安装python_VM中安装linux系统,安装VS Code,搭建Python环境

    VM中安装linux系统 在linux系统中安装VSCode(Visual Studio Code) 1.从官网下载安装包 2.在下载目录打开终端安装 sudo dpkg -i code_1.32.3 ...

最新文章

  1. Java 8 vs. Scala之Lambda表达式
  2. C语言——常见的字符串函数+内存操作函数的介绍及实现
  3. JAVA——Scanner读取文件
  4. java简单计算机程序_JAVA程序编的简单计算器程序??
  5. sql server修改字段编码格式_关于MySQL如何修改character_set_client的编码问题
  6. labelme进行mask图像标注
  7. .net remoting与web service的区别
  8. MBA 案例:一个叫花子做的策划
  9. [Bzoj3252]攻略(dfs序+线段树)
  10. Collection __NSArrayM: 0xxxxxxx was mutated while being enumerated.
  11. 旅行商问题近似解——NP完全问题
  12. B,KB,MB,GB之间换算
  13. VMware Workstation 16.2.4 Pro
  14. 2021苹果最新供应链名单公布
  15. 我如何学会欣赏求职者
  16. Windows系统和Mac OS系统的免费FTP客户端有哪些?
  17. 计算机专业个人简历表格模板
  18. Gibbs Sampling\吉布斯采样(一)
  19. 企业公众号文章写作方向要从这几个方面着手
  20. yolov3算法模型P-R曲线绘制教程(python2,python3)

热门文章

  1. 科技公司高管职位知多少?(转)
  2. Hadoop HDFS文件操作的Java代码
  3. Windows系统“无法打开”故障解决方法之一
  4. 版本控制(译文)-5 (连载)
  5. 【VIOLA】宁可食无肉,不可居无竹
  6. 标准爬虫初探,来自Python之父的大餐!
  7. Redis 通用操作1
  8. 博为峰JavaEE技术文章 ——MyBatis 注解
  9. Windows Server 2008 R2使用LDP恢复已删除的用户实战
  10. 结课作业:云计算在物联网中的应用发展