[size=medium]自动化管理是每个linux管理员的必修课,特别是当管理的linux服务器多到一定数量时。有很多自动化:
使得机器自动构建 (Teach machines to build themselves)
使得机器自监控(Teach machines to watch themselves)
使得机器自修复(Teach machines to fix themselves)
最近研究一下linux自动部署,先从传统的 RedHat 提供的 Kickstart Installations 自动安装解决方案开始,再研究下前不久推出的 [url=https://fedorahosted.org/cobbler/]Cobbler[/url] 。
系统环境:CentOS 5、Apache2
[/size]
[size=large]1、生成 ks.cfg 配置文件[/size]
[size=medium]ks.cfg可以由GUI程序system-config-kickstart生成,如果你知道每行配置的意思的话,完全可以自己写一个ks.cfg文件。这里介绍system-config-kickstart生成的方法,毕竟没必要记忆的东西可以少花些时间。[color=red]这个过程可以在任意有桌面的 redhat 系统完成,我们最后只需要那个 ks.cfg 文件。[/color]
安装system-config-kickstart:[/size]
[size=medium]根据 [url=http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/ch-redhat-config-kickstart.html]redhat官方 Kickstart Configurator[/url] 创建 ks.cfg 配置文件:
GUI模式的终端执行 system-config-kickstart 弹出如下窗口,根据官方 Kickstart Configurator的介绍与你的实际情况填写。[/size]
[img]http://dl.iteye.com/upload/attachment/230230/4b4e7b2a-c2c0-3cdd-abdb-053afe92d6d5.png[/img]
[size=medium][color=red]这里要特别注意的是Installation Method,指定安装源,可以是CD-ROM、NFS、FTP、HTTP、Hard Drive。我选择从本地CD-ROM安装。[/color]Network Configuration最好使用DHCP。[/size]
[img]http://dl.iteye.com/upload/attachment/230235/d889245a-45e8-3cba-a854-b082bee6b531.png[/img]
[size=medium]最后点击File-->Save保存ks.cfg文件并上传到你的apache web server根目录下(如:/var/www/html),并确认能访问到(我的是http://192.168.56.102/ks.cfg)。部署系统时要用到。[/size]
[size=large]2、部署redhat linux[/size]
[size=medium]在要安装操作系统的机器上放入redhat的光盘,在"boot:"后输入以下内容后回车(http://192.168.56.102/ks.cfg为你存放ks.cfg的web server)。ks.cfg也可以存放到nfs、ftp、软盘等上面,具体配置可以看[url=http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/s1-kickstart2-startinginstall.html]官方 Starting a Kickstart Installation[/url]:[/size]
[size=medium][color=red]之后系统会用dhcp获取一个IP并到web server下载ks.cfg文件,如果你没有DHCP也没事,获取IP失败后系统会提示你是否要手动设置IP,这时可以手动设置IP即可。[/color]下载ks.cfg后系统会根据cfg内容来配置系统,并且决定安装源是CD-ROM、NFS、FTP还是HTTP等。并根据cfg的内容询问你未指定的部分。完成相应操作后系统便安装完成了。[/size]
[size=large]3、其他[/size]
[size=medium][url=http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/index.html]Redhat的官方手册[/url]
这里只是简化了安装步骤,并没完全自动化。把安装源放到web server、ftp或nfs上再结合PXElinux就可以实现远程自动部署redhat。具体可以参考:[url=http://linux.chinaunix.net/bbs/viewthread.php?tid=191900]Kickstart+HTTP+DHCP+TFTP+PXElinux实现RedHat的网络自动安装[/url][/size]
使得机器自动构建 (Teach machines to build themselves)
使得机器自监控(Teach machines to watch themselves)
使得机器自修复(Teach machines to fix themselves)
最近研究一下linux自动部署,先从传统的 RedHat 提供的 Kickstart Installations 自动安装解决方案开始,再研究下前不久推出的 [url=https://fedorahosted.org/cobbler/]Cobbler[/url] 。
系统环境:CentOS 5、Apache2
[/size]
[size=large]1、生成 ks.cfg 配置文件[/size]
[size=medium]ks.cfg可以由GUI程序system-config-kickstart生成,如果你知道每行配置的意思的话,完全可以自己写一个ks.cfg文件。这里介绍system-config-kickstart生成的方法,毕竟没必要记忆的东西可以少花些时间。[color=red]这个过程可以在任意有桌面的 redhat 系统完成,我们最后只需要那个 ks.cfg 文件。[/color]
安装system-config-kickstart:[/size]
rpm -qa|grep kickstart
#如果没安装请先安装
yum install -y system-config-kickstart
[size=medium]根据 [url=http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/ch-redhat-config-kickstart.html]redhat官方 Kickstart Configurator[/url] 创建 ks.cfg 配置文件:
GUI模式的终端执行 system-config-kickstart 弹出如下窗口,根据官方 Kickstart Configurator的介绍与你的实际情况填写。[/size]
[img]http://dl.iteye.com/upload/attachment/230230/4b4e7b2a-c2c0-3cdd-abdb-053afe92d6d5.png[/img]
[size=medium][color=red]这里要特别注意的是Installation Method,指定安装源,可以是CD-ROM、NFS、FTP、HTTP、Hard Drive。我选择从本地CD-ROM安装。[/color]Network Configuration最好使用DHCP。[/size]
[img]http://dl.iteye.com/upload/attachment/230235/d889245a-45e8-3cba-a854-b082bee6b531.png[/img]
[size=medium]最后点击File-->Save保存ks.cfg文件并上传到你的apache web server根目录下(如:/var/www/html),并确认能访问到(我的是http://192.168.56.102/ks.cfg)。部署系统时要用到。[/size]
[size=large]2、部署redhat linux[/size]
[size=medium]在要安装操作系统的机器上放入redhat的光盘,在"boot:"后输入以下内容后回车(http://192.168.56.102/ks.cfg为你存放ks.cfg的web server)。ks.cfg也可以存放到nfs、ftp、软盘等上面,具体配置可以看[url=http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/s1-kickstart2-startinginstall.html]官方 Starting a Kickstart Installation[/url]:[/size]
linux ks=http://192.168.56.102/ks.cfg
[size=medium][color=red]之后系统会用dhcp获取一个IP并到web server下载ks.cfg文件,如果你没有DHCP也没事,获取IP失败后系统会提示你是否要手动设置IP,这时可以手动设置IP即可。[/color]下载ks.cfg后系统会根据cfg内容来配置系统,并且决定安装源是CD-ROM、NFS、FTP还是HTTP等。并根据cfg的内容询问你未指定的部分。完成相应操作后系统便安装完成了。[/size]
[size=large]3、其他[/size]
[size=medium][url=http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/index.html]Redhat的官方手册[/url]
这里只是简化了安装步骤,并没完全自动化。把安装源放到web server、ftp或nfs上再结合PXElinux就可以实现远程自动部署redhat。具体可以参考:[url=http://linux.chinaunix.net/bbs/viewthread.php?tid=191900]Kickstart+HTTP+DHCP+TFTP+PXElinux实现RedHat的网络自动安装[/url][/size]