当前环境介绍:

当前系统Centos7.5,关闭selinux,关闭firewalld(或自行设置相应规则),关闭当前路由dhcp功能,如果是虚拟机安装则网络适配器要选择NAT模式(因为同一局域网多个DHCP服务会有冲突),本机IP地址192.168.50.101

前提:cobbler由epel源提供,所以需要事先配置epel的yum源。

一、安装epel源

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

1

wget-O/etc/yum.repos.d/epel.repohttp://mirrors.aliyun.com/repo/epel-7.repo

我这里使用的是阿里的epel源,你也可以直接yum install epel-release

二、安装cobbler

yum install cobbler cobbler-web pykickstart debmirror httpd dhcp tftp-server xinetd syslinux

1

yuminstallcobblercobbler-webpykickstartdebmirrorhttpddhcptftp-serverxinetdsyslinux

三、启动相关服务并设置开机自启

systemctl start httpd

systemctl enable httpd

systemctl start cobblerd

systemctl enable cobblerd

systemctl start rsyncd

systemctl enable rsyncd

systemctl enable dhcpd

1

2

3

4

5

6

7

systemctlstarthttpd

systemctlenablehttpd

systemctlstartcobblerd

systemctlenablecobblerd

systemctlstartrsyncd

systemctlenablersyncd

systemctlenabledhcpd

四、检查cobbler配置

通过cobbler自带的命令检查,而后逐一按提示解决。

cobbler check

1

cobblercheck

正常会看到如下内容:

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 : comment out 'dists' on /etc/debmirror.conf for proper debian support

6 : comment out 'arches' on /etc/debmirror.conf for proper debian support

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、修改/etc/cobbler/settings文件,将默认server的127.0.0.1替换为本机IP地址

sed -i 's#^server: 127.0.0.1#server: 192.168.50.101#' /etc/cobbler/settings

1

sed-i's#^server: 127.0.0.1#server: 192.168.50.101#'/etc/cobbler/settings

2、修改/etc/cobbler/settings文件,将默认next_server的127.0.0.1替换为本机IP地址

sed -i 's#^next_server: 127.0.0.1#next_server: 192.168.50.101#' /etc/cobbler/settings

1

sed-i's#^next_server: 127.0.0.1#next_server: 192.168.50.101#'/etc/cobbler/settings

3、将/etc/xinetd.d/tftp中disable改为no

disable = no

1

disable = no

4、执行“cobbler get-loaders”命令即可

cobbler get-loaders

1

cobblerget-loaders

task started: 2018-11-04_103455_get_loaders

task started (id=Download Bootloader Content, time=Sat Nov 4 10:34:55 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 ***

1

2

3

4

5

6

7

8

9

10

11

12

13

taskstarted:2018-11-04_103455_get_loaders

taskstarted(id=DownloadBootloaderContent,time=SatNov410:34:552018)

downloadinghttps://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README

downloadinghttps://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo

downloadinghttps://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot

downloadinghttps://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux

downloadinghttps://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi

downloadinghttps://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot

downloadinghttps://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0

downloadinghttps://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32

downloadinghttps://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi

downloadinghttps://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi

***TASKCOMPLETE ***

5、注释/etc/debmirror.conf文件中的@dists="sid";一行

sed -i 's/@dists="sid";/#@dists="sid";/' /etc/debmirror.conf

1

sed-i's/@dists="sid";/#@dists="sid";/'/etc/debmirror.conf

6、注释/etc/debmirror.conf文件中的@arches="i386";一行

sed -i 's/@arches="i386";/#@arches="i386";/' /etc/debmirror.conf

1

sed-i's/@arches="i386";/#@arches="i386";/'/etc/debmirror.conf

7、设置新系统默认的root密码,执行“openssl passwd -1 -salt $(openssl rand -hex 4)”生成密码,并用其替换/etc/cobbler/settings文件中default_password_crypted参数的值;

openssl passwd -1 -salt $(openssl rand -hex 4)

Password:whsir

$1$7cbbc3f6$NDKbP8HqfR4/p6S6g9Mzd/

1

2

3

opensslpasswd-1-salt$(opensslrand-hex4)

Password:whsir

$1$7cbbc3f6$NDKbP8HqfR4/p6S6g9Mzd/

vi /etc/cobbler/settings

1

vi/etc/cobbler/settings

default_password_crypted: "$1$7cbbc3f6$NDKbP8HqfR4/p6S6g9Mzd/"

1

default_password_crypted:"$1$7cbbc3f6$NDKbP8HqfR4/p6S6g9Mzd/"

8、安装相应的程序包

yum install fence-agents

1

yuminstallfence-agents

五、重启cobblerd并同步检查

systemctl restart cobblerd

cobbler sync

cobbler check

1

2

3

systemctlrestartcobblerd

cobblersync

cobblercheck

显示No configuration problems found. All systems go.(没有找到配置问题,一切正常)

六、通过cobbler来管理dhcp

sed -i 's#manage_dhcp: 0#manage_dhcp: 1#' /etc/cobbler/settings

1

sed-i's#manage_dhcp: 0#manage_dhcp: 1#'/etc/cobbler/settings

七、配置dhcp服务

vi /etc/cobbler/dhcp.template

1

vi/etc/cobbler/dhcp.template

...

subnet 192.168.50.0 netmask 255.255.255.0 {

option routers             192.168.50.1;  #网关地址

option domain-name-servers 114.114.114.114; #DNS

option subnet-mask         255.255.255.0; #掩码

range dynamic-bootp        192.168.50.120 192.168.50.130; #网段

...

1

2

3

4

5

6

7

...

subnet 192.168.50.0 netmask 255.255.255.0 {

option routers             192.168.50.1;  #网关地址

option domain-name-servers 114.114.114.114;#DNS

option subnet-mask         255.255.255.0;#掩码

range dynamic-bootp        192.168.50.120 192.168.50.130;#网段

...

重启cobbler服务并同步配置

systemctl restart cobblerd

cobbler sync

1

2

systemctlrestartcobblerd

cobblersync

八、挂载导入镜像

我这里已经上传好了一个镜像在root目录下

mount -r CentOS-7-x86_64-Minimal-1804.iso /mnt/

1

mount-rCentOS-7-x86_64-Minimal-1804.iso/mnt/

导入镜像,cobbler会将镜像中所有安装文件拷贝到/var/www/cobbler/ks_mirror/NAME目录下,因此/var/www/cobbler目录必须具有足够的空间

cobbler import --path=/mnt/ --name=CentOS-7.5-x86_64 --arch=x86_64

1

cobblerimport--path=/mnt/--name=CentOS-7.5-x86_64--arch=x86_64

导入镜像完成后,可用下面命令查看到刚才导入的镜像

cobbler distro list

1

cobblerdistrolist

九、编辑kickstart文件

我这里已经提前准备好了一份kickstart文件,文件内容如下

vi /var/lib/cobbler/kickstarts/CentOS-7.5-x86_64.cfg

1

vi/var/lib/cobbler/kickstarts/CentOS-7.5-x86_64.cfg

# Centos7

# This kickstart file should only be used with EL > 5 and/or Fedora > 7.

# For older versions please use the sample.ks kickstart file.

#platform=x86, AMD64, or Intel EM64T

# System authorization information

auth --useshadow --passalgo=sha512

# System bootloader configuration

bootloader --location=mbr

# Partition clearing information

clearpart --all --initlabel

# Use text mode install

text

# Firewall configuration

firewall --disable

# Run the Setup Agent on first boot

firstboot --disable

ignoredisk --only-use=sda

# System keyboard

keyboard us

# System language

lang en_US

# Use network installation

url --url=$tree

# If any cobbler repo definitions were referenced in the kickstart profile, include them here.

$yum_repo_stanza

# Network information

$SNIPPET('network_config')

# Reboot after installation

reboot

#Root password

rootpw --iscrypted $default_password_crypted

# SELinux configuration

selinux --disabled

# Do not configure the X Window System

skipx

# System timezone

timezone Asia/Shanghai

# Install OS instead of upgrade

install

# Clear the Master Boot Record

zerombr

# Allow anaconda to partition the system as needed

part /boot --fstype="xfs" --size=300 --ondisk=sda

part swap --fstype="swap" --size=2048 --ondisk=sda

part / --fstype="xfs" --grow --size=1 --ondisk=sda

%pre

$SNIPPET('log_ks_pre')

$SNIPPET('kickstart_start')

$SNIPPET('pre_install_network_config')

# Enable installation monitoring

$SNIPPET('pre_anamon')

%end

%packages

@^minimal

@core

kexec-tools

%end

%post

systemctl disable postfix.service

%end

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

# Centos7

# This kickstart file should only be used with EL > 5 and/or Fedora > 7.

# For older versions please use the sample.ks kickstart file.

#platform=x86, AMD64, or Intel EM64T

# System authorization information

auth--useshadow--passalgo=sha512

# System bootloader configuration

bootloader--location=mbr

# Partition clearing information

clearpart--all--initlabel

# Use text mode install

text

# Firewall configuration

firewall--disable

# Run the Setup Agent on first boot

firstboot--disable

ignoredisk--only-use=sda

# System keyboard

keyboardus

# System language

langen_US

# Use network installation

url--url=$tree

# If any cobbler repo definitions were referenced in the kickstart profile, include them here.

$yum_repo_stanza

# Network information

$SNIPPET('network_config')

# Reboot after installation

reboot

#Root password

rootpw--iscrypted$default_password_crypted

# SELinux configuration

selinux--disabled

# Do not configure the X Window System

skipx

# System timezone

timezoneAsia/Shanghai

# Install OS instead of upgrade

install

# Clear the Master Boot Record

zerombr

# Allow anaconda to partition the system as needed

part/boot--fstype="xfs"--size=300--ondisk=sda

partswap--fstype="swap"--size=2048--ondisk=sda

part/--fstype="xfs"--grow--size=1--ondisk=sda

%pre

$SNIPPET('log_ks_pre')

$SNIPPET('kickstart_start')

$SNIPPET('pre_install_network_config')

# Enable installation monitoring

$SNIPPET('pre_anamon')

%end

%packages

@^minimal

@core

kexec-tools

%end

%post

systemctldisablepostfix.service

%end

十、修改kickstart文件为自定义的CentOS-7.5-x86_64.cfg

cobbler profile edit --name=CentOS-7.5-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-7.5-x86_64.cfg

1

cobblerprofileedit--name=CentOS-7.5-x86_64--kickstart=/var/lib/cobbler/kickstarts/CentOS-7.5-x86_64.cfg

用cobbler profile report查看,Kickstart已经改变

十一、重启xinetd服务

systemctl restart xinetd

1

systemctlrestartxinetd

至此为止配置完成,部分参数可根据情况自行进行修改

PS:

后续安装系统时如果提示TFTP timeout,请检查xinetd服务是否启动,netstat -lntpu是否可以看到69端口

如果出现/sbin/dmsquash-live-root: line 286: printf: write error: No space left on device因为内存不足2G的原因

~微信打赏~

分享到:

cobbler命令_Cobbler部署详细教程基于Centos7.5相关推荐

  1. MySQL免安装版配置部署详细教程

    MySQL免安装版配置部署详细教程 这里写目录标题 MySQL免安装版配置部署详细教程 部署MySQL免安装版(windows版) 1.windows的mysql配置文件是my.ini,将此文件放到m ...

  2. 【dubbo-2.5.x】Linux下dubbo-admin监控/管理平台部署详细教程

    前言 Dubbo-Admin是Dubbo控制台管理的工具,是Dubbo组件之一,需要Dubbo-Admin管理平台来实时对服务调用情况进行调整,比如控制分布式服务的调用权重等,通过调整调整调用权重来控 ...

  3. Python开发环境部署详细教程,附上免费Python开发平台

    Python开发环境部署详细教程来啦!本文将带大家搭建一个Python虚拟环境和基于网页的用于交互计算的应用程序Jupyter Notebook. 如果这么简单的部署教程你还是学不会,没关系,在文章末 ...

  4. Linux下解压命令、压缩命令大全,详细教程

    Linux下解压命令.压缩命令大全,详细教程 linux常用的解压和压缩命令如下: 1..tar  解包:tar xvf FileName.tar 打包:tar cvf FileName.tar Di ...

  5. windows下OpenCV的安装配置部署详细教程

    零.简介 OpenCV的全称是Open Source Computer Vision Library,是一个跨平台的计算机视觉库.OpenCV是由英特尔公司发起并参与开发,以BSD许可证授权发行,可以 ...

  6. 2013年8月22日 量产量产 UDU+B+部署详细教程,专事bios启动

    老毛桃统一PE部署方法图文教程(bios启动) 紧急通告:fba文件全转换为utf-8格式,喜欢自动写入UD的,请先用部署工具包中支持ansi的老版本fbinstool版打开fba文件,转换为ansi ...

  7. Debug命令的使用详细教程

    文章目录 下载与安装 什么是Debug Debug常用命令[不区分大小写] 下载与安装 链接:https://pan.baidu.com/s/1vgAmHIJnyVpRBTBPLA2Okg 提取码:o ...

  8. Linux部署python接口自动化教程,基于centos7 python3

    Linux部署python接口自动化教程 1.安装jenkins 2.安装插件和依赖 **安装allure插件(测试报告)** **配置allure依赖** 安装python3.x依赖环境 **安装p ...

  9. Jenkins自动化部署详细教程

    1.背景 在实际开发中,我们经常要一边开发一边测试,当然这里说的测试并不是程序员对自己代码的单元测试,而是同组程序员将代码提交后,由测试人员测试: 或者前后端分离后,经常会修改接口,然后重新部署: 这 ...

最新文章

  1. 对话框 未能返回新代码元素 可能 没有ncb_JDK1.8的新特性 | 技术
  2. B1007 素数对猜想
  3. 如何解析属性文件(properties)获取键值对的值?
  4. 地壳中元素含量排名记忆口诀_在地球46亿年的历史中,氮气始终是含量最高的气体,为什么?...
  5. MySQL8.0.25命令行安装与配置
  6. 西威变频器使用说明书_西威变频器说明书
  7. u检验中的查u界值表_u检验、t检验、F检验、X2检验
  8. labwindows计时器
  9. 微观经济学第七周作业(生产函数,规模报酬,投入产出)
  10. Windows平台调试工具:DebugView
  11. java 空格 char_java中如何判断char是否是空格
  12. 借助nz-pagination中的let-total解析ng-template
  13. linux命令简化,Linux ls 命令实现(简化版)
  14. 如何在 Mac 或 Windows 上将 PDF 转换为 Word 而不丢失格式
  15. 淘客、阿里妈妈、淘宝联盟接口
  16. 实现人脸识别APP(一)
  17. 威控复合机器人(二)------机械臂的控制
  18. 联通SGIP1.2短信接口 Java版实现 总结 2013-10-23测试通过
  19. CSP认证 202203-1 未初始化警告
  20. [数据仓库复习] —— 数据仓库实施步骤

热门文章

  1. Html5的新增特性
  2. Android面试题之ContentProvider篇,安卓工程师面试题及答案
  3. Windows下安装python3---pip-setuptools-matplotlib-tkinter
  4. 小米10青春版科学计算机,小米10青春版,能找回你的青春吗?
  5. Windows系统 的错误代码信息解释
  6. 末日觉醒服务器端文件,CryoFall末日觉醒服务器创建攻略 怎么创建服务器
  7. 基于SSM在线考试系统的核心功能之一自动组卷的实现 SpringBoot版本
  8. scikit-learn工具包中常用的特征选择方法介绍
  9. 2022-4-19 同时读取带外数据和正常数据《Linux高性能服务器》笔记
  10. 《RocketMQ实战专栏》为什么是你学习RocketMQ的最佳资料