cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Cloud



Etc


Reference














.

middleware:iac:cobbler:index.html



Middleware

Cobbler

References

Internal References

Technical Terms

Technical Terms Explanation
Distro OS distribution (OS Image)
kernel, initrd, variables, install tree
Profile Installing Setting.
If you install OS, you select proile's name.
kickstart, variables(override distro)
Repo yum mirror
System interfaces, variables(override profile)




Check Commands

Command Operation
cobbler check Checking for Problems of cobbler
cobbler list list distros, profiles, systems, repos and images
cobbler report list detail distros, profiles, systems, repos and images
cobbler distro list list Distribution
cobbler distro report --name=fedora17-x86_64 detailes of distro
cobbler profile list list profiles
cobbler profile report --name=centos5-x86_64 detailes of profile
cobbler status list the output of used cobbler
cobbler repo report
Check Importat Configurations of Profiles
# cobbler profile report |grep -E "Name|Distribution|Kickstart|Proxy" |grep -Ev "Servers|Metadata"
Name                           : centos5.9-x86_64
Distribution                   : centos5.9-x86_64
Kickstart                      : /var/lib/cobbler/kickstarts/sample.ks
Proxy                          :
Name                           : centos5.8-x86_64
Distribution                   : centos5.8-x86_64
Kickstart                      : /var/lib/cobbler/kickstarts/sample.ks
Proxy                          :

Configuring Commands

Command Operation
cobbler sync


Distro Configuration

Checking Distro

cobbler distro list

Importing OS Image

Imported Files : /var/www/cobbler/ks_mirror/NAME/

default configuration : /etc/cobbler/distro_signatures.json

From DVD

1image
shopt -s dotglob
mount -t iso9660 -o loop V41362-01.iso /mnt/cdrom
cobbler import --path=/mnt/cdrom/ --name=oracle6.5
cobbler distro list

umount /mnt/cdrom
multi images
wget -c http://ftp.riken.jp/Linux/centos/5.10/isos/x86_64/CentOS-5.10-x86_64-bin-DVD-1of2.iso  <- -c:continue
wget -c http://ftp.riken.jp/Linux/centos/5.10/isos/x86_64/CentOS-5.10-x86_64-bin-DVD-2of2.iso  <- -c:continue

