1、Cobbler命令说明:

命令名称

命令用途

cobbler check

检查cobbler配置

cobbler list

列出所有的cobbler元素

cobbler report

列出元素的详细信息

cobbler distro

查看导入的发行版系统信息

cobbler system

查看添加的系统信息

cobbler profile

查看配置信息

cobbler sync

同步Cobbler配置,更改配置最好都要执行下

cobbler reposync

同步yum仓库

命令参考

cobbler --help

cobbler distro --help

cobbler distro add --help

2、Cobbler配置文件说明

Cobbler配置文件存放在/etc/cobbler下

配置文件名称

作    用

/etc/cobbler/settings

Cobbler主配置文件

/etc/cobbler/users.digest

用于web访问的用户名密码配置文件

/etc/cobbler/modules.conf

模块配置文件

/etc/cobbler/users.conf

Cobbler WebUI/Web 服务授权配置文件

/etc/cobbler/iso/

Buildiso 模板配置文件

/etc/cobbler/power

电源配置文件

/etc/cobbler/pxe

Pxeprofile配置模板

/etc/cobbler

此目录也包含rsync、dhcp、dns、pxe、dnsmasq等服务的模板配置文件

3、系统镜像数据目录/var/www/cobbler

导入的系统发行版,repos镜像和kickstart文件都放置在/var/www/cobbler目录下。确保/var目录有足够的空间来存储这些文件。

目录名称

作    用

/var/www/cobbler/images/

存储所有导入发行版的Kernel和initrd镜像用于远程网络启动

/var/www/cobbler/ks_mirror/

存储导入的发行版系统数据

/var/www/cobbler/repo_mirror/

仓库存储目录

/var/log/cobbler

Cobbler日志文件 cobbler.log install.log

4、Cobbler数据目录/var/lib/cobbler

此目录存储和Cobbler profiles、systems、distros相关的配置。

目录名称

作    用

/var/lib/cobbler/config/

存放distros、repos、systems和profiles等信息配置文件,一般都是json文件

/var/lib/cobbler/snippets/

存放ks文件可以导入的脚本小片段,值得研究

/var/lib/cobbler/triggers

存放用户定义的cobbler 命令

/var/lib/cobbler/kickstarts/

存放kickstart配置文件

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日志可以获取系统的安装状态

三、Cobbler 常用命令汇总

1.导入镜像文件

命令:cobbler import --path=镜像路径 -- name=安装引导名 --arch=32位或64位

参数:

  • path 是镜像所挂载的目录
  • name 是导入到cobbler里面显示的名字
  • arch 是32位系统还是64位系统

2.导入kickstart文件

命令:cobbler profile add --name=list名 --distro=镜像 --kickstart=路径

参数:

  • name是表示添加的ks 的名字,用cobbler report可以看到这个名字
  • distro 是用哪个镜像,list的distros里面选择一个,需要版本相对应
  • kickstart 是具体的 ks 文件路径

3.同步DHCP、HTTPD

命令:cobbler sync

注,每次修改完dhcp.template之类的配置文件需要执行一次使其生效。

4.查看Cobbler列表

命令:cobbler list

注,列出Cobbler所有的元素。

5.删除相关列表

命令:cobbler distro/profile remove --name=要删除的引导文件名

  • 删除指定 distro , 也就是镜像
  • 删除指定的 profile 文件,也就是 ks

四、Cobbler 各种目录说明(注,这里只介绍重点的文件或目录 )

1.cobbler配置文件目录/etc/cobbler

[root@node2 cobbler]# ls /etc/cobbler/

auth.conf    cobblerd.service    dnsmasq.template    mongodb.conf  rsync.exclude    users.conf

cheetah_macros  cobbler_web.conf    import_rsync_whitelist named.template rsync.template   users.digest

cobbler_bash   completions       iso           power      secondary.template version

cobbler.conf   dhcp.template      ldap          pxe       settings      zone.template

cobblerd_rotate distro_signatures.json modules.conf      reporting    tftpd.template   zone_templates

  • /etc/cobbler/settings cobbler主配置文件
  • /etc/cobbler/iso/ iso模板配置文件
  • /etc/cobbler/pxe pxe模板文件
  • /etc/cobbler/power 电源的配置文件
  • /etc/cobbler/users.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 Cobbler模块配置文件

2.cobbler数据目录/var/lib/cobbler

1

2

3

4

5

6

7

[root@node2 cobbler]# ls /var/lib/cobbler/

config distro_signatures.json kickstarts loaders lock scripts snippets triggers web.ss

[root@node2 config]# ls

distros.d files.d images.d mgmtclasses.d packages.d profiles.d repos.d systems.d

[root@node2 loaders]# ls

COPYING.elilo   COPYING.yaboot grub-x86_64.efi menu.c32  README

COPYING.syslinux elilo-ia64.efi grub-x86.efi   pxelinux.0 yaboot

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

