Spacewalk 2.4 cobbler, 1 network adapter, CentOS

This tutorial works the same for CentOS 7 as CentoS 6.

Before folowing this tutorial one Base Channel and Child Channel must be created in Spacewalk server.

For CentOS 6 use:
Create CentOS 6 Base Software Channel
Create CentOS 6 Child Channel, Spacewalk

For CentOS 7 use:
Create CentOS 7 Base Software Channel
Create CentOS 7 Child Channel, Spacewalk

Software chennel must be synchronized with --sync-kickstart option.

I am using this mikrotik cheat to boot from PXE.

In this case i only need one network adapter for Spacewalk server. So here is how i prepare cobbler for PXE boot:
#get ip address of eth0 adapter
ipaddress=$(ifconfig | grep "inet.*cast" | sed "s/[: ]/\n/g" | grep -m1 "[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+")

#check if something is in varable
echo $ipaddress
#go to the next steps only if the ir correct IP address of spacewalk server

#set up server and next_server in cobbler configuration
sed -i "s/^server:.*/server: `echo $ipaddress`/" /etc/cobbler/settings
sed -i "s/^next_server:.*/next_server: `echo $ipaddress`/" /etc/cobbler/settings

#restart cobbler
service cobblerd restart
#this will show something like
#Stopping cobbler daemon:                                   [  OK  ]
#Starting cobbler daemon:                                   [  OK  ]

#sync cobbler configuration
cobbler sync

#check pre-requsites
cobbler check
#this will show something like
#1 : you need to set some SELinux content rules to ensure cobbler serves content correctly in your SELinux environment, run the following: /usr/sbin/semanage fcontext -a -t public_content_t "/var/lib/tftpboot/.*" && /usr/sbin/semanage fcontext -a -t public_content_t "/var/www/cobbler/images/.*"
#2 : you need to set some SELinux rules if you want to use cobbler-web (an optional package), run the following: /usr/sbin/semanage fcontext -a -t httpd_sys_content_rw_t "/var/lib/cobbler/webui_sessions/.*"
#3 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'yum install cobbler-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely.  Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'yum install cobbler-loaders' command is the easiest way to resolve these requirements.
#4 : change 'disable' to 'no' in /etc/xinetd.d/rsync
#5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
#6 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
#7 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

#install must have selinux rules
semanage fcontext -a -t public_content_t "/var/lib/tftpboot/.*"
semanage fcontext -a -t public_content_t "/var/www/cobbler/images/.*"

#do the sync
cobbler sync
#this should report something like
#task started: 2016-04-05_155715_sync
#task started (id=Sync, time=Tue Apr  5 15:57:15 2016)
#running pre-sync triggers
#cleaning trees
#removing: /var/www/cobbler/images/centos-6-base-x86_64:1:SpacewalkDefaultOrganization
#removing: /var/lib/tftpboot/pxelinux.cfg/default
#removing: /var/lib/tftpboot/grub/images
#removing: /var/lib/tftpboot/grub/efidefault
#removing: /var/lib/tftpboot/images/centos-6-base-x86_64:1:SpacewalkDefaultOrganization
#removing: /var/lib/tftpboot/s390x/profile_list
#copying bootloaders
#copying: /usr/share/syslinux/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
#copying: /usr/share/syslinux/menu.c32 -> /var/lib/tftpboot/menu.c32
#copying: /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
#copying distros
#copying files for distro: centos-6-base-x86_64:1:SpacewalkDefaultOrganization
#trying hardlink /var/satellite/rhn/kickstart/1/centos-6-base-x86_64/images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos-6-base-x86_64:1:SpacewalkDefaultOrganization/vmlinuz
#trying hardlink /var/satellite/rhn/kickstart/1/centos-6-base-x86_64/images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos-6-base-x86_64:1:SpacewalkDefaultOrganization/initrd.img
#trying hardlink /var/satellite/rhn/kickstart/1/centos-6-base-x86_64/images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos-6-base-x86_64:1:SpacewalkDefaultOrganization/vmlinuz
#trying hardlink /var/satellite/rhn/kickstart/1/centos-6-base-x86_64/images/pxeboot/initrd.img -> /var/www/cobbler/images/centos-6-base-x86_64:1:SpacewalkDefaultOrganization/initrd.img
#copying images
#generating PXE configuration files
#cleaning link caches
#generating PXE menu structure
#running post-sync triggers
#running python triggers from /var/lib/cobbler/triggers/sync/post/*
#running python trigger cobbler.modules.sync_post_restart_services
#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 ***

No comments: