Loading Up the Server with Useful Stuff
Any files you wish to make available from your new server have to live under the /var/www/html directory. To begin with, therefore, we’ll create a directory structure that’s suitable for our server’s intended purpose with these commands:
mkdir -p /var/www/html/centos/57 mkdir -p /var/www/html/centos/62 mkdir -p /var/www/html/scientific/57 mkdir -p /var/www/html/scientific/62
This will give you a set of directories in which to house the latest versions (as at the time of writing) of the two principal Red Hat ‘clone’ distributions: Centos and Scientific Linux. If you prefer only to use Centos or only to use Scientific, that’s fine: leave out the commands that don’t apply. Similarly, if you are not interested in ever installing a version 5.x Red Hat server, or never want to use version 6.x, leave out the directory entries that are irrelevant to you. Personally, I use both distros and both versions, so I need the complete set of folders, as shown. Of course, if you want to use Kickstart to install the genuine, original Red Hat Enterprise Server, you can add an appropriate set of directories for that too… but being a cheapskate, I’m not going to pursue that point here.
Having created the appropriate directories, you need to populate them with the actual software. These commands will do the deed:
cd /var/www/html/centos wget http://mirror.aarnet.edu.au/pub/centos/5.7/isos/x86_64/CentOS-5.7-x86_64-bin-DVD-1of2.iso wget http://mirror.aarnet.edu.au/pub/centos/5.7/isos/x86_64/CentOS-5.7-x86_64-bin-DVD-2of2.iso wget http://mirror.aarnet.edu.au/pub/centos/6.2/isos/x86_64/CentOS-6.2-x86_64-bin-DVD1.iso wget http://mirror.aarnet.edu.au/pub/centos/6.2/isos/x86_64/CentOS-6.2-x86_64-bin-DVD2.iso cd /var/www/html/scientific wget http://mirror.aarnet.edu.au/pub/scientific/57/iso/x86_64/dvd/SL.57.090911.DVD.x86_64.disc1.iso wget http://mirror.aarnet.edu.au/pub/scientific/57/iso/x86_64/dvd/SL.57.090911.DVD.x86_64.disc2.iso wget http://mirror.aarnet.edu.au/pub/scientific/6.1/x86_64/iso/SL-62-x86_64-2012-02-06-Everything-DVD1.iso wget http://mirror.aarnet.edu.au/pub/scientific/6.1/x86_64/iso/SL-62-x86_64-2012-02-06-Everything-DVD2.iso
That’s a lot of downloading! Again, feel free to miss out any lines which don’t apply to you. Also feel free to use different mirrors as you deem appropriate: I use aarnet.edu.au simply because it’s fast and (more importantly!) I don’t get charged for downloads from those servers. The main thing here is to ensure you obtain the full DVD release ISOs for the 64-bit of the distro(s) you’re interested in: the Live DVD isos you might see on some mirrors, for example, are missing key software which you are likely to need later on.
Once your choice of distro installation media has been downloaded to the …/centos or …/scientific directories, and with you continuing to be located in those ‘head’ directories, you now unpack them with the following commands:
mount -o loop CentOS-5.7-x86_64-bin-DVD-1of2.iso /media cp -rvf /media/* 57 umount /media mount -o loop CentOS-5.7-x86_64-bin-DVD-2of2.iso /media cp -rvf /media/* 57 umount /media
That is, you mount each ISO in turn in the /media directory and copy its contents from there to the appropriate ‘distro’ directory. Since the original distro always comes as two separate ISOs, you end up having to mount two ISOs per distro and copy both of them to the same directory. When you do this for the second ISO of a set, you will be asked whether you want to over-write files such as TRANS.TBL. The answer whenever you are prompted is always yes.
Repeat the above steps as many times are necessary to get your complete set of distros unpacked in their respective ‘numerical sub-directories’. You can delete the initial ISOs as each unpacking exercise is complete:
rm CentOS-5.7-x86_64-bin-DVD-1of2.iso rm CentOS-5.7-x86_64-bin-DVD-2of2.iso
…and so on. At this point, your Kickstart server is usefully capable of serving up operating systems to those that need them! There are just a couple of other things that it might usefully serve, if we take the trouble now to load those up as well.
One or two extras!
First, if you are going to be building boxes which will be used as Oracle servers, you may well want to download my Palmerston shell script (to the /var/www/html directory). It’s a shell script which configures usernames and kernel parameters correctly for Oracle 11gR2 installations on servers. Downloading it once to your Kickstart server now means that all your future builds can acquire it without needing to access the wider Internet (which is often something production machines are prohibited from doing, for company policy reasons).
For the same sorts of reasons it might be appropriate to obtain the Oracle 11g Release 2 software now (you want the two Linux x86_64 zip files downloadable from the OTN website). Save them in your document root (i.e., /var/www/html) and then any future Oracle server you build won’t need to visit oracle.com in order to be able to get its software requirements sorted.
Creating Kickstart Files
Once your distros are unpacked and your extra software is sorted, you need to generate Kickstart scripts which know how to find the various O/S files. Template Kickstart files are available for download from this website:
- Kickstart script suitable for Centos 5.x
- Kickstart script suitable for Centos 6.x
- Kickstart script suitable for Scientific Linux 5.x
- Kickstart script suitable for Scientific Linux 6.x
There are so many different versions of the Kickstart scripts simply because we have different paths on our Kickstart server to …/centos and …/scientific and, once within any one of those main ‘family’ directories, there are different paths to the different distro versions (for example, …/57 versus …/62).
Download them all and save them in your web server’s document root (i.e., /var/www/html).
Each will need to be edited before it can be used to build a newserver. In particular, two lines always need looking at:
- The line that specifies the networking attributes for the new server
- The line that says where the Kickstart server itself can be found
Practically, this means altering the line which reads:
network --device eth0 --bootproto static --ip 192.168.0.167 --netmask 255.255.255.0 --gateway 192.168.0.1 --nameserver 192.168.0.1 --hostname oraclebox.dizwell.home
Those IP addresses might be right for my network environment, but they’re probably wrong for yours. And although I don’t mind a server acquiring a hostname of “oraclebox.dizwell.home”, you will probably want something a bit catchier!
Similarly, this line:
url --url http://192.168.0.70/centos/57
…says that my Kickstart server is running on 192.168.0.70 -which may or may not be true for me, but is unlikely to be true for you.
Alter both of those lines to suit your own circumstances, therefore, and save the results. Of course, the network… line will need to be re-edited every time you want to Kickstart build a new server, because otherwise the new server will pick up the networking details of the one you built before. So, for each newbuild you perform, you first have to alter one line in the relevant Kickstart script so that your new build acquires a unique IP address and hostname. The url… line generally won’t need to be altered, of course, because (we hope!) your Kickstart server itself won’t keep changing its own IP address very often.