Tips and Tricks for the Linux Admin: Roll Your Own

This month’s tasty installment explores the world of Roll-Your-Own Linuxes. Why would you want to assemble your own customized Linux image? Well, why not? For one thing, it’s just plain fun. For another, despite the fact that there are hundreds of existing Linux distributions of all shapes and sizes, you might still find yourself wanting something that doesn’t exist. Which isn’t all that far-fetched, because even though there are so many existing distributions to choose from, most of them are derived from a few common ancestral distributions (Debian, Red Hat, Slackware, Gentoo), or are variations of each other.

You don’t need to blow all kinds of money on expensive commercial network appliances or rescue and recovery tools – Linux (or any of the free BSDs) outperform all but the highest-end kit for a fraction of the cost. For a bit of inspiration, here’s a very brief sampling of some interesting and clever distributions:

  • LiveKiosk, for creating instant hassle-free public Internet kiosks. No need for a hard drive or any kind of configuration–just pop in a CD or the prefab IDE Flash drive and you’re done.
  • Cluster Knoppix, for instant diskless clusters
  • SystemRescueCD for rescuing just about any non-booting system. Both CD and bootable USB versions.
  • 64 Studio, a Linux multimedia creation studio
  • AstLinux, a complete Gentoo + Asterisk-based iPBX that weighs in at around 48 megabytes
  • OpenWRT, customizable firmware for embedded routers like the Linksys WRT54G and similar devices from other vendors

Most of these come in multiple images for different boot devices: CD, DVD, USB sticks, hard drives, netboot, and even quaint old floppy diskettes. Linux has been localized for all kinds of languages all over the world. There are Christian Linuxes, astronomy Linuxes, bioinformatics Linuxes, Scientific Linux, and even a Barbie Linux. There are complete portable desktop Linuxes on USB sticks that work anywhere you go. You’ll find Linux powering everything from the irresisistibly tiny and cute Gumstix to behemoth mainframes.

A Brief Gloat
Let us take a well-deserved gloating break here–only in the FOSS world do you find this sort of innovation and creativity, and all manner of operating system variations that try to be friendly and useful. Does Windows have a bootable rescue CD or USB key? (Restore disks that reformat and reinstall don’t count.) Do any of the proprietary Unixes? Can they be customized by ordinary users who don’t have leet coder skills and even leeter lawyers to tell them if they can? Pshaw. As if.

The Quest
My own personal quest is for a tiny Linux that I can customize exactly just so for firewalls, routers, and wireless access points. What, you say, is it not enough to have Pyramid Linux, m0n0wall (FreeBSD-based), IPCop, Shorewall, Firestarter, Coyote Linux, FreesCO, Puppy Linux, Damn Small Linux, Voyage Linux, Bering uClibc, FloppyFW, and all the very many others?


No matter how great they are out of the box, and they are superb, I always end up spending a lot of time modifying them. So why not build my own? Then there is no one to crab at but me when it’s not just the way I like.

Modifying Existing Distributions
The shortest path to creating your own customized Linux is to modify an existing distribution. You can achieve an amazing level of customization just by using the usual package management tools like Yum or Aptitude. Then you can preserve your customizations for posterity and easily replicate them. Fedora users have Kickstart. Debian also has Kickstart, or you can use its native pre-seed tool.

Many of the tiny Linuxes come with their own instructions for making modifications, and even provide nice build tools, like Bering-uClibc and AstLinux. Pyramid Linux uses stock Ubuntu packages, so you just delete or add the relevant binaries and libraries. It doesn’t even require a build environment- just grab what you need from the Ubuntu live CD.

Most of these require a fair bit of knowledge on building software from source code, and are typically shy of helpful beginner’s documentation. But fear not, for there is a solution to this: Linux From Scratch.

Starting From Scratch
Linux From Scratch is the ultimate way to build your own customized Linux distribution exactly the way you want. Because the LFS maintainers have done such a splendid job of writing the “Linux From Scratch” book and setting up a nice support infrastructure, a few days is all you’ll need to build your very own custom Linux distribution from the ground up. You’ll have plenty of time to study the book and do other chores while you’re waiting for compiles to finish.

Linux From Scratch is designed to be educational, so the documentation is abundant and well-written. After one LFS run-through you’ll have the knowledge you need to perform custom builds on almost any Linux distribution.

Once you’ve had a good LFS lesson or two, take a look at Busybox for building small Linux images. Busybox is the foundation of a lot of embedded Linuxes. Busybox rolls an assortment of stripped-down UNIX utilities, such as coreutils, findutils, gawk, grep, net-tools, sysvinit, tar, and many others into a single customizable executable.

Share Build Environments With NFSv4
Mossy old Unix admins like to ramble on about the virtues of NFS (Network File System). Us new Linux kids just smile and nod, then return to refining our sleek Samba servers and Webdav shares. But don’t be so quick to dismiss NFS, because it’s a good way to set up file sharing on Linux networks.

NFSv3 is famous for its lack of security and inability to scale. But it is quick and easy to set up. NFSv4 introduces a raft of nice new features, including strong authentication and encryption, and good performance over slow network links. NFSv4 is also theoretically cross-platform capable, but there’s not much yet in the way of actual cross-platform implementations.

Whichever version you elect to use, both are excellent for sharing build environments. A full-sized build environment can easily consume 3-6 gigabytes of disk space, plus whatever storage you need for your images. Setting up a central build server that can be accessed across the network is a great way to minimize bloat and redundancy.

When your NFS server is ready to roll, set up your clients with autofs for mounting NFS shares on demand. Use the –ghost option to make your available shares visible without actually being mounted.

Why There Are Not More Linux Games
We hear it all the time- “Linux will never be a success on the desktop until it has way more games.” Which contains so many debatable points I hardly know where to begin. Here is the best response I ever heard, from Keith Lofstrom:

…how does the thrill of winning a video game compare
to completing a small program, or finding a bug, or building a
cabinet, or playing music with friends, or some other small task
with a defined result? Does game playing scratch the same itch?…
The reason there are so few games for Linux may be because Linux,
and creativity in general, are much more engaging games. Perhaps
if we developed some game-like debugging tools, then the young
folk spending kilo-hours looking for monsters in mazes could be
looking for buffer overflows instead.”


Latest Articles

Follow Us On Social Media

Explore More