Tuesday, 23 December 2014

automate kickstart installations in spacewalk #Redhat 6 / CentOS 6

In my previous article ( http://sunlnx.blogspot.in/2014/12/installation-of-spacewalk-centos-66_2.html ), I had written on how to configure and install spacewalk. Here, I would let you know on how to automate the installations using spacewalk.

My Environment:
Hostname: spacewalk
Environment: CentOS 6.6 x86_64
Spacewalk version: 2.2​

For automating the installation of a Linux system a method called kickstart can be used. First, we have to setup a directory structure on the spacewalk server, copy the directory of the below from your CentOS/Redhat DVD to /var/distro-trees/CentOS6.6-x86_64.

- images
- isolinux
- repodata

Next, open the spacewalk console and navigate to the following location:

systems -> kickstart -> distributions -> new distribution.

Next step is to create a kickstart profile for the channel and distribution. Open the spacewalk console and navigate to the following location:

systems -> kickstart -> create new kickstart profile

Enter the following parameters for the new kickstart profile:

Label: CentOS66-minimal
Base channel: CentOS 6.6 Base - x86_64
Kickstartable tree: CentOS6.6-x86_64
Virtualization type: none

Also, have a look at the other tabs to have an idea of the configuration options which are available, possible interesting areas are provided as below snap where it is self-explanatory reader could work themselves.

We are now creating a new virtual machine, so make sure that your spacewalk server is able to resolve the name resolution. I would leave this to reader to configure DNS.

Next, build an ISO image as described below, on which your ISO image(generated.iso) from where you executed the command.

[root@spacewalk ~]# cobbler buildiso
task started: 2014-12-23_112833_buildiso
task started (id=Build Iso, time=Tue Dec 23 11:28:33 2014)
using/creating buildisodir: /var/cache/cobbler/buildiso
building tree for isolinux
copying miscellaneous files
copying kernels and initrds for profiles
generating a isolinux.cfg
generating profile list
done writing config
running: mkisofs -o /root/generated.iso -r -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V Cobbler\ Install -R -J -T /var/cache/cobbler/buildiso
received on stdout: 
received on stderr: I: -input-charset not specified, using utf-8 (detected in locale settings)
Size of boot image is 4 sectors -> No emulation
 26.00% done, estimate finish Tue Dec 23 11:28:34 2014
 51.90% done, estimate finish Tue Dec 23 11:28:34 2014
 77.89% done, estimate finish Tue Dec 23 11:28:34 2014
Total translation table size: 4029
Total rockridge attributes bytes: 1320
Total directory bytes: 4700
Path table size(bytes): 40
Max brk space used 1b000
19272 extents written (37 MB)

ISO build complete
You may wish to delete: /var/cache/cobbler/buildiso
The output file is: /root/generated.iso
[root@spacewalk ~]#

[root@spacewalk ~]# ls -l generated.iso
-rw-r--r-- 1 root root 39469056 Dec 23 11:28 generated.iso
[root@spacewalk ~]# 

On your host, create a new virtual machine and provide it with the generated.iso file to boot from. Upon boot you will see a menu allowing you to specify the Centos66-minimal setup to be installed.

Select this entry and the setup will install a base 64 bit CentOS 6.6 Linux system. If all goes well, this will happen completely automated, without any user intervention whatsoever.

I, would configure new server as a client to the spacewalk server in coming articles.