silenter00 2013-12-07
大纲
一、前言
二、Cobbler 命令详解
三、导入要安装的镜像文件
四、客户端安装操作系统
注,操作系统 CentOS 6.4 x86_64,软件版本 Cobbler-2.4.0-1。(目前最新版)
二、Cobbler 命令详解
1.查看一下Cobbler命令
[root@node2 ~]# cobbler
usage
=====
cobbler <distro|profile|system|repo|image|mgmtclass|package|file> ...
[add|edit|copy|getks*|list|remove|rename|report] [options|--help]
cobbler <aclsetup|buildiso|import|list|replicate|report|reposync|sync|validateks|version> [options|--help]
注,大家可以在上面的显示中可以看到cobbler命令有很多的选项,想获得相关选项的帮助只需要加--help即可。
[root@node2 ~]# cobbler profile --help
usage
=====
cobbler profile add
cobbler profile copy
cobbler profile dumpvars
cobbler profile edit
cobbler profile find
cobbler profile getks
cobbler profile list
cobbler profile remove
cobbler profile rename
cobbler profile report
[root@node2 ~]# cobbler profile add --help
Usage: cobbler [options]
Options:
-h, --help show this help message and exit
--name=NAME Name (Ex: F10-i386-webserver)
--uid=UID
--owners=OWNERS Owners (Owners list for authz_ownership (space
delimited))
--distro=DISTRO Distribution (Parent distribution)
--parent=PARENT Parent Profile
--enable-gpxe=ENABLE_GPXE
Enable gPXE? (Use gPXE instead of PXELINUX for
advanced booting options)
--enable-menu=ENABLE_MENU
Enable PXE Menu? (Show this profile in the PXE menu?)
--kickstart=KICKSTART
Kickstart (Path to kickstart template)
--kopts=KERNEL_OPTIONS
Kernel Options (Ex: selinux=permissive)
--kopts-post=KERNEL_OPTIONS_POST
Kernel Options (Post Install) (Ex: clocksource=pit
noapic)
--ksmeta=KS_META Kickstart Metadata (Ex: dog=fang agent=86)
--proxy=PROXY Proxy (Proxy URL)
--repos=REPOS Repos (Repos to auto-assign to this profile)
--comment=COMMENT Comment (Free form text description)
--virt-auto-boot=VIRT_AUTO_BOOT
Virt Auto Boot (Auto boot this VM?)
--virt-cpus=VIRT_CPUS
Virt CPUs (integer)
--virt-file-size=VIRT_FILE_SIZE
Virt File Size(GB)
--virt-disk-driver=VIRT_DISK_DRIVER
Virt Disk Driver Type (The on-disk format for the
virtualization disk)
--virt-ram=VIRT_RAM Virt RAM (MB)
--depth=DEPTH
--virt-type=VIRT_TYPE
Virt Type (Virtualization technology to use) (valid
options: xenpv,xenfv,qemu,kvm,vmware,openvz)
--virt-path=VIRT_PATH
Virt Path (Ex: /directory OR VolGroup00)
--virt-bridge=VIRT_BRIDGE
Virt Bridge
--dhcp-tag=DHCP_TAG DHCP Tag (See manpage or leave blank)
--server=SERVER Server Override (See manpage or leave blank)
--ctime=CTIME
--mtime=MTIME
--name-servers=NAME_SERVERS
Name Servers (space delimited)
--name-servers-search=NAME_SERVERS_SEARCH
Name Servers Search Path (space delimited)
--mgmt-classes=MGMT_CLASSES
Management Classes (For external configuration
management)
--mgmt-parameters=MGMT_PARAMETERS
Management Parameters (Parameters which will be handed
to your management application (Must be valid YAML
dictionary))
--boot-files=BOOT_FILES
TFTP Boot Files (Files copied into tftpboot beyond the
kernel/initrd)
--fetchable-files=FETCHABLE_FILES
Fetchable Files (Templates for tftp or wget)
--template-files=TEMPLATE_FILES
Template Files (File mappings for built-in config
management)
--RedHat-management-key=REDHAT_MANAGEMENT_KEY
Red Hat Management Key (Registration key for RHN,
Spacewalk, or Satellite)
--redhat-management-server=REDHAT_MANAGEMENT_SERVER
Red Hat Management Server (Address of Spacewalk or
Satellite Server)
--template-remote-kickstarts=TEMPLATE_REMOTE_KICKSTARTS
--clobber allow add to overwrite existing objects
--in-place edit items in kopts or ksmeta without clearing the
other items
2.Cobbler 常用命令详解
cobbler check #检查cobbler配置
cobbler sync #同步配置到dhcp/pxe和数据目录
cobbler list #列出所有的cobbler元素
cobbler import #导入安装的系统镜像
cobbler report #列出各元素的详细信息
cobbler distro #查看导入的发行版系统信息
cobbler profile #查看配置信息
cobbler system #查看添加的系统信息
cobbler reposync #同步yum仓库到本地
(1).cobbler check
12 [root@node2 ~]# cobbler check
No configuration problems found. All systems go.
注,主要用于检查cobbler配置是否有错。
(2).cobbler sync
[root@node2 ~]# cobbler sync
task started: 2013-11-11_133827_sync
task started (id=Sync, time=Mon Nov 11 13:38:27 2013)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/grub-x86_64.efi
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/grub/grub-x86.efi
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering DHCP files
generating /etc/dhcp/dhcpd.conf
rendering TFTPD files
generating /etc/xinetd.d/tftp
cleaning link caches
running post-sync triggers
running Python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running: dhcpd -t -q
received on stdout:
received on stderr:
running: service dhcpd restart
received on stdout: 关闭 dhcpd:[确定]
正在启动 dhcpd:[确定]
received on stderr:
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***
注,同步cobbler配置到数据目录中,更改某些配置后得执行一下,同步一下配置。
(3).cobbler list
[root@node2 ~]# cobbler list
distros: #导入的发行版本
profiles: #安装的配置信息
systems: #增加的系统信息
repos: #yum仓库
images: #存储所有导入发行版的Kernel和initrd镜像用于远程网络启动
mgmtclasses:
packages:
files:
注,用cobbler list 命令可以列出cobbler所有元素。
(4).cobbler import
[root@node2 ~]# cobbler import --help
Usage: cobbler [options]
Options:
-h, --help show this help message and exit
--arch=ARCH OS architecture being imported
--breed=BREED the breed being imported
--os-version=OS_VERSION
the version being imported
--path=PATH local path or rsync location
--name=NAME name, ex 'RHEL-5'
--available-as=AVAILABLE_AS
tree is here, don't mirror
--kickstart=KICKSTART_FILE
assign this kickstart file
--rsync-flags=RSYNC_FLAGS
pass additional flags to rsync
注,cobbler import 命令可以导入我们要安装的镜像文件(ISO文件)。
(5).cobbler report
[root@node2 ~]# cobbler report
distros:
==========
profiles:
==========
systems:
==========
repos:
==========
images:
==========
mgmtclasses:
==========
packages:
==========
files:
==========
注,由于我们还没有导入任何的系统镜像文件,所以这里显示为空。一会我们导入完系统镜像后,就可以看到详细信息。
(6).cobbler distro
[root@node2 ~]# cobbler distro
usage
=====
cobbler distro add
cobbler distro copy
cobbler distro edit
cobbler distro find
cobbler distro list
cobbler distro remove
cobbler distro rename
cobbler distro report
注,cobbler distro 命令不但可以查看导入的发行版系统信息还可以增加与修改等。
(7).cobbler profile
[root@node2 ~]# cobbler profile
usage
=====
cobbler profile add
cobbler profile copy
cobbler profile dumpvars
cobbler profile edit
cobbler profile find
cobbler profile getks
cobbler profile list
cobbler profile remove
cobbler profile rename
cobbler profile report
注,cobbler profile命令不但可以查看Kickstart文件而且还可以编辑与删除此文件。
(8).cobbler system
[root@node2 ~]# cobbler system
usage
=====
cobbler system add
cobbler system copy
cobbler system dumpvars
cobbler system edit
cobbler system find
cobbler system getks
cobbler system list
cobbler system poweroff
cobbler system poweron
cobbler system powerstatus
cobbler system reboot
cobbler system remove
cobbler system rename
cobbler system report
注,cobbler system 命令可以将cobbler的配置安装文件与客户端相关联。下面是具体的案例,
[root@node2 ~]# cobbler system add --name=desktop-xfce-1 \
--profile=Fedora17-xfce \
--mac=52:54:00:b8:5e:8f \
--ip-address=192.168.122.10
[root@node2 ~]# cobbler system add --name=desktop-gnome-1 \
--profile=Fedora17-gnome \
--mac=52:54:00:88:f3:44 \
--ip-address=192.168.122.11
[root@node2 ~]# cobbler system report
(9).cobbler reposync
[root@node2 ~]# cobbler reposync
task started: 2013-11-11_144127_reposync
task started (id=Reposync, time=Mon Nov 11 14:41:27 2013)
hello, reposync
run, reposync, run!
*** TASK COMPLETE ***
注,cobbler reposync命令可以同步远程的yum源到本地。
相关阅读: