ph34r
01-23-2001, 12:17 AM
Installing Linux on a "Minimal Machine"
Lately I have noticed a lot of BB posts about putting linux on minimal machines, either to use as a firewall/router or to just play with linux a little. This is actually a great use of old hardware and Linux, since you can build high-cost equipment out of low-cost hardware and OS/software. Seen the prices on a 486 with 4mb to 8mb of ram lately? How about a small-office type router?
But, installing Linux on such a machine is not for the average user. If you like to have your hand held all the way with nice GUI interfaces, forget it. This will explain how I managed to install Slackware 7.1 on a old Toshiba Satellite T1910 laptop - black and white screen, 486sx33 CPU, just under 4mb of ram, 300mb drive (e-bay for $10), single 3.5in floppy, single pcmcia slot, and a Gateway 10mb ethernet card. I've got a 28.8 and a 2400 modem for it, but I haven't bothered with either of those yet.
But what is a machine like this good for? Well, if I got the modem going, I could use it as a 'net connect machine for my small home lan - I always connect at sub-28.8 anyway. What I really use it for though is as a terminal/console to my real Linux machine from the couch. While I can't play Quake3, I can use *****X, links, lynx, ftp, ssh, etc. to do web stuff - if it is command-line, it is fair game, if I am patient. In fact, I wrote this on it.
So... how's it done? Well first you need 2 distros - a mini and a "real" one. I used smalllinux and Slackware 7.1 - you may prefer Debian or even Redhat (6.x), but you must be able to really control the install, especially if you have a really small hard drive.
Slackware 7.x no longer actively supports installs on machines with less than 12 mb of ram, and you can still get/make a lowmem boot disk, but the real probelms network and/or pcmcia disks - you run out of RAM since it uses a ramdisk for the root filesystem of the install process. The way to get around this is to make a small ext2 partition (20mb or so) and use that as the root of the system. Also, you can create and activate swap before starting the install script.
Step 1 - Getting the root fs for install on your drive. For this, you will need a mini distro that can either run from a single floppy in your amount of ram (I like HAL91, but it needs more than 4mb ram). For this, I used smalllinux. You have to be able to fdisk and make a small (15-20mb) ext2 partition, and a swap partition. Once done, you need to get the contents of the color.gz boot disk, your chosen kernel disk (bare.i or bareapm.i), and perhaps the network and pcmcia disks onto the ext2 partition. You will need to use a "real" machine to mount the disks images as loop file systems (or make and mount the floppies) - this requires support for both loop and minix file systems. Having a staticly compiled copy of tar and gzip/gunzip available helps too (check www.linuxfromscratch.org (http://www.linuxfromscratch.org) to learn how to compile these as static binaries), since you can compress the files enough to get them onto a fat or ext2 1.44 floppy.
Step 2 - Once you have the file structure on the small ext2 partition mirroring the boot/root disks, you can boot with the first install disk. When lilo comes up, be sure to give it the root=/dev/hda1 (or whatever) argument so it loads the root filesys for install from the disk, and not into ram. Once you login and get to a prompt, you will need to activate your swap partition (man swapon). Once your swap is running, you can start the install process. Manually mount or link the /pcmcia and /network directories if you need them for install. On my system, I did a NFS install by pre-mounting the share into a /source directory and then picking a "install from hard-drive or premounted directory" install when given the chance.
Step 3 - Installing. I installed the A, AP, and N disk sets from Slackware 7.1 - the base system, console apps, and networking. Just over 100mb aretaken by this. WARNING - there are a few things you need to do before re-booting to your new systemif you have less than 8mb of ram - mostly having to do with the way modulesare loaded/probed on boot and what shell you run. Bash just won't run in 4mb of ram, virtual consoles take precious memory, as do un-needed modules. Trim everything you can, and change your default shell (for both root and your user acct.) to ash. The 4mb-Laptop HOWTO covers all sorts of these details - if you have less than 12-16mb of ram, read it - it may help your performance.
Well, here is the results of installing my system. I have included below the output from free, df -h, and fdisk -l . I was running 2 instances of ash and 1 of ssh when I did these outputs.
$ free
total used free shared buffers cached
Mem: 2068 1840 228 492 80 528
-/+ buffers/cache: 1232 836
Swap: 31244 980 30264
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda2 247M 113M 121M 48% /
$ fdisk -l
Disk /dev/hda: 16 heads, 63 sectors, 682 cylinders
Units = cylinders of 1008 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 102 51376+ 83 Linux native
/dev/hda2 * 103 620 261072 83 Linux native
/dev/hda3 621 682 31248 82 Linux swap
$
And, a while later, a bit of bragging:
9:24pm up 30 days, 23:34, 2 users, load average: 0.03, 0.13, 0.09
But what do you install from? If you don't have a CD in your intended victim (remember - low end stuff), there are literally tons of ways. Just get creative and RTFM on installing. I used a NFS share from my desktop machine. It is possible to use floppies to install a base of Debian or Slack, with just enough OS to boot and either connect via ethernet or start a modem connection. If you have a second machine you can use it as a server - even if it is running 95/98/ME. Just get Apache for win32 and run it long enough to do a http install of Redhat 6.x. You can even put your harddrive in a machine that has a CD and copy the install files to it.
IMHO, adding software should be done with pre-made binaries, either via apt-get or www.linuxmafia.org. (http://www.linuxmafia.org.) A 486 with 4mb of ram takes a while to compile stuff - a long, long while. Also, compilers and their various components take tons of disk space - which may not be there to use.
So... who's up for making a 386/486 Beowolf/Mosix cluster to crunch Seti blocks on?
edits - damm ubb crap. where's my <pre> tags?
[This message has been edited by ph34r (edited 22 January 2001).]
Lately I have noticed a lot of BB posts about putting linux on minimal machines, either to use as a firewall/router or to just play with linux a little. This is actually a great use of old hardware and Linux, since you can build high-cost equipment out of low-cost hardware and OS/software. Seen the prices on a 486 with 4mb to 8mb of ram lately? How about a small-office type router?
But, installing Linux on such a machine is not for the average user. If you like to have your hand held all the way with nice GUI interfaces, forget it. This will explain how I managed to install Slackware 7.1 on a old Toshiba Satellite T1910 laptop - black and white screen, 486sx33 CPU, just under 4mb of ram, 300mb drive (e-bay for $10), single 3.5in floppy, single pcmcia slot, and a Gateway 10mb ethernet card. I've got a 28.8 and a 2400 modem for it, but I haven't bothered with either of those yet.
But what is a machine like this good for? Well, if I got the modem going, I could use it as a 'net connect machine for my small home lan - I always connect at sub-28.8 anyway. What I really use it for though is as a terminal/console to my real Linux machine from the couch. While I can't play Quake3, I can use *****X, links, lynx, ftp, ssh, etc. to do web stuff - if it is command-line, it is fair game, if I am patient. In fact, I wrote this on it.
So... how's it done? Well first you need 2 distros - a mini and a "real" one. I used smalllinux and Slackware 7.1 - you may prefer Debian or even Redhat (6.x), but you must be able to really control the install, especially if you have a really small hard drive.
Slackware 7.x no longer actively supports installs on machines with less than 12 mb of ram, and you can still get/make a lowmem boot disk, but the real probelms network and/or pcmcia disks - you run out of RAM since it uses a ramdisk for the root filesystem of the install process. The way to get around this is to make a small ext2 partition (20mb or so) and use that as the root of the system. Also, you can create and activate swap before starting the install script.
Step 1 - Getting the root fs for install on your drive. For this, you will need a mini distro that can either run from a single floppy in your amount of ram (I like HAL91, but it needs more than 4mb ram). For this, I used smalllinux. You have to be able to fdisk and make a small (15-20mb) ext2 partition, and a swap partition. Once done, you need to get the contents of the color.gz boot disk, your chosen kernel disk (bare.i or bareapm.i), and perhaps the network and pcmcia disks onto the ext2 partition. You will need to use a "real" machine to mount the disks images as loop file systems (or make and mount the floppies) - this requires support for both loop and minix file systems. Having a staticly compiled copy of tar and gzip/gunzip available helps too (check www.linuxfromscratch.org (http://www.linuxfromscratch.org) to learn how to compile these as static binaries), since you can compress the files enough to get them onto a fat or ext2 1.44 floppy.
Step 2 - Once you have the file structure on the small ext2 partition mirroring the boot/root disks, you can boot with the first install disk. When lilo comes up, be sure to give it the root=/dev/hda1 (or whatever) argument so it loads the root filesys for install from the disk, and not into ram. Once you login and get to a prompt, you will need to activate your swap partition (man swapon). Once your swap is running, you can start the install process. Manually mount or link the /pcmcia and /network directories if you need them for install. On my system, I did a NFS install by pre-mounting the share into a /source directory and then picking a "install from hard-drive or premounted directory" install when given the chance.
Step 3 - Installing. I installed the A, AP, and N disk sets from Slackware 7.1 - the base system, console apps, and networking. Just over 100mb aretaken by this. WARNING - there are a few things you need to do before re-booting to your new systemif you have less than 8mb of ram - mostly having to do with the way modulesare loaded/probed on boot and what shell you run. Bash just won't run in 4mb of ram, virtual consoles take precious memory, as do un-needed modules. Trim everything you can, and change your default shell (for both root and your user acct.) to ash. The 4mb-Laptop HOWTO covers all sorts of these details - if you have less than 12-16mb of ram, read it - it may help your performance.
Well, here is the results of installing my system. I have included below the output from free, df -h, and fdisk -l . I was running 2 instances of ash and 1 of ssh when I did these outputs.
$ free
total used free shared buffers cached
Mem: 2068 1840 228 492 80 528
-/+ buffers/cache: 1232 836
Swap: 31244 980 30264
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/hda2 247M 113M 121M 48% /
$ fdisk -l
Disk /dev/hda: 16 heads, 63 sectors, 682 cylinders
Units = cylinders of 1008 * 512 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 102 51376+ 83 Linux native
/dev/hda2 * 103 620 261072 83 Linux native
/dev/hda3 621 682 31248 82 Linux swap
$
And, a while later, a bit of bragging:
9:24pm up 30 days, 23:34, 2 users, load average: 0.03, 0.13, 0.09
But what do you install from? If you don't have a CD in your intended victim (remember - low end stuff), there are literally tons of ways. Just get creative and RTFM on installing. I used a NFS share from my desktop machine. It is possible to use floppies to install a base of Debian or Slack, with just enough OS to boot and either connect via ethernet or start a modem connection. If you have a second machine you can use it as a server - even if it is running 95/98/ME. Just get Apache for win32 and run it long enough to do a http install of Redhat 6.x. You can even put your harddrive in a machine that has a CD and copy the install files to it.
IMHO, adding software should be done with pre-made binaries, either via apt-get or www.linuxmafia.org. (http://www.linuxmafia.org.) A 486 with 4mb of ram takes a while to compile stuff - a long, long while. Also, compilers and their various components take tons of disk space - which may not be there to use.
So... who's up for making a 386/486 Beowolf/Mosix cluster to crunch Seti blocks on?
edits - damm ubb crap. where's my <pre> tags?
[This message has been edited by ph34r (edited 22 January 2001).]