Cobbler

Install

yum -y install cobbler tftp-server dhcp httpd xinetd

Setting

#vi /etc/cobbler/settings
161: manage_dhcp: 1
362: server: your_server_ip
cobbler check

dhcp.template

# more dhcp.template
# ******************************************************************
# Cobbler managed dhcpd.conf file
#
# generated from cobbler dhcp.conf template ($date)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
#
# ******************************************************************
 
ddns-update-style interim;
 
allow booting;
allow bootp;
#if $omapi_enabled
omapi-port $omapi_port;
#end if
 
ignore client-updates;
set vendorclass = option vendor-class-identifier;
 
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
 
ddns-update-style interim;
 
allow booting;
allow bootp;
 
ignore client-updates;
set vendorclass = option vendor-class-identifier;
 
subnet 192.168.0.0 netmask 255.255.0.0 {
     option routers             192.168.0.1;
     option domain-name-servers 192.168.0.1;
     option domain-name         "yepn.net";
     option subnet-mask         255.255.0.0;
     range dynamic-bootp        192.168.0.201 192.168.0.254;
     filename                   "/pxelinux.0";
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
}

IOS file import

Here follows an example of a Cobbler setup for provisioning Centos 5 with x86 architecture, using the most known extra repositories and some sample public mirror. The same procedure can be easily adapted to other Centos versions or architectures, changing the specified urls and arch options. You need at least 5Gb of space in /var/www/cobbler for importing the official DVD and not less that 30Gb of space for mirroring the additional repositories.

1 - Initial import from a Centos DVD. Place the DVD in your CD drive:

mount -t auto /dev/hdc /media/cdrom (if not autmounted)
cobbler import --mirror=/media/cdrom --name=Centos5 --arch=x86

If you have an ISO, you can import directly from it:

mount -t auto -o loop  /path/to/file.iso /mnt/
cobbler import --mirror=/mnt --name=Centos5 --arch=x86
umount /mnt

After this import, that can last some minutes, the iso or DVD is no longer necessary for cobbler: all its files are copied.

2- Sync and show what has been done: you should hve 2 distros and 2 profiles for normal and xen Centos provisioning.

cobbler sync
cobbler list
distro Centos5-x86
     profile Centos5-x86
distro Centos5-xen-x86
     profile Centos5-xen-x86

2-1

cobbler profile add --name=任意 --distro=ディストリビューション名 --kickstart=<ks_fileのパス>
ディストリビューション名はcobbler report を実行した際のdistro項目を参照する
nameは分かりやすい任意の名前にする
キックスタートでそれぞれ実行する。
 
※ /var/lib/cobbler/kickstartsにキックスタート設定ファイル by default

3- Add extra repositories from sample mirrors (find a list of official mirrors on Centos site) Updates:

cobbler repo add --name=Centos5-UPDATES --mirror=ftp://ftp.sunet.se/pub/Linux/distributions/centos/5/updates/i386/ --priority=40 --createrepo-flags="-c cache" --arch=x86

CentosPlus:

cobbler repo add --name=Centos5-CENTOSPLUS --mirror=ftp://ftp.sunet.se/pub/Linux/distributions/centos/5/centosplus/i386/ --priority=40 --createrepo-flags="-c cache" --arch=x86

Extras:

cobbler repo add --name=Centos5-EXTRAS --mirror=ftp://ftp.sunet.se/pub/Linux/distributions/centos/5/extras/i386/ --priority=40 --createrepo-flags="-c cache" --arch=x86

EPEL:

cobbler repo add --name=Centos5-EPEL --mirror=http://www.mirrorservice.org/sites/download.fedora.redhat.com/pub/epel/5/i386/ --priority=50 --createrepo-flags="-c cache"

RPMFORGE (Dag and Others):

cobbler repo add --name=Centos5-RPMFORGE --mirror=http://apt.sw.be/redhat/el5/en/i386/dag/ --priority=90 --createrepo-flags="-c cache"

