LINUX学习:PXE+DHCP+TFTP+Cobbler 无人值守安装CentOS 7
《LINUX学习:PXE+DHCP+TFTP+Cobbler 无人值守安装CentOS 7》要点: Cobbler(补鞋匠)是通过将DHCP、TFTP、DNS、HTTP等服务进行集成,创立一个中央管理节点,其可以实现的功能有配置服务,创立存储库,解压缩操作系统媒介,代理或集成一个配置管理系统,控制电源管理等. Cobbler的最终目的是实现无需进行人工干预即可安装机器. ? pxe概述 pxe客户端会挪用网际协议(ip)、用户数据报协议(udp)、动态主机设定协议(DHCP)、小型文件传输协议(TFTP) pxe客户端(client)指机器在pxe启动进程中的角色.一个pxe客户端可以是一台服务器、笔记本电脑或者其他装有pxe启动代码的机器 PXE主要是通过广播的方式发送一个包,并请注获取一个地址,而后交给TFTP法式下载一个引导文件. cobbler和Kickstart批量装机软件 ?Cobbler由python语言开发,是对PXE和Kickstart以及DHCP的封装.融合很多特性,提供了CLI和Web的管理形式.更加便利的实行网络安装.同时,Cobbler也提供了API接口,使用其它语言也很容易做扩展.它不紧可以安装物理机,同时也支持kvm、xen虚拟化、Guest OS的安装.更多的是它还能结合Puppet等集中化管理软件,实现自动化的管理. ? Kickstart 是一种无人值守的安装方式,它的工作原理是在安装过程中记录人工干预填写的各种参数,并生成一个名为ks.cfg的文件.我们可以简单理解为一个自动安装应答配置管理法式.通过读取这个配置文件,系统知道怎么去分区,要安装什么包,配什么IP,优化什么内核参数等等? ? 一句话总结:Cobbler补鞋匠是对Kickstart的封装,简化安装步调、使用流程,官方号称补鞋匠都能学会的批量装机. Cobbler 事情流程 server端: ? ? 第一步,启动Cobbler服务 正式情况准备: ? 1.网络环境:host-only、nat网络,因为Cobbler需要用到本身的dhcp服务器,所以为了防止都在同一个网络造成dhcp获取混乱,需要切换网络!~? ? 2.类似安装服务必要的环境准备:1,关闭iptables,selinux 2,配置静态IP、设置主机名 并且在hosts文件下绑定 3.时间同步 4.配置当地iso镜像里的yum仓库,163源epel源 (安装软件) cobbler server? ? -------? ? client 一.? 在cobbler server上安装cobbler ? yum install cobbler cobbler-web tftp* rsync xinetd http* syslinux dhcp* pykickstart ?报错办理:提示--skip-broken,检查发现自己yum源不全yum无法安装上面三个依赖包.补全yum源办理 安装完成,启动软件 [root@bokeyuan ~]# systemctl restart cobblerd.service 二.根本配置 [root@bokeyuan ~] # cobbler check
The following are potential configuration items that you may want to fix: ?
1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost,or kickstarting features will not work.? This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional,the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1,and should match the IP of the boot server on the PXE network.
3 : change 'disable' to 'no' in /etc/xinetd .d /tftp
4 : some network boot-loaders are missing from /var/lib/cobbler/loaders ,you may run 'cobbler get-loaders' to download them,or, if you only want to handle x86 /x86_64 netbooting,you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely.? Files in this directory,should you want to support all architectures,should include pxelinux.0,menu.c32,elilo.efi,and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
5 : enable and start rsyncd.service with systemctl
6 : debmirror package is not installed,it will be required to manage debian deployments and repositories 7 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings ) is still set to 'cobbler' and should be changed,try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
8 : fencing tools were not found,and are required to use the (optional) power management features. install cman or fence-agents to use them
?
Restart cobblerd and then run 'cobbler sync' to apply changes.
?一步步办理上述需求,部分需求可忽略.个体差异不同 每个人需求数量也不同,基本上大同小异 解决需求1、2、7 # vim /etc/cobbler/settings 办理需求5 #systemctl restart rsyncd.service #systemctl enable? rsyncd.service 办理需求8 4 : some network boot-loaders are missing from /var/lib/cobbler/loaders,you may run 'cobbler get-loaders' to download them,if you only want to handle x86/x86_64 netbooting,you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely.? Files in this directory,and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements. (问题4可以使用cobbler get-loaders办理,但需要有外网和外网的yum源 跳过,现在是NAT模式;问题6 是关于debian系统的,我们这里可以忽略) 末了# systemctl restart cobblerd.service 重起下cobbler补鞋匠服务! 三.导入centos7.3的iso镜像 我的环境iso镜像挂载在/yum目录,此拷贝步调时间较长 [root@bokeyuan ~]# cobbler import --path=/yum/ --name=centos7.3 task started: 2017-09-03_175701_import task started (id=Media import,time=Sun Sep 3 17:57:01 2017) Found a candidate signature: breed=RedHat,version=rhel6 Found a candidate signature: breed=redhat,version=rhel7 Found a matching signature: breed=redhat,version=rhel7 Adding distros from path /var/www/cobbler/ks_mirror/centos7.3: creating new distro: centos7.3-x86_64 trying symlink: /var/www/cobbler/ks_mirror/centos7.3 -> /var/www/cobbler/links/centos7.3-x86_64 creating new profile: centos7.3-x86_64 associating repos checking for rsync repo(s) checking for rhn repo(s) checking for yum repo(s) starting descent into /var/www/cobbler/ks_mirror/centos7.3 for centos7.3-x86_64 processing repo at : /var/www/cobbler/ks_mirror/centos7.3 need to process repo/comps: /var/www/cobbler/ks_mirror/centos7.3 looking for /var/www/cobbler/ks_mirror/centos7.3/repodata/*comps*.xml Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos7.3/repodata *** TASK COMPLETE ***?
# vim /etc/cobbler/settings? ?--再去修改这个配置文件,改成dhcp服务由cobbler来管理 下面的cobbler sync 很重要,如果这步报错必定要排出来,就经验来说这步出错一般是IP配置出错,记得细心一点,个体差异不用就不详细表述~ # cobbler sync # systemctl restart xinetd.service 六.新建另一个虚拟机 选择网络安装PXE (保证相同私有网络,而且最好2G内存,内存小的话会在安装时报空间不够的错误),进行安装测试 安装完成后,变动boot引导 更多详情见请继续阅读下一页的出色内容: _baidu_page_break_tag_自动安装我们已经实现了,但如何自定义我们想安装的profile 本文永远更新链接地址: 学习更多LINUX教程,请查看站内专栏,如果有LINUX疑问,可以加QQ交流《LINUX学习:PXE+DHCP+TFTP+Cobbler 无人值守安装CentOS 7》。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |