Installing Linux via the Network

Introduction

I install a lot of operating systems, so it’s important to me that the installation process should be efficient, standardized and painless.

One of the simplest ways of achieving those goals (assuming you’re installing Red Hat Enterprise Linux or one of its free clones, such as CentOS or Scientific Linux) is to use Kickstart scripts, which I’ve written about before.

Even with Kickstart, however, it becomes a pain having to find the physical installation DVD each time (or even the right ISO if you’re using virtual machines).

This article will therefore explain how you can combine Kickstart scripts for RHEL-like OSes with the DVD- and ISO-less beauties of an Apache web server, to achieve the ultimate in effortless Operating System installations.

What works

The basic process involved in this is that you will boot your main OS using a small ‘net install’ boot disk and point that at your Apache server to find the ‘main’ installation media. There are, however, some rules about the relationship that has to exist between the ‘main’ and ‘net install’ media.

The first rule is: pick a family. You can’t do a net install boot using Scientific Linux media and get it to point to CentOS main media, nor vice versa. If you’re going to net install Scientific, your main media has to be Scientific, too; similarly, if the one is CentOS, the other has to be CentOS as well.

The second rule is: pick a version. If you use 6.0 net install media, you can’t then point it to a 6.1 or 5.7 main install media. Similarly, if you net install with 5.7, don’t then try pointing it to a 6.0 or 6.1 main install.

CentOS 5.7 and 6.0 are the current CentOS versions (at the time of writing, anyway): both shop with net install and main media. Scientific Linux has a 5.6 version which does not ship with a net install boot disk, and so that version is not usable in these situations. Scientific Linux 6.0 and 6.1 both do come with net install disks, however, so those are both usable.

In summary, then, this article will describe network installs which are applicable to CentOS 5.7, CentOS 6, Scientific Linux 6.0 or Scientific Linux 6.1. Additionally, as is my now long-standing principle, I am only interested in 64-bit installs.

Downloading the software

You can obtain the necessary Scientific Linux and CentOS installation media from whichever mirrors you like, but I’ve linked to the ones I use.

If you want to do a 5.7 install, you’ll need:

If you want to do a 6.0 install, you could use

(Note: the links have had to point to 6.1 installation media since this article was first written, since the 6.0 ISOs are now no longer available)

Or…

And, finally, if you’d prefer to do a 6.1 install, you’ll need:

You will additionally need a web server to do the distribution of the O/S files during the installation process and I’m going to assume you’ve built an Apache server in the manner I’ve already documented elsewhere.

Getting the Web Server ready

Using an sftp client tool, such as Filezilla, copy the full install DVDs to the /var/www folder on the web server. If you want your web server to be able to offer up 5.6, 6.0 and 6.1 versions as needed, you’ll need at least 15GB of free disk space for the lot. It’s more like 24GB if you want to be able to offer both CentOS and Scientific Linux installations in all three possible versions as the mood takes you.

Let’s say I am going to do the entire lot: here’s my Filezilla directory listing at this point (note that when the screenshots were taken, Centos 5.6 was the latest version available. Substitute in 5.7, however, and the same principles apply):

You obviously don’t need to do all four variants, but I never know what distro flavour or version I might want to install next, so I’m catering for all possibilities! Now you have to unpack those files. They’re not zip files, though, so the command required is not quite as straightforward as a simple ‘unzip…’. It isn’t very difficult, though:

mkdir -p /var/www/html/centos
mkdir -p /var/www/html/sl

mount -o loop Centos-5.7-x86_64-bin-DVD-1of2.iso /mnt
mkdir /var/www/html/centos/57
cp -rvf /mnt/* /var/www/html/centos/57
umount /mnt
rm Centos-5.7-x86_64-bin-DVD-1of2.iso

mount -o loop SL-61-x86_64-2011-07-01-install-DVD.iso /mnt
mkdir /var/www/html/sl/61
cp -rvf /mnt/* /var/www/html/sl/61
umount /mnt
rm SL-61-x86_64-2011-07-01-install-DVD.iso

And so on. The basic principle is: mount the ISO, copy its contents recursively to a suitable sub-directory you’ve created within your Apache server’s root directory, unmount it and move on to the next, deleting the ISOs themselves as you go because they’re no longer required.

If you’ve downloaded the second Centos DVDs for 5.7 or 6.0, just repeat the process, substituting in the different filename where necessary and agreeing to over-write anything you’re prompted about. The main point is, though, that you copy their contents into the same directory you copied the first DVD’s contents, so you end up with just one, giant installation directory when you’re done.

Once all your source ISOs have been unpacked, you might end up with something like this:

So that’s the Apache server nearly sorted: a nice set of distro- and version-specific directory trees, containing the complete contents of the relevant full-blown installation media.

Only one other thing need be done with this server before it’s ready to use: you need to download the relevant Kickstart files which allow automated installs of the O/S. I’ve prepared ones which you are welcome to download, review and edit as you feel appropriate:

There are different files for the Centos 6.0 and Scientific 6.x installs because the path to the files on the Apache server is different in each case. You’ll need to edit these files before you upload them to the /var/www/html directory on the Apache server, because they make reference to the hostname of the Apache server itself. Specifically, the line which reads url –url http://apachebox/… needs to refer to the hostname or IP address you have actually assigned to the Apache web server.

Once you’ve edited those files correctly and uploaded them to the server’s web root directory, you’ll end up with this sort of thing:

It might seem a bit fiddly to get all these files across and unpacked appropriately, but it’s worth it. You only need to go through this ordeal once to have a machine that can, basically, serve up an automated install of any recent Enterprise-class distro you fancy as many times as you like.That’s why I’d take a copy of my virtual Apache server at this point, so you never have to muck about with this stuff again (well, not until 6.3 or 7.0 comes out, anyway!!)

Performing a network install

To perform a network install, you still need to have available, locally, a special, cut-down version of the distro in the form of a “netinstall” or “boot” ISO or CD/DVD. The links to these were already provided above.

Back in 5.x days, these really were slim-line distros: the Centos 5.6 netinstall ISO is a mere 11MB in size, for example. In 6.x versions, however, the relevant ISO is now over 200MB: for your extra bytes, you get a nice GUI install instead of a pure text-only affair -which is, sadly, irrelevant for us because using Kickstart means you’ll hardly need to interact with the install process, no matter how pretty it might be.

But anyway: build your virtual servers with the relevant net install ISOs specified as their primary boot device, power on and wait until you see the boot splash screen. When you do, specify where the installer can find an appropriate Kickstart configuration file. This is done slightly differently in 5.x versions compared to 6.x ones:

  • For 5.x, type: linux ks=http://apachebox/netcentos56.cfg at the “boot” pro (again, version 5.6 is now a deprecated version, but the files were created at the time when it was current.)
  • For 6.0 and 6.1 press <TAB> then type: ks=http://apachebox/net<….>.cfg, appending this to the ‘vmlinuz initrd…’ text already present

Here’s me doing this for Centos 5.7, for example:

And here’s me doing the equivalent for Scientific Linux 6.1:

In all cases, you’ll be asked to supply a root password; and if your hard disks have never been partitioned before (by anything for any reason), you’ll see a prompt about needing to initialise them. Other than that, however, the installation should proceed without further interaction being required.

2 thoughts on “Installing Linux via the Network

  1. Pingback: The Linux Authority - Network install point httpd with Centos or RHEL6 using kickstart

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>