Note that EPEL and RPMFORGE may have problems when used at the same time. The use of priorities should solve most of them. If you want to use both, decide which one has to be selected first (lower priority) in case of conflicting packages.

4- Mirror your mirrors

cobbler sync   #(syncs the newly added repos)
cobbler reposync   #(makes a local mirror or the defined mirrors, requires Internet connection and may take a lot of time, especially at the first run).

It's a good practice to make a daily cron run of “cobbler reposync” in order to have your mirrors automatically updated.

常用命令

导入ISO文件

非标准linux系统
mount -t auto -o loop  /path/to/CentOS-6.1-minimal-x86_64.iso /mnt/
cobbler distro add --name=Centos-6.1-minimal-x86_64 --kernel=/mnt/isolinux/vmlinuz --initrd=/mnt/isolinux/initrd.img

标准linux系统导入方法

cobbler import --path=/mnt --name=CentOS-6.1-minimal-x86_64

kickstart例

# Kickstart file automatically generated by anaconda.
 
#version=DEVEL
text
install
#url --url=http://ftp.riken.jp/Linux/scientific/6.1/x86_64/os
url --url=http://cobbler.mobcon.inside/cobbler/ks_mirror/CentOS-6.1-x86_64/
 
lang en_US.UTF-8
keyboard jp106
network --onboot yes --device eth1 --bootproto dhcp --noipv6
rootpw  --iscrypted $6$Ykz4bOipJbF1cSqA$NY0wMFMwYrQpywSnczC54BRshEW6E6dkvAwaKXxt4eYNF5qBLXnH6m22aLTZerX4jzC501XeXV3qfmm6vXbAX0
authconfig --enableshadow --passalgo=sha512
firewall --disabled
selinux --disabled
timezone --utc Asia/Tokyo
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all
part /boot --fstype ext4 --size=100
part swap --size=8192
part / --fstype ext4 --size=1 --grow
reboot
 
repo --name="Centos Linux"  --baseurl=http://ftp.riken.jp/Linux/centos/6.1/os/x86_64 --cost=100
#repo --name="EPEL-6-x86_64" --baseurl=http://download.fedora.redhat.com/pub/epel/6/x86_64 --cost=100
 
%packages
@base
@console-internet
@core
@debugging
@directory-client
@hardware-monitoring
@japanese-support
@large-systems
@network-file-system-client
@performance
@perl-runtime
@system-management-snmp
@scalable-file-systems
@server-platform
@system-management
@system-admin-tools
pax
oddjob
sgpio
certmonger
pam_krb5
krb5-workstation
perl-DBD-SQLite
git
ipmitool
OpenIPMI
OpenIPMI-devel
OpenIPMI-libs
OpenIPMI-perl
OpenIPMI-python
ruby
ruby-devel
ruby-libs
ruby-augeas
facter
func
pigz
tree
%end
 
services --enabled ipmi
services --disabled yum-updatesd, cups, kudzu, gpm, smartd, xfs, sendmail, netfs, nfs, nfslock, portmap, bluetooth
 
%post --log=/root/ks-post.log
service ipmi start
wget -O- http://cobbler.mobcon.inside/scripts/ipsetting.sh|bash
 
rpm -i http://cobbler.mobcon.inside/scripts/epel-release-6-5.noarch.rpm
rpm --import http://cobbler.mobcon.inside/scripts/RPM-GPG-KEY-ZABBIX-JP
rpm -i http://cobbler.mobcon.inside/scripts/zabbix-jp-release-6-4.noarch.rpm
rpm -i http://cobbler.mobcon.inside/scripts/puppet-2.7.1-1.x86_64.rpm
puppet agent --mkusers
chkconfig puppet on
/home1/yepnnet/public_html/wiki/data/pages/cobbler.txt · 最后更改: 2012/01/03 23:03 由 admin
到顶部
CC Attribution-Noncommercial-Share Alike 3.0 Unported
chimeric.de = chi`s home Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0