cobbler无人值守批量安装步骤

cobbler无人值守批量安装步骤

pxe kickstart自动装机原理:
PXE(prebootexecute environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由此支持通过网络启动操作系统,在启动过程中,终端要求服务器分配IP地址,再用TFTP(trivialfile transfer protocol)或MTFTP(multicast trivial file transfer protocol)协议下载一个启动软件包到本机内存中执行,由这个启动软件包完成终端(客户?)基本软件设置,从而引导预先安装在服务器中的终端操作系统。PXE可以引导多种操作系统,如:Windows95/98/2000/windows2003/windows2008/winXP/win7/win8,linux等。
在这里插入图片描述
在这里插入图片描述
原理图

Cobbler介绍
Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等。
Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。
Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。
Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack。
Cobbler集成的服务
PXE服务支持
DHCP服务管理
DNS服务管理(可选bind,dnsmasq)
电源管理
Kickstart服务支持
YUM仓库管理
TFTP(PXE启动时需要)
Apache(提供kickstart的安装源,并提供定制化的kickstart配置)

准备工作
centos7
虚拟机网络模式选择NAT模式(此机器之后用作dhcp服务器)
在这里插入图片描述
永远关闭selinux
在这里插入图片描述永久关闭firewall,清楚防火墙规则
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
在这里插入图片描述
iptables -L 列出所有规则
iptables -F 清除所有
在这里插入图片描述
reboot重启:
在这里插入图片描述
安装软件&下载镜像
#配置阿里云epel源‍
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
在这里插入图片描述

安装软件:
yum -y install cobbler cobbler-web dhcp tftp-serverpykickstart httpd xinetd debmirror
在这里插入图片描述
查看安装的文件,下面列出部分:
在这里插入图片描述
/etc/cobbler # 配置文件目录
/etc/cobbler/settings # cobbler主配置文件,这个文件是YAML格式,Cobbler是python写的程序。
/etc/cobbler/dhcp.template # DHCP服务的配置模板
/etc/cobbler/tftpd.template # tftp服务的配置模板
/etc/cobbler/rsync.template # rsync服务的配置模板
/etc/cobbler/iso # iso模板配置文件目录
/etc/cobbler/pxe # pxe模板文件目录
/etc/cobbler/power # 电源的配置文件目录
/etc/cobbler/users.conf # Web服务授权配置文件
/etc/cobbler/users.digest # 用于web访问的用户名密码配置文件
/etc/cobbler/dnsmasq.template # DNS服务的配置模板
/etc/cobbler/modules.conf # Cobbler模块配置文件
/var/lib/cobbler # Cobbler数据目录
/var/lib/cobbler/config # 配置文件
/var/lib/cobbler/kickstarts # 默认存放kickstart文件
/var/lib/cobbler/loaders # 存放的各种引导程序
/var/www/cobbler # 系统安装镜像目录
/var/www/cobbler/ks_mirror # 导入的系统镜像列表
/var/www/cobbler/images # 导入的系统镜像启动文件
/var/www/cobbler/repo_mirror # yum源存储目录
/var/log/cobbler # 日志目录
/var/log/cobbler/install.log # 客户端系统安装日志
/var/log/cobbler/cobbler.log # cobbler日志
在这里插入图片描述
下载CentOS-7-x86_64-DVD-1611.iso镜像:(我是将我的镜像上传上去的)

在这里插入图片描述
配置Cobbler
检查并修复cobbler配置
在这里插入图片描述
在这里插入图片描述
1 : The ‘server’ field in /etc/cobbler/settingsmust be set to something other than localhost, or kickstarting features willnot work. This should be a resolvablehostname or IP for the boot server as reachable by all machines that will useit.
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.
修改/etc/cobbler/settings中server和next_server的字段为本机IP,非回环地址
server: 10.0.0.41
next_server: 10.0.0.42
(next_server在278行,server在390行)
在这里插入图片描述
在这里插入图片描述
3 : change ‘disable’ to ‘no’ in/etc/xinetd.d/tftp
vim /etc/xinetd.d/tftp
在这里插入图片描述
4 : Some network boot-loaders are missingfrom /var/lib/cobbler/loaders, you may run ‘cobbler get-loaders’ to downloadthem, or, if you only want to handle x86/x86_64 netbooting, you may ensure thatyou have installed a recent version of the syslinux package installed and canignore this message entirely. Files inthis directory, should you want to support all architectures, should includepxelinux.0, menu.c32, elilo.efi, and yaboot. The ‘cobbler get-loaders’ commandis the easiest way to resolve these requirements.

cobbler get-loaders #下载引导程序
在这里插入图片描述

5 : enable and start rsyncd.service withsystemctl
在这里插入图片描述

Vi /etc/xinetd.d/rsync(注意:CentOS7中在/etc/xinetd.d/目录下没有rsync这个文件,需要创建并加入如下的参数,CentOS6中有rsync文件,只需修改即可)
在这里插入图片描述
service rsync
{
disable = no
flags = IPv6
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure = USERID
}
6 : comment out ‘dists’ on/etc/debmirror.conf for proper debian support
7 : comment out ‘arches’ on/etc/debmirror.conf for proper debian support
在这里插入图片描述

进去之后注释掉下面这两行:
#@dists=“sid”;
#@arches=“i386”;
在这里插入图片描述
8 : The default password used by the sampletemplates 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
更改默认密码openssl passwd -1 -salt ‘用户名’ ‘密码’
[root@localhost ~]# openssl passwd -1 -salt’alex’ ‘!#helpme7890…’
1 1 1alex$2twSRUAFWfyMoknusapse.
vi /etc/cobbler/settings
在这里插入图片描述
9 : fencing tools were not found, and arerequired to use the (optional) power management features. install cman orfence-agents to use them

yum install fence-agents
在这里插入图片描述
用Cobbler管理DHCP
vi /etc/cobbler/settings
manage_dhcp: 1
在这里插入图片描述
防止循环装系统,适用于服务器第一启动项是PXE启动
vi /etc/cobbler/settings
pxe_just_once: 1
在这里插入图片描述

重启再次检查没有任何问题出现!
配置DHCP
vi /etc/cobbler/dhcp.template
Syslinux安装&配置
yum install syslinux –y
cp /usr/share/syslinux/pxelinux.0/var/lib/tftpboot/
cp /mnt/CentOS-7-x86_64/isolinux//var/lib/tftpboot/
cp/mnt/CentOS-7-x86_64/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
导入&挂载镜像
mount -o loop/root/ISO/CentOS-7-x86_64-DVD-1611.iso /mnt/CentOS-7-x86_64/
cobbler import --path=/mnt/CentOS-7-x86_64/–name=CentOS-7.3-x86_64 --arch=x86_64
#–path 镜像路径
#–name 为安装源定义一个名字
#–arch 指定安装源是32位、64位、ia64, 目前支持的选项有:x86│x86_64│ia64
#安装源的唯一标示就是根据name参数来定义,本例导入成功后,安装源的唯一标示就是:CentOS-7.3-x86_64,如果重复,系统会提示导入失败。
cp -a /mnt/CentOS-7-x86_64/
/var/www/html/CentOS-7.3-x86_64/ #镜像文件存放到apache默认目录下
#查看安装镜像文件信息
制作yum仓库
Yum install createrepo
createrepo -pdo/var/www/html/CentOS-7.3-x86_64/ /var/www/html/CentOS-7.3-x86_64/
createrepo -g ls/var/www/html/CentOS-7.3-x86_64/repodata/*-comps.xml/var/www/html/CentOS-7.3-x86_64/
waiting…

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
对于Cobbler的无人安装部署,可以按照以下步骤进行操作: 1. 首先,确保你的系统满足Cobbler安装要求,包括适当的硬件配置和操作系统版本。 2. 安装Cobbler软件包。你可以通过包管理器(如yum或apt)来安装Cobbler。 3. 配置Cobbler。编辑Cobbler的配置文件(通常是/etc/cobbler/settings)来设置网络参数、存储路径、DHCP设置等。 4. 导入操作系统镜像。使用cobbler import命令将操作系统镜像导入Cobbler。你需要提供操作系统的ISO文件或网络安装源。 5. 定义系统配置文件。使用cobbler system命令创建系统配置文件,包括主机名、IP地址、MAC地址等信息。 6. 定义配置文件模板。根据你的需求,可以使用cobbler profile命令创建配置文件模板,并将其关联到系统配置文件上。 7. 配置DHCP服务。Cobbler可以自动配置DHCP服务器,以便客户端能够通过网络安装操作系统。 8. 启动Cobbler服务。使用systemctl或service命令启动Cobbler服务,并确保它在系统启动时自动启动。 9. 进行无人安装。现在,你可以使用cobbler system命令进行无人安装了。根据定义的系统配置文件,Cobbler将自动进行操作系统的安装。 请注意,以上只是一个概述,具体的步骤和命令可能会因为你的系统环境和需求而有所不同。建议你参考Cobbler的官方文档或相关资源,以获取详细的操作指南。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值