SystemImager自动化安装Linux系统(上)

简介:
SystemImager”
 
通常人们在安装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-Simpleperl-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(下)>>





     本文转自yjlsy 51CTO博客,原文链接: http://blog.51cto.com/baidu/294329 ,如需转载请自行联系原作者



相关文章
|
27天前
|
人工智能 自然语言处理 数据挖掘
企业数字化转型的关键:如何利用OA系统实现自动化与智能决策
在数字化时代,传统办公系统已无法满足现代企业的需求。通过将RPA(机器人流程自动化)和AI(人工智能)技术与OA系统结合,企业能实现业务流程自动化、智能决策支持,大幅提升工作效率和资源配置优化,推动数字化转型。RPA可自动处理重复任务,如审批、数据同步等;AI则提供智能数据分析、预测和决策支持,两者协同作用,助力财务管理、人力资源管理、项目管理和客户服务等多个领域实现智能化升级。未来,智能化OA系统将进一步提升个性化服务、数据安全和协作能力,成为企业发展的关键驱动力。
|
2天前
|
Linux
Linux系统之whereis命令的基本使用
Linux系统之whereis命令的基本使用
45 23
Linux系统之whereis命令的基本使用
|
19天前
|
监控 运维
HTTPS 证书自动化运维:https证书管理系统- 自动化监控
本文介绍如何设置和查看域名或证书监控。步骤1:根据证书状态选择新增域名或证书监控,线上部署推荐域名监控,未部署选择证书监控。步骤2:查询监控记录详情。步骤3:在详情页查看每日定时检测结果或手动测试。
HTTPS 证书自动化运维:https证书管理系统- 自动化监控
|
19天前
|
Linux 持续交付 调度
HTTPS 证书自动化运维:https证书管理系统-自动化部署
本指南介绍如何部署Linux服务器节点。首先复制生成的Linux脚本命令,然后将其粘贴到目标服务器上运行。接着刷新页面查看节点记录,并点击“配置证书”选择证书以自动部署。最后,节点部署完成,后续将自动调度,无需人工干预。
HTTPS 证书自动化运维:https证书管理系统-自动化部署
|
4天前
|
Ubuntu Java Linux
Linux 安装 Qualcomm ® SnapdragonTM Profiler
通过本文的详细介绍,您应该已经成功在 Linux 系统上安装并配置了 Qualcomm® Snapdragon™ Profiler,并能够连接 Android 设备进行性能分析。Snapdragon Profiler 提供了丰富的工具和功能,可以帮助开发者深入了解应用程序的性能瓶颈,从而进行优化。希望本文能对您有所帮助,让您在开发过程中更高效地使用 Snapdragon Profiler 进行性能分析和优化。
32 10
|
6天前
|
Linux
Linux安装svn并启动
Linux安装svn并启动
40 10
|
27天前
|
缓存 安全 Linux
Linux系统查看操作系统版本信息、CPU信息、模块信息
在Linux系统中,常用命令可帮助用户查看操作系统版本、CPU信息和模块信息
96 23
|
19天前
|
运维 监控 数据安全/隐私保护
HTTPS 证书自动化运维:HTTPS 证书管理系统之使用指南
本文详细介绍【灵燕空间HTTPS证书管理系统】(https://www.lingyanspace.com)的配置与使用,涵盖注册账户、邮箱配置及证书自动签发、监控和部署的一体化指南。通过页面顶部菜单的【视频教程】和【图文教程】,帮助用户从注册到实际应用全面掌握系统操作。最新迭代后,泛域名证书已包含根域名,无需额外申请多域名证书。
|
1月前
|
Oracle 关系型数据库 Linux
linux8安装oracle 11g遇到的问题记录
Oracle 11g在Linux 8上安装时会遇到link编译环节的问题。官方建议忽略安装中的链接错误,安装完成后应用DBPSU 11.2.0.4.240716补丁及一次性补丁33991024,再重新编译二进制文件,并配置监听器和数据库。但因11g已退出服务期,这些补丁需付费获取。网上信息显示22年1月的PSU补丁也可解决问题,找到该补丁后按常规方式打补丁即可。如有需求或疑问可咨询我。
65 20
|
25天前
|
弹性计算 运维 Ubuntu
os-copilot在Alibaba Cloud Linux镜像下的安装与功能测试
我顺利使用了OS Copilot的 -t -f 功能,我的疑惑是在换行的时候就直接进行提问了,每次只能写一个问题,没法连续换行更有逻辑的输入问题。 我认为 -t 管道 功能有用 ,能解决环境问题的连续性操作。 我认为 -f 管道 功能有用 ,可以单独创建可连续性提问的task问题。 我认为 | 对文件直接理解在新的服务器理解有很大的帮助。 此外,我还有建议 可以在非 co 的环境下也能进行连续性的提问。
67 7

热门文章

最新文章