CentOS 7 Cobbler 安装

Stella981
• 阅读 792

Cobbler介绍

Cobbler是一个Linux服务器快速网络安装的服务,而且在经过调整也可以支持网络安装windows。

  • 使用python开发,小巧轻便(才15k行python代码),可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS,TFTP、RSYNC以及yum仓库、构造系统ISO镜像。
  • Cobbler 可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。
  • Cobbler 是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。
  • Cobbler 内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack
  • Cobbler 客户端Koan支持虚拟机安装和操作系统重新安装,使重装系统更便捷。

Cobbler用处

使用Cobbler,您无需进行人工干预即可安装机器。Cobbler设置一个PXE引导环境(它还可以使用yaboot支持PowerPC),并 控制与安装相关的所有方面,比如网络引导服务(DHCP和TFTP)与存储库镜像。当希望安装一台新机器时,Cobbler可以:

  1. 使用一个以前定义的模板来配置DHCP服务(如果启用了管理DHCP)。
  2. 将一个存储库(yum或rsync)建立镜像或解压缩一个媒介,以注册一个新操作系统。
  3. 在DHCP配置文件中为需要安装的机器创建一个条目,并使用指定的参数(IP和MAC)。
  4. 在TFTP服务目录下创建适当的PXE文件。
  5. 重新启动DHCP服务来反应新的更改。
  6. 重新启动机器以开始安装(如果电源管理已启动)。

环境准备

系统版本

内核版本

IP地址

Centos 7.5

4.18.9-1.el7.elrepo.x86_64

10.0.0.200

备注该系统采用MINI最小化安装,安装之后对系统进行了最基础的优化操作,操作过程点击这里

设置IP转发

[root@cobbler ~]# echo 1 > /proc/sys/net/ipv4/ip_forward 
[root@cobbler ~]# sed -i 's/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/' /etc/sysctl.conf
[root@cobbler ~]# sysctl -p

安装 Cobbler 及所需要的依赖包

[root@cobbler ~]# yum install cobbler dhcp httpd xinetd tftp-server syslinux pykickstart xinetd rsync cobbler-web -y

配置文件目录

/etc/cobbler/settings : cobbler 主配置文件
/etc/cobbler/iso/: iso模板配置文件
/etc/cobbler/pxe: pxe模板文件
/etc/cobbler/power: 电源配置文件
/etc/cobbler/user.conf: web服务授权配置文件
/etc/cobbler/users.digest: web访问的用户名密码配置文件
/etc/cobbler/dhcp.template : dhcp服务器的的配置末班
/etc/cobbler/dnsmasq.template : dns服务器的配置模板
/etc/cobbler/tftpd.template : tftp服务的配置模板
/etc/cobbler/modules.conf : 模块的配置文件

数据目录

/var/lib/cobbler/config/: 用于存放distros,system,profiles 等信息配置文件
/var/lib/cobbler/triggers/: 用于存放用户定义的cobbler命令
/var/lib/cobbler/kickstart/: 默认存放kickstart文件
/var/lib/cobbler/loaders/: 存放各种引导程序

镜像目录

/var/www/cobbler/ks_mirror/: 导入的发行版系统的所有数据
/var/www/cobbler/images/ : 导入发行版的kernel和initrd镜像用于远程网络启动
/var/www/cobbler/repo_mirror/: yum 仓库存储目录

日志目录

/var/log/cobbler/installing: 客户端安装日志
/var/log/cobbler/cobbler.log : cobbler日志

cobbler commands

import
sync
reposync
build iso (使用发行版,配置文件,制作系统镜像)
command line search
replication
valication kickstart

启动Cobbler并配置

启动

[root@cobbler yum.repos.d]# systemctl start cobblerd
[root@cobbler yum.repos.d]# systemctl enable cobblerd
Created symlink from /etc/systemd/system/multi-user.target.wants/cobblerd.service to /usr/lib/systemd/system/cobblerd.service.
[root@cobbler yum.repos.d]# systemctl start httpd
[root@cobbler yum.repos.d]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

检查配置

[root@cobbler ~]# 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

# 修改server的ip地址为本机ip
[root@cobbler ~]# sed -i 's/^server: 127.0.0.1/server: 10.0.0.200/' /etc/cobbler/settings  

问题 2

# TFTP Server 的IP地址
[root@cobbler ~]# sed -i 's/^next_server: 127.0.0.1/next_server: 10.0.0.200/' /etc/cobbler/settings

问题 3

[root@cobbler ~]# cat /etc/xinetd.d/tftp 
# default: off
# description: The tftp server serves files using the trivial file transfer \
#    protocol.  The tftp protocol is often used to boot diskless \
#    workstations, download configuration files to network-aware printers, \
#    and to start the installation process for some operating systems.
service tftp
{
    socket_type        = dgram
    protocol        = udp
    wait            = yes
    user            = root
    server            = /usr/sbin/in.tftpd
    server_args        = -s /var/lib/tftpboot
    # 把下面的yes,替换成no即可
    disable            = no
    per_source        = 11
    cps            = 100 2
    flags            = IPv4
}

问题 4

# 下载缺失的文件
[root@cobbler ~]# cobbler get-loaders
task started: 2018-09-27_152814_get_loaders
task started (id=Download Bootloader Content, time=Thu Sep 27 15:28:14 2018)
downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README
downloading https://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
downloading https://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading https://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading https://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***

问题 5

# 添加rsync到自启动并启动rsync
[root@cobbler ~]# systemctl start rsyncd
[root@cobbler ~]# systemctl enable rsyncd 
Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.

问题6

跟debian 相关,可以忽略

问题7

# 修改密码为123456 ,salt后面是常用的加盐方式加密
[root@cobbler ~]# openssl passwd -1 -salt '123456' '123456' 
$1$123456$wOSEtcyiP2N/IfIl15W6Z0
[root@cobbler ~]# grep 'default_password_crypted' /etc/cobbler/settings
default_password_crypted: "$1$123456$wOSEtcyiP2N/IfIl15W6Z0"

下面再次执行检查配置

[root@cobbler ~]# cobbler check
The following are potential configuration items that you may want to fix:

1 : debmirror package is not installed, it will be required to manage debian deployments and repositories
2 : 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.

上面出现的这两个问题都可以忽略。

点赞
收藏
评论区
推荐文章
blmius blmius
3年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
Jacquelyn38 Jacquelyn38
3年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
Stella981 Stella981
3年前
Cobbler极简教程
1\.Cobbler介绍Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等。Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobblerweb),还提供了API接口,
Stella981 Stella981
3年前
KVM调整cpu和内存
一.修改kvm虚拟机的配置1、virsheditcentos7找到“memory”和“vcpu”标签,将<namecentos7</name<uuid2220a6d1a36a4fbb8523e078b3dfe795</uuid
Wesley13 Wesley13
3年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Stella981 Stella981
3年前
Cobbler无人值守安装
1\.Cobbler介绍Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等。Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobblerweb),还提供了API接口,可以方便二次开发使用。Co
Wesley13 Wesley13
3年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
胖大海 胖大海
2年前
Cobbler批量部署原理
Cobbler可以干什么Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows。使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP、DNS、TFTP、RSYNC以及yum仓库、
Python进阶者 Python进阶者
10个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这