shopt -s dotglob
mkdir /mnt/cdrom
mount -t iso9660 -o loop /iso/CentOS-5.7-x86_64-bin-DVD-1of2.iso /mnt/cdrom
mkdir /tmp/centos57
cp -rf /mnt/cdrom/* /tmp/centos57/
umount /mnt/cdrom
mount -t iso9660 -o loop /iso/CentOS-5.7-x86_64-bin-DVD-2of2.iso /mnt/cdrom
cp -rf /mnt/cdrom/* /tmp/centos57/
umount /mnt/cdrom

cobbler import --path=/tmp/centos57 --name=centos5.7 --kickstart=/var/lib/cobbler/kickstarts/kickstart_v5.ks
cobbler distro list

rm -rf /tmp/centos57

From Internet

cobbler import --path=rsync://ftp.jaist.ac.jp/pub/Linux/CentOS/5.8/os/x86_64/ --name=CentOS5.8-x86_64 
cobbler import --path=rsync://ftp.jaist.ac.jp/pub/Linux/Fedora/releases/7/Fedora/i386/os --name=f7 
cobbler import --path=rsync://ftp.jaist.ac.jp/pub/Linux/CentOS/5.5/os/i386/ --name=CentOS5.5-i386


Setting Distro

#rename
cobbler distro rename --name=CentOS5-i386 --newname=CentOS5-2-i386
#copy
cobbler distro copy --name=CentOS5-i386 --newname=CentOS5-2-i386
#remove
cobbler distro remove --name=centos5.7-xen-x86_64


Profile Configuration

Checking Profile

cobbler profile list                             <- list profiles
cobbler profile report --name=centos5-x86_64     <- detailes of profile

cobbler profile report |grep -E "Name|Distribution|Kickstart|Proxy" |grep -Ev "Servers|Metadata"

Configuring Profile

#edit
cobbler profile edit --name=CentOS6.4-puppet_server --kickstart=/var/lib/cobbler/kickstarts/puppet_server.ks
#copy
cobbler profile copy --name=CentOS6.4-x86_64 --newname=CentOS6.4-test
cobbler profile copy --name=CentOS5-i386 --newname=CentOS5-2-i386
#add
cobbler profile add --name=squad_centos_x86_64 --distro=centos57-x86_64 --kickstart=/etc/cobbler/squad_centos_x86_64.ks
cobbler profile add --name=mysql-server --distro=CentOS5.8-x86_64 --kickstart=/var/lib/cobbler/kickstarts/mysql-server.ks
cobbler profile remove --name=centos7.5


Repo Configuration

configuration of yum mirror

Configuring Repo

#check
cobbler repo report
cobbler repo report --name="myrepo"
#adding mirror repository
cobbler repo add --name=centos5-x86_64-os --mirror=http://ftp.iij.ad.jp/pub/linux/centos/5/os/x86_64/

#adding local repository
cobbler repo add --name=centos5-x86_64-origs --mirror=/home/hoge/rpm/RPMS
cobbler repo add --name="myrepo" --mirror=/var/www/html/myrepo
#sync repository (start the copying files from mirrors)
cobbler reposync --only=CentOS6.2-x86_64-epel
cobbler reposync
#remove
cobbler repo remove --name=CentOS5-i386


System Configuration

Configuring System

#edit
cobbler system edit --name=SL6.0-x86_64-template --interface=eth0 --virt-bridge=br0
cobbler system edit --name=SL6.0-x86_64-template --interface=eth1 --virt-bridge=virbr0
cobbler system edit --name=SL6.0-x86_64-template --virt-cpus=2 --virt-file-size=16
cobbler system edit --name=SL6.0-x86_64-template --kopts="serial console=ttyS0,115200" --kopts-post="console=ttyS0,115200"
cobbler system edit --name=SL6.0-x86_64-template  --kickstart=/var/lib/cobbler/kickstarts/SL6.0-x86_64-template.ks
#add
cobbler system add --name=test-server --mac=00:0C:29:AA:AA:AA --profile=f7-i386






Cobbler memo

Kickstart of cobbler

Where is Kickstart file
#cobbler report |grep -E "Name|kickstarts|Proxy" |grep -v Server
Name                           : centos5.9-xen-x86_64
Kickstart                      : /var/lib/cobbler/kickstarts/sample.ks
Proxy                          :
Name                           : centos5.8-x86_64
Kickstart                      : /var/lib/cobbler/kickstarts/sample.ks
Proxy                          :
What is the SNIPPET in Kickstart
%packages
$SNIPPET('XXXXXX')

%pre
$SNIPPET('XXXXXX')

%post
$SNIPPET('XXXXXX')
$SNIPPET('snippet_name')
->
/var/lib/cobbler/snippets/per_system/$snippet_name/$system_name
or /var/lib/cobbler/snippets/per_profile/$snippet_name/$profile_name
or /var/lib/cobbler/snippets/per_distro/$snippet_name/$distro_name
or /var/lib/cobbler/snippets/$snippet_name
or /var/lib/cobbler/snippets/$snippet_name/$profile_name

Example

%packages
$SNIPPET('func_install_if_enabled')
->
%packages
/var/lib/cobbler/snippets/per_profile/func_install_if_enabled/$profile_name
GROUPSNIPPET Real File
%packages $SNIPPET('func_install_if_enabled') /var/lib/cobbler/snippets/per_profile/func_install_if_enabled/$profile_name
%post $SNIPPET('func_useradd') /var/lib/cobbler/snippets/per_profile/func_useradd
How to find snipett files.
# find /var/lib/cobbler/snippets -name "*6.7*"

# grep -r xxxxx.sh /var/lib/cobbler/snippets

yum

/etc/yum.repos.d/cobbler-config.repo

[core-0]
name=core-0
baseurl=http://192.168.0.xxx/cobbler/ks_mirror/oracle6.5-x86_64
enabled=1
gpgcheck=0
priority=1

[core-1]
name=core-1
baseurl=http://192.168.0.xxx/cobbler/ks_mirror/oracle6.5-x86_64/LoadBalancer
enabled=1
gpgcheck=0
priority=1

(abbr)










Installing Cobbler

yum

#Check rpm file with browser
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-X-Y.noarch.rpm

# yum install cobbler dhcp

Your system is installed createrepo, yum-utils, tftp-server and so on for dependencies.


Configuring Cobbler

Preparation for tftp, dhcp, pexeboot

tftp

# vi /etc/xinetd.d/tftp
disable                    = no

rsync

# vi /etc/xinetd.d/rsync
disable                    = no

DHCP

# cp -p /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.org
# cp -p /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.org
# vi /etc/cobbler/dhcp.template
 subnet 192.168.0.0 netmask 255.255.255.0 {
     option routers             192.168.0.5;
     option domain-name-servers 192.168.0.5;
     range dynamic-bootp        192.168.0.30 192.168.0.40;
# diff /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.org

pxeboot

# cp -p /etc/cobbler/pxe/pxedefault.template /etc/cobbler/pxe/pxedefault.template.org
# vi /etc/cobbler/pxe/pxedefault.template

# diff /etc/cobbler/pxe/pxedefault.template /etc/cobbler/pxe/pxedefault.template.org

SElinux

#getenforce <- Check Disable
Enforcing   <- SELinux Enable
Permissive  <- SELinux Disable

# cp -p  /etc/selinux/config /etc/selinux/config.org
# vi /etc/selinux/config
SELINUX=disabled

#setenforce 0   <- Set SELinux Disable

Preparation for cobbler

Configuring cobbler

# cp -p /etc/cobbler/settings /etc/cobbler/settings.org
# vi /etc/cobbler/settings

 # set to 1 to enable Cobbler's DHCP management features.
 manage_dhcp: 1
 # if using cobbler with manage_dhcp, put the IP address
 next_server: 192.168.0.5
 # this is the address of the cobbler server
 server: 192.168.0.5


# diff /etc/cobbler/settings /etc/cobbler/settings.bak

root password

# openssl passwd -1 -salt "cobbler" "mypassword"
$1$cobbler$zBO0ugOBMyDWhTR8MYoa70
# vi /etc/cobbler/settings
default_password_crypted: "$1$cobbler$zBO0ugOBMyDWhTR8MYoa70"

start service

# /etc/init.d/httpd start
# /etc/init.d/cobblerd start
# cobbler check
# cobbler sync
# /etc/init.d/dhcpd start

## If you needed after command "cobbler check" , you do the follow command.
# cobbler get-loaders
# yum install pykickstart

Importing OS Image

ex1) Import from DVD. It takes about 60 minutes.

# wget -c http://ftp.iij.ad.jp/pub/linux/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-minimal.iso  <- -c:continue

# mkdir /mnt/dvd
# mount -t iso9660 -o loop cdromCentOS-6.5-x86_64-minimal.iso /mnt/dvd
or
# mount /dev/dvd /mnt/dvd

# cobbler import --path /mnt/dvd --name=centos65
# cobbler sync
# cobbler report

ex2) Import from Web Sites. It takes about 60 minutes.

##Browser ftp://ftp.jaist.ac.jp/pub/Linux/CentOS/5.10/os/x86_64/
# cobbler import --path=rsync://ftp://ftp.jaist.ac.jp/pub/Linux/CentOS/5.10/os/x86_64/ --name=CentOS5.10-x86_64 

Preparation for kickstart

create kickstart file

# cp /var/lib/cobbler/kickstarts/sample.ks /var/lib/cobbler/kickstarts/my_cobbler.ks
# vi /var/lib/cobbler/kickstarts/my_cobbler.ks
  firewall --disabled
  keyboard jp106
  lang ja_JP.UTF-8
  timezone Asia/Tokyo

  @base
  @core
  @editors
  @japanese-support
  @development-libs
  @legacy-software-support

  # my script
  mkdir /home/test
  chmod 777 /home/test

Change Kickstart

# cobbler profile add --name=squad_centos_x86_64 --distro=centos57-x86_64 --kickstart=/var/lib/cobbler/kickstarts/my_cobbler.ks

##Check
# cobbler report
  Kickstart                      : /var/lib/cobbler/kickstarts/my_cobbler.ks

Internal Refalence


Boot Hardware for Installing OS with cobbler

boot: profilename
or
boot: menu    <- list profiles




Cobbler Web

Install

#yum install cobbler-web

Configuration

# cp -p /etc/cobbler/modules.conf /etc/cobbler/modules.conf.org
# vi /etc/cobbler/modules.conf 
 [authentication]
 module = authn_pam

 [authorization]
 module = authz_ownership

# vi /etc/cobbler/users.conf
[admins]
testuser1 = ""    #this is os user
testuser2 = ""    #this is os user


#/etc/init.d/httpd restart
#/etc/init.d/cobbler restart

How to use of cobber web

http://<IP Address>/cobbler_web



middleware/iac/cobbler/index.html.txt ยท Last modified: 2018/07/18 by admin

Page Tools