3.镜像数据目录/var/www/cobbler

1

2

[root@node2 cobbler]# ls

aux images ks_mirror links localmirror pub rendered repo_mirror svc

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

4.日志目录 /var/log/cobbler/

1

2

3

4

5

[root@node2 cobbler]# ls

anamon cobbler.log install.log kicklog syslog tasks

[root@node2 cobbler]# cat install.log

profile  CentOS-5.5-x86_64  192.168.18.222  start  1384219313.49

profile  CentOS-5.5-x86_64  192.168.18.222  stop  1384219512.05

  • /var/log/cobbler/install.log 客户端的安装系统日志
  • /var/log/cobbler/cobbler.log cobbler日志

下面我们来具体看一下sample.ks的内容。

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

[root@node2 ~]# cat /var/lib/cobbler/kickstarts/sample.ks

#platform=x86, AMD64, or Intel EM64T

# System authorization information

auth --useshadow --enablemd5 #用户登录认证

# System bootloader configuration

bootloader --location=mbr #mbr引导

# Partition clearing information

clearpart --all --initlabel #默认清除所有分区

# Use text mode install

text #默认以文本模式安装

# Firewall configuration

firewall --enabled #防火墙默认开启

# Run the Setup Agent on first boot

firstboot --disable #禁用启动代理

# 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 #默认的yum仓库

# Network information

$SNIPPET('network_config')

# Reboot after installation

reboot #安装完成后重启

#Root password

rootpw --iscrypted $default_password_crypted #密码是我们/etc/cobbler/settings设置密码

# SELinux configuration

selinux --disabled #默认关闭selinux

# Do not configure the X Window System

skipx #默认没有安装图形界面

# System timezone

timezone America/New_York #默认时区是美国/纽约

# Install OS instead of upgrade

install #定义的是安装系统而不是升级系统

# Clear the Master Boot Record

zerombr #默认清空所有的mbr

# Allow anaconda to partition the system as needed

autopart #默认自动分区

#下面就是Cobbler自定执行的一些脚本,我就不解释了。

%pre

$SNIPPET('log_ks_pre')

$SNIPPET('kickstart_start')

$SNIPPET('pre_install_network_config')

# Enable installation monitoring

$SNIPPET('pre_anamon')

%packages

$SNIPPET('func_install_if_enabled')

$SNIPPET('puppet_install_if_enabled')

%post

$SNIPPET('log_ks_post')

# Start yum configuration

$yum_config_stanza

# End yum configuration

$SNIPPET('post_install_kernel_options')

$SNIPPET('post_install_network_config')

$SNIPPET('func_register_if_enabled')

$SNIPPET('puppet_register_if_enabled')

$SNIPPET('download_config_files')

$SNIPPET('koan_environment')

$SNIPPET('redhat_register')

$SNIPPET('cobbler_register')

# Enable post-install boot notification

$SNIPPET('post_anamon')

# Start final steps

$SNIPPET('kickstart_done')

# End final steps

一个ks.cfg示例:

#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="http://10.1.1.223/cobbler/ks_mirror/CentOS-6.4-x86_64/"
# Root password
rootpw --iscrypted $1$KIGcVL58$htt.2om3G9elvGX3hYHab1
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use text install
text
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone  Asia/Shanghai
# Network information
network  --bootproto=dhcp --device=em1 --onboot=on
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
#clearpart --all --initlabel
zerombr

%include /tmp/partition.ks
%pre
#!/bin/sh

act_mem=`cat /proc/meminfo | grep MemTotal | awk '{printf("%d",$2/1024)}'`
cat >> /tmp/partition.ks  << END
clearpart --all
part /boot --size=500  --fstype=ext4 
part swap  --fstype=swap  --size=${act_mem}  
part / --size=1 --grow

END

%end

# Disk partitioning information
#clearpart --all
#part swap --fstype="swap" --size=${act_mem}
#part /boot --asprimary --fstype="ext4" --size=500
#part / --fstype="ext4" --grow --size=1

%packages
@chinese-support
@development
@ruby-runtime
git
-ibus-table-cangjie
-ibus-table-erbi
-ibus-table-wubi

%end

%post

#!/bin/sh
hostip=`ifconfig em1 | sed -n '/inet /{s/.*addr://;s/ .*//;p}'`
/bin/sed -i 's/ONBOOT=no/ONBOOT=yes/' /etc/sysconfig/network-scripts/ifcfg-em1
/bin/sed -i 's/BOOTPROTO=dhcp/BOOTPROTO=static/' /etc/sysconfig/network-scripts/ifcfg-em1
/bin/sed -i  '/BOOTPROTO=/a IPADDR='${hostip}'\nNETMASK=255\.255\.255\.0\nGATEWAY='10\.1\.4\.1''  /etc/sysconfig/network-scripts/ifcfg-em1
service network restart
%end

