Difference between revisions of "Cobbler"
From Bashlinux
(→How to fix CX: 'serializer: error loading collection profile. Check /etc/cobbler/modules.conf) |
(→How to force NICs to be named ethX instead emX, pXpY or any other weird name) |
||
Line 56: | Line 56: | ||
== Systems == |
== Systems == |
||
=== How to force NICs to be named <code>ethX</code> instead <code>emX</code>, <code>pXpY</code> or any other weird name === |
=== How to force NICs to be named <code>ethX</code> instead <code>emX</code>, <code>pXpY</code> or any other weird name === |
||
− | * |
+ | * Edit the distro settings and add to the <code>append</code> field |
biosdevname=0 |
biosdevname=0 |
||
Revision as of 00:59, 11 July 2015
Setup
How to install Cobbler on CentOS
- Install cobbler and its dependencies
# yum -y install cobbler cobbler-web pykickstar
- Enable Cobbler and the dependent services
# chkconfig httpd on # chkconfig xinetd on # chkconfig cobblerd on
- Start Cobbler and the dependent services
# service httpd start # service xinetd start # service cobblerd start
How to install Cobbler on Ubuntu
- Install cobbler and its dependencies
# apt-get -y install cobbler cobbler-web python-ldap genisoimage bind9 isc-dhcp-server xinetd
- Setup the tftp service on /etc/xinetd.d/tftp
service tftp { disable = no socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -B 1380 -v -s /var/lib/tftpboot per_source = 11 cps = 100 2 flags = IPv4 }
- Remove IPv6 from /etc/default/tftpd-hpa
TFTP_ADDRESS="0.0.0.0:69"
- Enable Cobbler and its dependencies
# update-rc.d xinetd defaults # update-rc.d apache2 defaults # update-rc.d cobbler defaults
- Enable Apache's rewrite module
# a2enmod rewrite
- Start Cobbler and its dependent services
# service xinetd start # service apache2 start # service cobbler start
How to setup user accounts to access Cobbler
Cobbler uses Apache's htdigest, so in order to create an account for the user cobbler do:
htdigest /etc/cobbler/users.digest "Cobbler" cobbler
Systems
How to force NICs to be named ethX
instead emX
, pXpY
or any other weird name
- Edit the distro settings and add to the
append
field
biosdevname=0
How to add systems to Cobbler
# cobbler system add --name=desktop-xfce-1 \ --profile=Fedora17-xfce \ --mac=52:54:00:b8:5e:8f \ --ip-address=10.20.30.40
Distros
How to create a bootable iso
- With a particular set of profiles
# cobbler buildiso --profiles="profile1 profile2 ..."
- With a particular distro
# cobbler buildiso --standalone --distro="distro1" --profiles="profile1 profile2"
How to add multiple discs from CentOS
- Create the proper directories and mount the discs
# export DISTRO=CentOS-6.2-x86_64 # export KS_MIRROR=/var/www/cobbler/ks_mirror # mkdir -p /mnt/el{1,2} # mount -o loop $DISTRO-bin-DVD1.iso /mnt/el1 # mount -o loop $DISTRO-bin-DVD2.iso /mnt/el2
- Import the first disc with cobbler
# cobbler import --name=$DISTRO --path=/mnt/el1
- Import the second disc with rsync
# rsync -a /mnt/el2/ $KS_MIRROR/$DISTRO --exclude-from=/etc/cobbler/rsync.exclude --progress
- Update repository
# createrepo -c cache -s sha --update --groupfile $(ls $KS_MIRROR/$DISTRO/repodata/*comps.xml) $KS_MIRROR/$DISTRO
How to add a DOS based distro to cobbler
- Place original imagess on ks_mirror
# mkdir -p /var/www/cobbler/ks_mirror/seagate # cp SeaTools.ima /var/www/cobbler/ks_mirror/seagate/ # cp /var/lib/tftpboot/memdisk /var/www/cobbler/ks_mirror/seagate/
- Create distro
# cobbler distro add --breed=other --name=seagate --os-version=msdos --initrd=/var/www/cobbler/ks_mirror/seagate/SeaTools.ima --kernel=/var/www/cobbler/ks_mirror/seagate/memdisk
- Create profile, this could be done in cobbler web
How to add Ubuntu releases to Cobbler
- Import the distro into cobbler if is already recognized on cobbler
# cobbler import --path=/var/www/cobbler/ks_mirror/ubuntu-server-LTS-10_04-x86_64/ --breed=ubuntu --name=ubuntu-server-LTS-10_04 --os-version=lucid --arch=x86_64 --kickstart=/var/lib/cobbler/kickstarts/ubuntu-server-10.seed
- Add the proper distro name to code.py
vi /usr/lib/python2.7/site-packages/cobbler/codes.py rm -f /usr/lib/python2.7/site-packages/cobbler/codes.pyc rm -f /usr/lib/python2.7/site-packages/cobbler/codes.pyo
- Copy the CD in order to create a repository
# mkdir -p /var/www/cobbler/ks_mirror/ubuntu-server-LTS-10_04-x86_64 # rsync -avuz /opt/buffalo/distro/UBUNTU/* /var/www/cobbler/ks_mirror/ubuntu-server-LTS-10_04-x86_64/
- Add the distro
# cobbler distro add --breed=ubuntu --name=ubuntu-server-LTS-10_04 --os-version=lucid --arch=x86_64 --initrd=/var/www/cobbler/ks_mirror/ubuntu-server-LTS-10_04-x86_64/install/netboot/ubuntu-installer/amd64/initrd.gz --kernel=/var/www/cobbler/ks_mirror/ubuntu-server-LTS-10_04-x86_64/install/netboot/ubuntu-installer/amd64/linux
How to validate a Ubuntu/Debian preseed file
# debconf-set-selections -c preseed.cfg
How to ad a newer non-listed Ubuntu release
Assuming we want to add oneiric
- Add oneiric to ubuntu array in the file /usr/lib/python2.7/site-packages/cobbler/
- Remove .pyc .pyo files
- Mount ubuntu server oneiric dvd
# mkdir -p /mnt/dvd # mount /dev/cdrom /mnt/dvd # cobbler import --name=ubuntu-server-11_10 --path=/mnt/dvd # cobbler distro add --arch=x86_64 --breed=ubuntu --name=ubuntu-server-11_10 --os-version=oneiric --initrd=/var/www/cobbler/ks_mirror/ubuntu-server-11_10/install/netboot/ubuntu-installer/i386/initrd.gz --kernel=/var/www/cobbler/ks_mirror/ubuntu-server-11_10/install/netboot/ubuntu-installer/i386/linux
- Restart server
# service cobblerd restart # cobbler sync
Koan
Client side helper for Cobbler
How to list the available profiles
koan --server=cobbler.bashlinux.com --list-profiles
How to reprovision a server from the client side
koan --replace-self --server=cobbler.bashlinux.com --profile=BLNX_DB
Troubleshooting
How to fix dpkg if cobbler fail to installs on Ubuntu
On Ubuntu, if the interface mask is set to 00000000
in all devices then the configuration might fail.
To fix it, do:
- Get the destination of the main
Iface
from /proc/net/route - Change
$Mask
with$Destination
in /var/lib/dpkg/info/cobbler.config and put the mask you got from the previous step - Reconfigure the cobbler and cobbler-web
# dpkg --configure cobbler # dpkg --configure cobbler-web
How to fix CX: 'serializer: error loading collection profile. Check /etc/cobbler/modules.conf
Check for empty files under /var/lib/cobbler/config/profiles.d