Thursday, May 24, 2007

Linux (Ubuntu) Network Install

Introduction

Some days ago I had to install Ubuntu Breezy – a GNU/Linux flavour based on Debian and powered by apt-get – on four machines and I had only one CD-Rom available. And doing some fast calculations you can find out that it’s faster to install through a 100Mbps LAN (~12.5 Mb/s highest peek) than using a normal 52x CD-Rom.

Initially, the idea was to load the boot sector directly from the onboard network card. Unfortunately, I wasn’t able to do so (it skipped network boot as if it didn’t detect anything) and I decided to stick with that sometimes useful floppy disk and include a small boot sector that had the drivers included.

Ready to start?

Setting up the server

First off, you'll need a server where your clients will be connecting. That server must have a small FTP, HTTP and DHCP server and, obviously, an Ubuntu installation CD available. The DHCP allows your clients to connect to your network and the HTTP/FTP server will deliver installation files and package repositories.

Our FTP server will be tftpd-hpa. On Ubuntu/Debian this is a matter of

CODE:
  1. root@server$ apt-get install package-name

and that’s it, everything gets installed and set up. Let’s install everything at once:

CODE:
  1. root@server$ apt-get install tftpd-hpa apache2 dhcp3-server

Now it’s time to copy the content of the Ubuntu cd. Just do

CODE:
  1. root@server:/var/lib/tftpboot$ mkdir ubuntu
  2. root@server:/var/lib/tftpboot$ mount -o loop /var/lib/tftpboot/ubuntu-5.10-install-i386.iso /var/lib/tftpboot/ubuntu

In order to get an ISO of your installation CD, you can do (astonish yourself)

CODE:
  1. root@server$ cat /dev/hdb > ubuntu-5.10-install-i386.iso

where hdb is your CD-Rom device. It can be anything else other than hdb so you’d better figure out with dmesg (root@server # dmesg) or doing whatever suits you.

Make a symlink from apache's root to the mounted ISO

CODE:
  1. root@server:/var/www # ln -s /var/lib/tftpboot/ubuntu/

configure the DHCP server according to your network:

CODE:
  1. root@server:~ # cat /etc/dhcp3/dhcpd.conf
  2. ping-check = 1;
  3. filename = "ubuntu/install/netboot/pxelinux.0";
  4. subnet 192.168.1.0
  5. netmask 255.255.255.0 {
  6. range 192.168.1.10 192.168.1.254;
  7. }
CODE:
  1. root@server:~ # /etc/init.d/dhcp3-server restart
  2. Stopping DHCP server: dhcpd3.
  3. Starting DHCP server: dhcpd3.

And now run the clients. If you were able to see the Ubuntu boot prompt, that’s it. Now you just have to carry on with the installation. Otherwise, if you didn’t see anything and the boot continued as usual – just like happened to me – then keep reading this tutorial.The alternative is, like I said before, using a boot disk with the drivers. Etherboot has what we’re looking for. Download the latest version and read the README file. Then you just have to find out which network card you have and follow the very quick instructions.


taken from: http://mywheel.net/blog/index.php/ubuntu-network-install/

For other distros it's probably the same except for the packages download, here we used apt-get for downloading the needed packages, in other distros you may have some other way of downloading the packages like yum or you can always can go the internet and search for it.

No comments: