This article comes mainly from my fiddling around with a laptop I bought at a great price - US $800 some years ago - but lacking a CD-ROM drive. Just what I needed to see how to get a Linux box going using the network bootdisks that come with most distributions these days. I also have some experience with the elderly 486 I recycle as terminals (no CD drive either - and little else).
There are different ways of exporting the distribution CD from a Linux desktop: NFS, FTP and HTTP. I would like to discuss briefly each of these, before going into some of the interesting problems I encountered. I will try to keep this at a level accessible to all - and the techniques are quite easy to use - though NFS can be something of a bitch.
I will use the RedHat distribution scheme here. Most of it also applies directly to derived distributions, such as Mandrake or HispaLinux. The ideas behind also apply to most other Linux distributions, though the details of implementation may be different.
The disks
Modern distributions can usually be booted straight from the CD. But they also come with several boot images that can be written to a floppy (usually in the /images directory). There is a difference between a desktop with a standard ISA or PCI ethernet card, and a laptop with a PCMCIA card. In the latter, you will need to load the pcmcia support module before the ethernet drivers.
For example:
- the RedHat 5.2 distribution comes with boot.img (both CD and network), though you may also need supp.img for PCMCIA card support. (And yes, I still use it to convert 486 and early Pentium boxes into X terminals and routers - though not for servers!).
- the RedHat 6.0 distribution comes with boot.img (CD only), bootnet.img (network) and pcmcia.img.
- Mandrake 7.0 comes with cdrom.img, network.img and pcmcia.img, as does Mandrake Corporate Server.
In each case, to boot from the network you will need:
distribution |
without PCMCIA |
with PCMCIA |
---|---|---|
RedHat 5.2 |
boot.img |
boot.img + supp.img |
RedHat 6.0 |
bootnet.img |
bootnet.img + pcmcia.img |
Mandrake 7.0 and CS |
network.img |
pcmcia.img |
Naturally, you can write these images to floppies using the dd instruction. For example:
dd if=/mnt/cdrom/images/network.img of=/dev/fd0
Getting your network up
All network boot disks have a mecanism to get your network up, though the order in which the steps are taken may be slightly different. For example, a Mandrake 6.1 boot goes:
select network image protocol (nfs, ftp or http);
select a network card - this particular boot disk cannot detect your card automagically - more on this later;
enter your IP and host configurations, which will in most cases be the definitive configurations;
tell it about your server (IP address or name, directory holding the distribution).
Installing through NFS
NFS can be seen as the means Linux boxes have to share directories across a local or wide area network. Once exported, you can mount these directories just as you would a local disk unit.
Server-side, I usually just mount the CD, and then export /mnt/cdrom. This involves the following steps:
1. Get the NFS server working (nfsd), for example using setup.
2. Mount the CD as usual:
mount /dev/cdrom /mnt/cdrom
3. Include this directory in the server's list of exportable directories. In /etc/exports, I insert the line:
/mnt/cdrom *(ro,no_root_squash)
This means I want to export /mnt/cdrom to all users (*), with read-only rights (ro). no_root_squash gives remote root users root privileges over your NFS files; normally, remote root users have the nobody user's permission on them--this is a security measure in case the remote users are not trustworthy.
5. I then make the export effective with:
exportfs
This should reply with a message such as:
/mnt/cdrom localhost
/mnt/cdrom *
You can then test it out on any box on the network with (for example, with 192.168.0.1 as the server's IP address):
mount 192.168.0.1:/mnt/cdrom /mnt
Client-side, you will need to tell the installation program:
- the NFS server name (or IP addess in most small networks with no DNS)
- the RedHat directory, /mnt/cdrom in my example.
This works, but may not be the easiest way to install Linux. I use it in networks where the server exports /home anyway, and NFS is already set up.
Installing through FTP
Server-side, exporting a RedHat CD through ftp is a rather simple process. In my setup, I already had the wuftp server going. The package on installation creates the /home/ftp directory, from which anonymous ftp queries are served. The most expeditive way the serve the CD seemed to be:
1) create a subdirectory, such as /home/ftp/cdrom
mkdir /home/ftp/cdrom
2) mount the CD directly on this directory, instead of the more usual /mnt/cdrom:
mount /dev/cdrom /home/ftp/cdrom
Just to be sure, I then checked you can access this directory from an anonymous ftp session.
Client-side, I selected FTP image, then went through the normal steps to set up networking. When asked, I gave it
- the FTP site name (or IP addess in most small networks with no DNS)
- the RedHat directory, just cdrom in my example.
It seems you can also use non-anonymous ftp connections, but I haven't tried it as it doesn't seem too interesting in our case.
Installing through HTTP
The process is very similar to the FTP.
Server-side, I used the standard apache installation, with DocumentRoot set to /home/httpd/html. I then
1) created a subdirectory, /home/httpd/html/cdrom
mkdir /home/httpd/html/cdrom
2) mounted the CD directly on this directory:
mount /dev/cdrom /home/httpd/html/cdrom
I also checked the CD was accessible before going on. You can do this on the server itself by requesting http://localhost/cdrom/. You should obtain a list of the files on the CD.
Client-side, you need to give the installation program:
- the Web site name (or IP address in most small networks)
- the RedHat directory, just cdrom in my example.
Wee problems
With my laptop, my major problem was a Trust PCMCIA ethernet card that is advertised on the box as being "full NE2000 compatible" - which is just not true. (Why do they supply their own drivers for Windows 95?).
I was stuck on that one with several distributions such as Mandrake 6.1: these ask you to give your card type. Naturally, the ne module didn't work.
Then I tried the RedHat 6.0 distribution. This autodetects the card type - and works fine using module pcnet_cs. This rather weird card type is not in the usual lists, but is incorporated into most kernels. The trick is to get a boot disk that either autodetects or lets you type in your module name instead of selecting from a list. Note that the RedHat 6.0 network.img disk also works for Mandrake 6.1.
I had a couple of problems with screen resolution under X. A 800x600 pixel laptop screen will work well with its own resolution - but not with 640x480 as the pixels get distorted. I also had to fiddle with the HorizSync value in /etc/X11/XF86Config: the standard VGA 30-40 kHz range worked better for me than the discrete values I got telling the installation program I had a 800x600 LCD screen. Be careful though - as ever with X.
Another problem is when you forget some packages during initial installation. You then need to get the packages accesible locally once more: either mounting the CD from the server with NFS, or downloading the packages via FTP or HTTP. You can then use rpm, kpackage or whatever.
Further steps
One point I would like to look at is to compare the three system's relative speeds. From what I saw while preparing this article, there don't seem to be any major differences. So I guess it depends mostly on which services are already installed on the server.
In most cases these will be FTP and HTTP, as their configuration is automatic with most modern distributions. NFS seems a less probable choice as most Linux boxes don't need it for everyday tasks.
Finally, the last question I would like to discuss is "why a laptop under Linux"?
Besides the usual reasons for using Linux, I find it useful as a teacher:
to use StarOffice (my favourite for projections);
to demonstrate operating system techniques live (also with the projector);
as a server for the lab: students see both what happens on the server's projected screen as well as on their own clients' screen and can experiment;
as a portable X terminal;
to convince decision-makers and money-spenders Linux gets more bang from hardware than other systems. You carry it around, plug it into their local network, and let them play. My final line is: "imagine setting up Windows NT serving HTTP, FTP and mail on my P-133 CPU, 48 Mb RAM laptop ..." Not to speak of Windows 2000 - but that would be unkind :-)