cobbler配置解析的更多相关文章

  1. cobbler 配置(转载)

    Cobbler介绍 Cobbler 是一个系统启动服务(boot server),可以通过网络启动(PXE)的方式用来快速安装.重装物理服务器和虚拟机,支持安装不同的 Linux 发行版和 Windo ...

  2. cobbler配置

    :ks脚本关闭pxe,这样就不会重复安装 sed -i 's/pxe_just_once: 0/pxe_just_once: 1/g' /etc/cobbler/settings 6:TFTP服务器 ...

  3. NGINX(四)配置解析

    前言 nginx配置解析是在初始化ngx_cycle_t数据结构时,首先解析core模块,然后core模块依次解析自己的子模块. 配置解析过程 nginx调用ngx_conf_parse函数进行配置文 ...

  4. nsq源码阅读笔记之nsqd(一)——nsqd的配置解析和初始化

    配置解析 nsqd的主函数位于apps/nsqd.go中的main函数 首先main函数调用nsqFlagset和Parse进行命令行参数集初始化, 然后判断version参数是否存在,若存在,则打印 ...

  5. configparser_配置解析器

    configparser:配置解析器 import configparser config = configparser.ConfigParser() #配置文件 config[', 'Compres ...

  6. spring+mybaits xml配置解析----转

    一.项目中spring+mybaits xml配置解析 一般我们会在datasource.xml中进行如下配置,但是其中每个配置项原理和用途是什么,并不是那么清楚,如果不清楚的话,在使用时候就很有可能 ...

  7. DNS Bind服务配置解析

    DNS域名解析服务(Domain Name System)是用于解析域名与IP地址对应关系的服务,功能上可以实现正向解析与反向解析: 一.DNS服务器工作模式分类: 1.主服务器:在特定区域内具有唯一 ...

  8. 初识nginx——配置解析篇

    一.nginx的介绍 nginx是由俄罗斯人开发的一款高性能的http和反向代理服务器,也可以用来作为邮件代理.相比较于其他的服务器,具有占用内存少,稳定性高等优势 二.nginx的配置 nginx的 ...

  9. Apache入门 篇(二)之apache 2.2.x常用配置解析

    一.httpd 2.2.x目录结构 Cnetos 6.10 YUM安装httpd 2.2.x # yum install -y httpd 程序环境 主配置文件: /etc/httpd/conf/ht ...

随机推荐

  1. IE 10 如何设置支持CRM4 正常浏览

    通过工具—> 选择兼容性视图 就可以了.具体如下图:

  2. 最新hadoop虚拟机安装教程(附带图文)

    前两天看到有人留言问在什么情况下需要部署hadoop,我给的回答也很简单,就是在需要处理海量数据的时候才需要考虑部署hadoop.关于这个问题在很早之前的一篇分享文档也有说到这个问题,数据量少的完全发 ...

  3. 【python】class之类的定义

    使用class定义类,可以提供一个可选的父类或者基类,如果没有合适的基类,那就使用object作为基类,也可以不写.class FooClass (object)或者class FooClass: v ...

  4. 把存储过程SELECT INTO到临时表

    在开发过程中,很多时候要把结果集存放到临时表中,常用的方法有两种. 一. SELECT INTO1. 使用select into会自动生成临时表,不需要事先创建12 select * into #te ...

  5. MySQL的Join使用

    在MySQL(以5.1为例)中,表连接的语法可以参见MySQL官方手册:MySQL官方手册-JOIN 在查询中,连接的语法类似 SELECT select_expr FROM table_refere ...

  6. UDP丢包问题

    1. 问题描述 PC-A向PC-B发送UDP packet(共16K bytes),如果B机木有及时Read,UDP包将大量丢失. 2. 原因及解决 因为B木有及时接收,socket缓冲区放不下了. ...

  7. [UE4]Character,飞行模式。

    Character 是pawn的子类,可以行走.跳跃.游泳.飞行的Pawn.

  8. 探究CSS中border-top属性的使用

    上一节我们介绍了CSS top属性的用法,那么这节关于CSS border-top属性用法学习起来就会轻松一些,border-top 简写属性把上边框的所有属性设置到一个声明中. 本文向大家描述一下C ...

  9. Linux常用命令的命名来源

    很多人在学习Linux的时候会疑惑:这么多的Linux名,他们都是怎么被定义的?林纳斯是怎么制定如此花样繁多且数量庞大的命令?今天这篇文章可能会帮你解开疑惑. ## 1. 目录缩写 缩写 | 全称 | ...

  10. uva-10562-二叉树

    题意: Homer教授被报道失踪了,我们怀疑这和他最近的研究有关,但是我们确实不知道他最近在研究什么. 侦探们试图侵入他的电脑,再几次失败后才意思到教授的智力超出他们很多............... ...