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. [转]Maven中profile和filtering实现多个环境下的属性过滤

    背景 项目构建的时候,需要根据不同的场景来改变项目中的属性资源,最为常见的莫过于数据库连接配置了,试想有生产环境.测试缓存.发布环境等,需要为不同的场景下来动态的改变数据库的连接配置.而使用maven ...

  2. jsp 中变量作用域:pageScope、requestScope、sessionScope、applicationScope

    jsp 中,变量的作用域,一共有4种: pageScope:表示变量只能在本页面使用. requestScope:表示变量能在本次请求中使用. sessionScope:表示变量能在本次会话中使用. ...

  3. POJ1639顶点度限制最小生成树

    题目:http://poj.org/problem?id=1639 见汪汀的<最小生成树问题的拓展>. 大体是先忽略与根节点相连的边,做一遍kruscal,得到几个连通块和一个根节点: 然 ...

  4. FastDFS 环境搭建

    原文地址:FastDFS 环境搭建 博客地址:http://www.extlight.com 一.前言 最近闲下来,整理了一下笔记,今天就分享一下 FastDFS 环境搭建吧. 二.介绍 2.1 Fa ...

  5. SpringCloud初体验:五、Sidecar 将 PHP 这类非 Java 生态语言的服务接入 Spring Cloud

    先起一个 Sidecar 服务,一个PHP服务一个应用,和PHP服务部署在同一台机子,通过 localhost 访问,这样就解决了网络开销,相当于本地进程间调用 Sidecar 服务比较简单, 1.这 ...

  6. asp.net如何使用cookie(创建、保存、读取)

    Cookie的用法也和ASP中差不多.比如我们建立一个名为aspcn,值为大众的cookie HttpCookie cookie = new HttpCookie("aspcn") ...

  7. Juery 实现淡出 淡现效果

    HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w ...

  8. ios之gcd

    看这里吧 http://www.jianshu.com/p/3a5a55e50e84

  9. linux下maven项目clean失败

    今天在linux下创建了一个项目自动化发布的脚本,在执行到 mvn clean package -Dmaven.test.skip=true 的时候,项目clean失败 查下下度娘,windows下导 ...

  10. 9-16Jenkins-1第一个任务

    jenkins安装搭建 #mac安装jenkins brew install jenkins #或下载war包 java -jar jenkins.war 第一个jenkins任务 创建一个自由风格的 ...