cobbler自动安装操作系统
cobbler介绍
快速网络安装linux操作系统的服务,支持众多的Linux发行版: Red Hat, Fedora,CentOS,Debian,Ubuntu和SuSE 也可以支持网络安装windows
PXE的二次封装,将多种安装参数封装到一个菜单
Python编写
提供了CLI和Web的管理形式
cobbler软件包来源于epel源中的软件包
cobbler 服务集成
cobbler可以和以下服务一起集成来对外提供服务 但是cobbler不能代替以下服务
PXE
DHCP
rsync
Http
DNS
Kickstart
IPMI 电源管理
cobbler 相关术语
发行版 ( distro ):
表示一个操作系统版本,它承载了内核和 initrd 的信息 以及内核参数等其他数据
配置文件(profile):
一个发行版可以提供多个不同的ks文件来进行不同功能的安装
包含一个发行版,一个 kickstart 文件以及可能的存储库,还包含更多特定的内核参 数等其他数据
系统:
表示要配置的主机(需要被安装系统的节点)
存储库:
保存一个yum或者rsync存储库的镜像信息
镜像:
可替换为一个包含不属于此类别的文件的发行版对象
网卡IP设置的最简配置格式
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
TYPE=Ethernet BOOTPROTO="static" IPADDR=192.168.231.8 NETMASK=255.255.255.0 DEVICE="ens33" ONBOOT="yes"
cobbler安装配置流程
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
[root@centosmy7 ~]# wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm [root@centosmy7 ~]# rpm -ivh epel-release-latest-7.noarch.rpm [root@centosmy7 ~]# yum repolist [root@centosmy7 ~]# yum install dhcp [root@centosmy7 ~]# yum install cobbler [root@centosmy7 ~]# rpm -ql cobbler | grep service [root@centosmy7 ~]# systemctl start cobblerd httpd tftp
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
[root@centosmy7 tftpboot]# setenforce 0 [root@centosmy7 tftpboot]# cobbler check #只是告警信息不是必要修改项 1 : change 'disable' to 'no' in /etc/xinetd.d/tftp 3 : enable and start rsyncd.service with systemctl 4 : debmirror package is not installed, it will be required to manage debian deployments and repositories 6 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them [root@centosmy7 tftpboot]# vi /etc/cobbler/settings 384 server: 127.0.0.1 272 next_server: 192.168.231.8 101 default_password_crypted: "$1$mF86/UHC$WvcIcX2t6crBz2onWxyac." 242 manage_dhcp: 1 [root@centosmy7 ~]# openssl passwd -1 #数字1代表md5加密类型 [root@centosmy7 ~]# cobbler get-loaders task started: 2018-05-27_190425_get_loaders task started (id=Download Bootloader Content, time=Sun May 27 19:04:25 2018) downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README [root@centosmy7 ~]# cobbler sync task started: 2018-05-27_190536_sync task started (id=Sync, time=Sun May 27 19:05:36 2018) running pre-sync triggers cleaning trees removing: /var/lib/tftpboot/grub/images copying bootloaders trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0 [root@centosmy7 cobbler]# pwd /etc/cobbler [root@centosmy7 cobbler]# vi dhcp.template subnet 192.168.231.0 netmask 255.255.255.0 [root@centosmy7 cobbler]#systemctl restart cobblerd
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#准备yum源 [root@centosmy7 ~]# mkdir /mnt/centos7 [root@centosmy7 ~]# mount /dev/sr0 /mnt/centos7 #把光盘文件拷贝到/var/www/cobbler目录下 [root@centosmy7 ~]# cobbler import --path=/mnt/centos7 --name=yxhcentos7 --arch=x86_64 #导入系统后cobbler默认会自动生成一个最小化安装的ks文件 #自动生成cobbler启动系统选择菜单 [root@centosmy7 ~]# cobbler distro list yxhcentos7-x86_64 #上传自己的ks文件,然后通过ks和distro关联生成一个新的cobbler启动菜单(profile) [root@centosmy7 www]# cp ks7_mini.cfg /var/lib/kickstarts/ [root@centosmy7 pxelinux.cfg]# cobbler profile add --name=yxhcentos7_x86 --distro=yxhcentos7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks7_mini.cfg #自动修改default启动菜单配置文件
cobbler的web管理
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
[root@centosmy7 www]# yum install cobbler-web [root@centosmy7 www]# systemctl restart httpd https://192.168.231.8/cobbler_web/ #创建cobbler_web管理员账号 [root@centosmy7 www]# vi /etc/cobbler/modules.conf authn_configfile -- use /etc/cobbler/users.digest (for basic setups) [root@centosmy7 www]# vi /etc/cobbler/users.digest [root@centosmy7 kickstarts]# htdigest -c /etc/cobbler/users.digest Cobbler test1 Adding password for test1 in realm Cobbler. New password: Re-type new password: [root@centosmy7 www]# 使用第二种pam登录验证 [authentication] module = authn_pam [root@centosmy7 ~]# useradd test2 [root@centosmy7 ~]# echo root | passwd --stdin test2 [root@centosmy7 ~]# vi /etc/cobbler/users.conf [admins] admin = "test2" cobbler = "" [root@centosmy7 ~]# systemctl restart cobblerd
cobbler命令介绍
cobbler check 核对当前设置是否有问题
cobbler list 列出所有的cobbler元素
cobbler report 列出元素的详细信息
cobbler sync 同步配置到数据目录,更改配置最好都要执行下
cobbler reposync 同步yum仓库
cobbler distro 查看导入的发行版系统信息
cobbler system 查看添加的系统信息
cobbler profile 查看配置信息
联网:cobbler get-loaders
不联网:cp /usr/share/syslinux/{pxelinux.0,menu.c32} /var/lib/tftpboot
htdigest -c /etc/cobbler/users.digest Cobbler admin
注意:添加第一个用户时, 使用“-c”选项,后续添加其他用户时不要再使用 cobbler_web的realm只能为Cobbler
openssl passwd -1 生成密码 用其替换/etc/cobbler/settings 数字1表示使用MD5加密类型
本文来自博客园,作者:不懂123,转载请注明原文链接:https://www.cnblogs.com/yxh168/p/9095503.html