Install Linux onto a headless server without a cdrom drive

11 01 2010

Recently I got hold of three Sun Fire 2270 – until I opened the boxes I didn’t realise that they had no cd/dvd drives, VGA cards or iLOM’s installed.  I suppose it makes sense in these space-saving, energy-conscious, cost-sensitive times, although it did mean I had some work to do to get CentOS installed.  In the end it involved network booting and redirection to the serial console.  Unusually documentation was sparse, so here my attempt…

1. Publish the Installation OS on the Source Server

As I was installing CentOS 5.4 I retrieved the iso file from the web.   The next step is to loop mount the iso, using a command something like this:

#mount -o loop centos5.iso /mnt/iso (remember to create this directory before mounting)

I choose to publish this iso via my Apache webserver so I created a symbolic link called ‘centos’ in the www root folder (you can also publish via FTP or NFS):

#cd /var/www/html
#ln -s /mnt/iso centos

This should now mean that the iso image is available via your web server (browse to http://<webserver>/centos and make sure or else the next step will fail).

If your using kickstart (and I suggest you do for convenience) copy your kickstart file to the webserver and check the url to it (eg; http://<webserver>/kickstart/ks.cfg)

2. Setup the Network Boot Environment

Now we’ve our source OS and kickstart file published, we need to tell our server to boot from the network and retrieve the installation information.  To do this I configured the netboot and dhcpd services on the same box as my webserver.  For DHCP I set up a static entry in my /etc/dhcpd.conf file (my network is 10.0.5.0/24 – adjust as necessary):

default-lease-time                      30000;
max-lease-time                          30000;
option subnet-mask                      255.255.255.0;
option domain-name-servers              10.0.5.104;
option domain-name                      "mydomain.local";
ddns-update-style                       none;</pre>
<pre>subnet 10.0.5.0 netmask 255.255.255.0 {
option subnet-mask  255.255.255.0;
option routers 10.0.5.1;
next-server 10.0.5.104;</pre>
<pre>host x2270 {
hardware ethernet 00:aa:bb:cc:dd:ee;
fixed-address 10.0.5.105;
next-server 10.0.5.104;
filename "pxelinux.0";
}

This entry specifies the hardware address shown (taken from the sticker on the back of the x2270), it provisions a fixed address for it (10.0.5.105), it sets a ‘next-server’ option (10.0.5.104 – this is my netboot/web/dhcp server) as well as a ‘filename’ option (pxelinux.0 is the pxe bootstrap file we create on TFTP server next).

Next we need to set up our PXE boot server, this is the guy that allows the machine to be installed to boot from the network.  My preference is to use system-config-netboot tool, it’s very straight-forward to use and does pretty much everything we need.

Open system-config-netboot and choose Configure->Network Installation, then click Add to create a new installation source by setting the following fields:

Operating System Identifier – this is a unique name, in my case I just used CentOS32

Select Protocol for Installation – in this instance we’re using HTTP

Server IP Address – this is the IP of the HTTP server, in my instance 10.0.5.104

Location – this is the relative path to the installation directory ‘/centos’

After configured these setting click OK and close the ‘Configure Network Installations’ window.   At this stage we have the network installation configured we just need to get our server to use it.  To do this click ‘New’  and enter the following fields:

Hostname or IP Address – this is the ip or hostname of the machine to be installed (in my instance 10.0.5.105)

Operating System – if all went well with the network installation setup this should drop down to CentOS32

Make sure everything else on this windows is unchecked or not selected.  We’ll do our serial settings and kickstart settings by hand (it appears there’s a bug that has the kickstart page looping because it inserts an additional ‘/’ character).  You can now click OK and close the application.

Our final step is to adjust the network boot environment to use our kickstart file and use the serial console (as we’ve no VGA card).  To that end we edit the file /tftpboot/linux-install/pxelinux.cfg/<hex-code>.  The hex-code filename comes from pxelinux and can be found using the command:

#gethostip 10.0.5.105

In my environment that’s the IP of the address of the machine to be installed.  This file lists the pxelinux boot environment for that host – we need to append ks=http://<webserver>/kickstart/ks.cfg for our machine to be installed using our kickstart and also console=ttyS0 so our machine will redirect output to the serial console.  So my /tftpboot/linux-install/0A000569 file looks like (disregard the line break after the kickstart setting):

default CentOS32
label CentOS32
kernel CentOS32/vmlinuz
append initrd=CentOS32/initrd.img  ramdisk_size=8419 console=ttyS0 method=http://10.0.5.104/custom
ip=dhcp ks=http://10.0.5.104/kickstart/ks.cfg

3. Boot and Install Server

The Sun servers came with a RJ45 to Serial adapter, I connected this to a network cable and into the back of the new Sun x2270.  I stuck the other end in a USB serial adapter and then into another CentOS box.  This allowed me to use minicom to connect to the serial port (port settings are device=/dev/ttyUSB0 with 9600,8N1 and no flow control).  Next I hit the power switch and booted the new server – my servers were initially set to boot from the hard disk so I had to enter the BIOS (using Ctrl+E) and then set the boot device priority so that the network card was before the hard disk).  After setting this I rebooted and watched the installation progress nicely using the netboot server, HTTP source and kickstart file.  By the way I originally didn’t set console=ttyS0, so when anaconda kicks in it disappears from screen – this was key to these particular Sun boxes.

After the network installation has completed don’t forget to edit the boot device priority again or else the machine will netboot again.  Also once you’re done with network booting remove the next-server and filename options from DHCP – I’d also recommend switching off the netboot server so nothing else tries to boot from it (or abuse it).

Advertisements

Actions

Information

3 responses

17 06 2010
ipangsan

awsome..ur articles is cool.
thx gan

1 02 2011
Text Based Server Install

[…] So after countless hours of searching i FINALLY found a tutorial that showed me exactly what i needed to do. I appreciate all the help you guys provided for me. For the future, here is the link to anyone that needs to do a headless linux install https://markliggett.wordpress.com/201…a-cdrom-drive/ […]

24 06 2014
film and video production companies Chicago Video Production

I enjoy, cause I found just what I was having a look for.

You’ve ended my four day lengthy hunt! God Bless you man.
Have a great day. Bye

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: