There is a very, very large number of Linux distributions. Each distribution is built using the same basic building blocks but the end results are always different. The choices made by the distribution developers turn the building blocks into finished structures designed to meet a variety of needs—desktop, server, or some other specialized usage.
Learning how the various building blocks work together to create a cohesive Linux distribution is an excellent way to expand your Linux skills. And Linux from Scratch provides a challenging way for skilled Linux users to do that.
Your Linux from Scratch installation will turn into a functioning Linux system as you build a foundation with the instructions in the core Linux from Scratch book, and if you advance to Beyond Linux from Scratch, you will end up with a completely functional and customized system of your own creation. Rounding out the Linux from Scratch family are a few advanced projects for automating Linux from Scratch builds, cross-compiling Linux from Scratch, and building a hardened (security focused) version of Linux from Scratch.
Below, I will introduce you to each of the Linux from Scratch projects. Hopefully you will be inspired to try out Linux from Scratch, or at the very least, read through some of the material and come away with a healthy appreciation for the work involved in creating and maintaining a Linux distribution.
Linux from Scratch
Working your way through the Linux from Scratch instructions will teach you how to set up a Linux system manually. There is no fancy installer. You will complete each step by using command line tools. Doing this requires that you already have a working Linux installation that meets the minimum requirements for compiling Linux from Scratch. You could also use a LiveCD if it meets the requirements, but the official Linux from Scratch LiveCD is no longer being maintained, so it cannot be used to build the latest release of Linux from Scratch.
There are many steps involved in the Linux from Scratch process, but the main one is compiling software. Since compiling software can take a lot of time, Linux from Scratch has an interesting way to help users figure out how long it will take to compile a package on their system. This method involves timing how long it takes to compile the first package in the process: Binutils. The time it takes to compile Binutils becomes one Standard Build Unit (SBU). Every other package lists how many SBUs it would take to compile. A package listed as 0.5 SBUs would take half the time it took to compile Binutils, while a package that takes 5.0 SBUs to compile would take five times as long.
Linux from Scratch creates a very basic system, but there are two variants you can choose from—one uses sysvinit and the other uses systemd. The package list for each of these is almost identical, except for the init system and a few supporting packages. The other packages in both variants are the same, so pick the version with the init system you prefer and then move on to Beyond Linux from Scratch to further customize your system to your liking.
Beyond Linux from Scratch
If you want to turn your Linux from Scratch system into something suitable for daily use, you will need the instructions in Beyond Linux from Scratch. These instructions show you how to install additional software that expands the core Linux from Scratch installation into a system that is actually usable for real tasks. There are instructions for installing a wide variety of software, so you have the choice to pick and choose to create a system that meets your needs. Pick the desktop environment you want (if any), install the applications you need, and your system will be fully functional.
Automated Linux from Scratch
After you have built a Linux from Scratch system a few times and are comfortable with the process, you can automate the build process by using Automated Linux from Scratch. Jhalfs, the official implementation of Automated Linux from Scratch, can fetch the Linux from Scratch instructions, parse them, and create executable shell scripts. The compilation process will still be time consuming, but you will be able to build a Linux from Scratch system without having to manually run each step, so you can focus on other tasks while the automatic build scripts do their thing.
Cross Linux from Scratch
Sometimes you have older, less powerful hardware that you would like to give a new life. In theory, you could compile Linux from Scratch on that machine, but because the hardware is so old it will take a very long time. Using Cross Linux from Scratch you can compile a Linux from Scratch system for an older machine even if it has a different architecture than the host system being used. You can use a modern, powerful Intel Core i7 system to compile Linux for Scratch for an older PowerPC Macintosh or a wide variety of other systems. The current release of Cross Linux from Scratch can be used to compile for PowerPC, MIPS, Sparc, x86, and x86_64 architectures.
Hardened Linux from Scratch
Not as actively maintained as the other Linux from Scratch projects, Hardened Linux from Scratch is a security focused version of the basic Linux from Scratch instructions. Because the current version is quite dated, it is not necessarily truly secure, but the instructions are still worth reading for anyone interested in hardening their system. The instructions do provide valuable insights into system security, which is valuable in today's world with all its security concerns. Though it would be nice if the Hardened Linux from Scratch instructions were more up-to-date.
Resources and discussion
If you read carefully and follow the instructions provided, Linux from Scratch is not difficult. That said, it is a complex process and can get overwhelming for less-experienced users. If you do get stuck, there are plenty of places you can go to for help. The following resources should help you along if you have any questions or run in to any problems while setting up Linux from Scratch.
- Mailing lists for Linux from Scratch
- Hints for Linux from Scratch
- On IRC at: #lfs-support on irc.freenode.net
- On Reddit at: /r/linuxfromscratch