Linux自动化安装cobbler
1介绍
1.1 PXE
PXE技术与RPL技术不同之处为RPL是静态路由,PXE是动态路由。RPL是根据网卡上的ID号加上其他记录组成的一个Frame(帧)向服务器发出请求。而服务器中已有这个ID数据,匹配成功则进行远程启动。PXE则是根据服务器端收到的工件站MAC地址,使用DHCP服务为这个MAC地址指定个IP地址。每次启动可能同一台工作站有与上次启动有不同的IP,即动态分配地址。下以客户端引导过程说明PXE的原理:
客户端开机后,PXE BootROM(自启动芯片)获得控制权之前执行自我测试,然后以广播形式发出一个请求FIND帧。如果服务器收到客户端所送出的要求,就会送回DHCP回应,包括用户端的IP地址、预设通信通道,以及开机映像文件;否则服务器会忽略这个要求。
客户端收到服务器发回的响应后则会回应一个帧,以请求传送启动所需文件,并把自己的MAC地址写到服务器端的Netnames.db文件中。将有更多的消息在客户端与服务器之间应答,用于决定启动参数。
BootROM由TFTP通信协议从服务器下载开机映像文档。
客户端使用TFTP协议接收启动文件后,将控制权转交启动块以引导操作系统,完成远程启动。
1.2 KickStart
KickStart是一种无人职守安装方式。KickStart的工作原理是通过记录典型的安装过程中所需人工干预填写的各种参数,并生成一个名为ks.cfg的文件;在其后的安装过程中(不只局限于生成KickStart安装文件的机器)当出现要求填写参数的情况时,安装程序会首先去查找KickStart生成的文件,当找到合适的参数时,就采用找到的参数,当没有找到合适的参数时,才需要安装者手工干预。这样,如果KickStart文件涵盖了安装过程中出现的所有需要填写的参数时,安装者完全可以只告诉安装程序从何处取ks.cfg文件,然后去忙自己的事情。等安装完毕,安装程序会根据ks.cfg中设置的重启选项来重启系统,并结束安装。
1.3 Cobbler
Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows。该工具使用python开发,小巧轻便(才15k行python代码),使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP、DNS、以及yum仓库、构造系统ISO镜像。
Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用。
Cobbler客户端Koan支持虚拟机安装和操作系统重新安装,使重装系统更便捷。
Cobbler提供以下服务集成:
* PXE服务支持
* DHCP服务管理
* DNS服务管理
* 电源管理
* Kickstart服务支持
* yum仓库管理
2 安装部署
2.1相关文件
1.Cobbler配置文件目录:/etc/cobbler
/etc/cobbler/settings #cobbler主配置文件
/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模块配置文件
2.Cobbler数据目录:/var/lib/cobbler
/var/lib/cobbler/config #配置文件
/var/lib/cobbler/triggers #Cobbler命令
/var/lib/cobbler/kickstarts #默认存放kickstart文件
/var/lib/cobbler/loaders #存放的各种引导程序
3.系统安装镜像目录:/var/www/cobbler
/var/www/cobbler/ks_mirror #导入的系统镜像列表
/var/www/cobbler/images #导入的系统镜像启动文件
/var/www/cobbler/repo_mirror #yum源存储目录
4.日志目录:/var/log/cobbler
/var/log/cobbler/install.log #客户端系统安装日志
/var/log/cobbler/cobbler.log #cobbler日志
2.2 Cobbler安装
2.2.1安装EPEL源
yum install epel-release
2.2.2安装cobbler
yum install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes cman pykickstart –y
2.2.3配置cobbler
vim /etc/cobbler/settings #Cobbler主配置文件
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings
sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings
# set to 1 to enable Cobbler's DHCP management features.
# the choice of DHCP management engine is in /etc/cobbler/modules.conf
manage_dhcp: 1
# set to 1 to enable Cobbler's RSYNC management features.
manage_rsync: 1
# if using cobbler with manage_dhcp, put the IP address
# of the cobbler server here so that PXE booting guests can find it
# if you do not set this correctly, this will be manifested in TFTP open timeouts.
next_server: 192.168.56.6
# this is the address of the cobbler server -- as it is used
# by systems during the install process, it must be the address
# or hostname of the system as those systems can see the server.
# if you have a server that appears differently to different subnets
# (dual homed, etc), you need to read the --server-override section
# of the manpage for how that works.
server: 192.168.56.6
2.2.4关闭SELinux、iptables
getsebool
service iptables stop
chkconfig iptables off
2.2.5配置tftp、rsync
设置 'disable' 为 'no'
sed -i '/disable/c\\tdisable\t\t\t= no' /etc/xinetd.d/tftp
sed -i 's/\=\ yes/\=\ no/g' /etc/xinetd.d/rsync
2.2.6启用wsgi模块
sed -i 's@#LoadModule@LoadModule@g' /etc/httpd/conf.d/wsgi.conf
2.2.7生成密码
这里生成密钥和配置默认密钥,ks文件引用
openssl passwd -1 -salt 'random-phrase-here' 'wq'
$1$random-p$29HCOY0msGT.4xVuIl6Gp.
加入cobbler配置
vim /etc/cobbler/settings
grep default_password_crypted /etc/cobbler/settings#修改为如下配置
default_password_crypted: "$1$random-p$29HCOY0msGT.4xVuIl6Gp."
2.2.8配置DHCP
vim /etc/cobbler/dhcp.template
allow booting;
allow bootp;
ddns-update-style interim;
ignore client-updates;
subnet 192.168.56.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.56.100 192.168.56.254;
option domain-name-servers 192.168.0.1;
option routers 192.168.56.1;
option subnet-mask 255.255.255.0;
default-lease-time 1800;
max-lease-time 3600;
next-server 192.168.56.6;
filename "pxelinux.0";
}
2.2.9配置服务
/sbin/service httpd start
/sbin/service dhcpd start
/sbin/service xinetd start
/sbin/service cobblerd start
/sbin/chkconfig httpd on
/sbin/chkconfig dhcpd on
/sbin/chkconfig xinetd on
/sbin/chkconfig tftp on
/sbin/chkconfig cobblerd on
2.2.10引导系统文件
cobbler get-loaders
2.2.11配置debmiror(可选)
yum -y install debmirror
修改 /etc/debmirror.conf 配置文件,注释掉 @dists 和 @arches 两行
sed -i 's|@dists=.*|#@dists=|' /etc/debmirror.conf
sed -i 's|@arches=.*|#@arches=|' /etc/debmirror.conf
2.2.12检查配置
cobbler check
The following are potential configuration items that you may want to fix:无需处理
1 : reposync is not installed, need for cobbler reposync, install/upgrade yum-utils?
2 : debmirror package is not installed, it will be required to manage debian deployments and repositories
Restart cobblerd and then run 'cobbler sync' to apply changes.
2.2.13同步配置
cobbler sync
2.3 Cobbler管理
2.3.1命令说明
命令参考
cobbler --help
cobbler distro --help
cobbler distro add --help
2.3.2配置文件说明
Cobbler配置文件存放在/etc/cobbler下
2.3.3镜像数据目录
导入的系统发行版,repos镜像和kickstart文件都放置在/var/www/cobbler
目录下。确保/var目录有足够的空间来存储这些文件。
2.3.4数据目录
此目录存储和Cobbler profiles、systems、distros相关的配置。
2.3.5日志文件
web日志存放点:
/var/log/httpd/access_log
/var/log/httpd/error_log
/var/log/httpd/ssl_access_log
/var/log/httpd/ssl_error_log
Cobbler日志:
/var/log/cobbler/cobbler.log
/var/log/cobbler/install.log
通过Cobbler日志可以获取系统的安装状态
2.3.6导入镜像
1. 注意下载的ISO文件要核对文件的md5值,确保数据完整性
md5sum xx.iso
2.创建目录
mkdir -p /var/os/Linux/Centos/x86_64/Centos6.7/dvd
3.挂载
mount -o loop/var/iso/Linux/Centos/x86_64/xx.iso
/var/os/Linux/Centos/x86_64/Centos6.7/dvd
2.3.7导入数据
cobbler import --path=/xx --name=centos6.7 --arch=x86_64
cobbler list 列出配置
cobbler report 详细
cobbler profile find --distro=centos6.7-x86_64 #查看配置是否存在
cobbler profile remove --name=centos6.7-x86_64 #删除配置文件
cobbler distro remove --name=centos6.7-x86_64 #删除distro
cobbler profile find --distro=centos6.7-x86_64 #再查看配置已无
2.3.8自定义ks
ks目录位置
/var/lib/cobbler/kickstarts/
默认的ks位置
/var/lib/cobbler/kickstarts/sample.ks
更改指定系统版本对应的ks配置文件
cp /var/lib/cobbler/kickstarts/ sample.ks centos6.7-x86_64.ks
cobbler profile add --name=centos6.7 --distro= centos6.7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos6.7-x86_64.ks
cobbler check
cobbler sync
KS示例:
#platform=x86, AMD64, or Intel EM64T
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url=$tree
#Root password
rootpw root
# System authorization information
auth --useshadow--enablemd5
# Use graphical mode install
graphical
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# System timezone
timezone Asia/Shanghai
# Network information
network --bootproto=static --device=eth0 --gateway=192.168.56.1 --ip=192.168.56.99 --nameserver=192.168.56.99 --netmask=255.255.255.0 --hostname=host99 --onboot=on
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part / --fstype="ext4" --ondisk=sda --size=8000
part /boot --fstype="ext4" --ondisk=sda --size=200
part swap --fstype="swap" --size=1000
# Reboot after installation
reboot
# Clear the Master Boot Record
zerombr
%packages
@ X Window System
@ Desktop
@ Development tools
gcc*
%end
3 Web管理
Cobbler web界面是一个很好的前端,非常容易管理Cobbler。可以添加和删除system、distro、profile,可以查看、编辑distros、profiles、subprofiles、systems、repos、kickstart文件。
3.1cobbler web管理
3.1.1安装
yum -y install cobbler-web
3.1.2设置用户密码
为已存在的用户cobbler重置密码:
htdigest /etc/cobbler/users.digest "Cobbler" cobbler
添加新用户:
htdigest /etc/cobbler/users.digest "Cobbler" newname
3.1.3配置登录
sed -i 's/authn_denyall/authn_configfile/g'
/etc/cobbler/modules.conf
/etc/init.d/cobblerd restart
/etc/init.d/httpd restart
3.1.4访问web
浏览器访问登录页面https://192.168.xx.xx/cobbler_web
3.1.5登录web
3.1.6管理web
cobbler system add --name=xx --hostname=xx --mac=xx
--interface=ethx --ip-address=xx --subnet=xx --gateway=xx
--static=1 --profile=xx
yum install cman ipmitool -y 电源管理(需要硬件支持)
转载于:https://www.cnblogs.com/dongdongwq/p/5377593.html
Linux自动化安装cobbler相关推荐
- Linux 第21天: (09月14日) Linux自动化安装和SELinux
Linux 第21天: (09月14日) Linux自动化安装和SELinux Linux系统自动化安装 本章内容 系统安装过程 配置anaconda 自动化安装系统 安装程序 CentOS系统安装 ...
- Linux自动化之Cobbler补鞋匠安装
cobbler介绍: 快速网络安装linux操作系统的服务,支持众多的Linux发行版:Red Hat. Fedora.CentOS.Debian.Ubuntu和SuSE,也可以支持网络安装w ...
- linux自动化安装oracle,ftp的客户端软件 Linux环境一键自动化安装oracle软件的构想(附she...
一.自动化批量安装ORACLE软件的构想 1.1构想从哪里来? 熟悉PXE+KICKSTART一键批量安装Liunx操作系统的童鞋都知道,该方式可实现快速定制,规范化,自动化的无人值守安装.基于此方式 ...
- linux自动化安装u盘,使用u盘自动化安装centos的例子
使用u盘自动化安装centos的例子,供大家学习参考. 准备工作: linux镜像 windows下的syslinux.exe 1个4G的U盘(因为镜像一般都比较大) 开个虚拟机上的linux, wi ...
- linux自动化安装linux系统,Linux下—自动化boot引导安装linux系统安装-Go语言中文社区...
系统光盘中isolinux目录列表 1.solinux.bin:光盘引导程序,在mkisofs的选项中需要明确给出文件路径,这个文件属于SYSLINUX项目 2.isolinux.cfg: isoli ...
- 9.11 作业自动化安装linux
1. 使用 kickstart 半自动化安装CentOS系统 1.1 配置yum.repo [root@centos8 ~]# echo - - - > /sys/class/scsi_host ...
- kickstart自动化系统安装_利用Kickstart自动化安装CentOS的教程
前言 因为需要在浪潮的x86服务器中集中部署CentOS搭建基于Hadoop的大数据平台,平时接触SLES(SuSE Linux Enterprise Server)较多并且已经实现基于Autoyas ...
- kickstart自动化系统安装_系统运维|基于Kickstart自动化安装CentOS实践
前言 因为需要在浪潮的x86服务器中集中部署CentOS搭建基于Hadoop的大数据平台,平时接触SLES(SuSE Linux Enterprise Server)较多并且已经实现基于Autoyas ...
- cobbler自动化安装Linux系统
cobbler简介 Cobbler是一个Linux服务器快速网络安装的服务,而且在经过调整也可以支持网络安装windows.该工具使用python开发,小巧轻便(才15k行python代码),可以通过 ...
最新文章
- 单片机I/O控制方式(UART中断和DMA中断的区别)
- 查看终端进程是否死掉技巧
- hdu2037 今年暑假不AC
- 清楚xcode缓存(老是忘记所有记下来方便以后查阅)
- win7下构建swarm nodes实现跨host的容器之间的通信
- 802.11协议中帧控制域中To DS and From DS 比特位的含义
- 【视频】vue组件之props属性
- vue里碰到 $refs 的问题
- Syntax error, parameterized types are only available if source level is 1.5 or greater
- ios基础之 ARC
- 关于 vim 的 magic 设置
- 《How to Use the TimeDistributed Layer for Long Short-Term Memory Networks in Python》学习笔记
- java生成离散型随机数_几种随机数生成方式
- [论文]基于强化学习的控制输入非线性水下机器人自适应神经网络控制
- GIS坐标系:epsg 3857 vs 4326
- Pandas 重置索引深度总结
- 私域运营电商平台和传统电商平台有什么不同?
- 每天接触互联网 了解互联网是什么
- 编写程序实现通过有道或百度翻译url对用户输入数据进行翻译_8亿用户AI有道,超强神经网络翻译技术大解密...
- ANDROID中的VOLD分析
热门文章
- mybaties与hibernate的不同点
- XML-RPC协议学习
- 带头结点头部插入创建链表
- java多线程总结一:线程的两种创建方式及优劣比较
- Eigen(4)矩阵基本运算
- 魔兽世界阿拉索人数最多服务器,魔兽世界8.3哪个区人多_wow8.3服务器人数统计介绍_3DM网游...
- js return的值取不到_【JS基础】隐式转换(一)
- github哪些协议能商用_GitHub 上有哪些一般人也可以用的项目?
- jQuery文档就绪
- React Native项目自动化打包发布