Installing Linux to a headless appliance

We have four x86-platform “server” appliances left over from an abandoned VoIP project by a consulting company that is now no longer in business. What to do with them? Install Linux, of course, and deploy them as remote network probes for a Smokeping network.

Problem: no console (headless), no peripherals, and it will only boot from the hard disk. It has four serial ports available and network connectivity.

Solution: load a modified Linux installer onto the hard disk. It must redirect the console to a serial port and be able to do a network install of the Linux distribution.

Here’s a summary of the steps I took to install CentOS on the appliances. If you’re interested in details, drop me a line.

  1. Download diskboot.img from the CentOS 5 distribution. This is a boot image most often used to boot from a USB key. We’re going to write it to the hard disk instead.
  2. Mount the diskboot.img file on a Linux system and edit the syslinux.cfg file. At the top, add:

    serial 0 9600

    which tells the installer we’re using serial port 0 (COM1) at 9600 baud. Change the “default” line to:

    default text

    because the terminal is initially screwed up so we won’t be able to make a choice; we’ll have to let it default to the right one.

    Now on “label text” add the following to the end of the “append” line:

    console=ttyS0,9600

    which will tell it to boot the kernel and use serial 0 at 9600 baud for the console.

  3. Save the file and unmount the image.
  4. Connect the hard drive from the appliance to the Linux machine, and determine its device name. I’ll call it “appliancedisk”.

    dd if=diskboot.img of=/dev/appliancedisk

  5. Now put the appliance’s disk back in place. Connect a terminal to serial line 0 (COM1) and connect the appliance to the network. Boot up and you can control the install process through the terminal, specifying a network location for the install media. Remember to keep the console=ttyS0,9600 line as a boot option so that the serial console continues to work after installation.