Linux From Scratch

From the days when installing a Linux distribution required a 300-page bible, to the days of Live CDs, the question "How do I learn Linux?" doesn't seem to have a ready answer. That's probably because the question itself is a little vague. If you want to learn how to use a Linux distribution, trying out one should help you. If as a network or system administrator you want to learn how to manage one, the SAG and NAG guides should get you started. But if you want to learn how a Linux distribution works, how it interacts with all the pieces of free software internally, then you need to lock yourself in a room for a weekend with a copy of Linux From Scratch (http://www.linuxfromscratch.org). Find out more from Mayank's interview with Gerard Beekmans, the LFS project initiator.

Learning Linux from Scratch

From the days when installing a Linux distribution required a 300-page bible, to the days of Live CDs, the question "How do I learn Linux?" doesn't seem to have a ready answer. That's probably because the question itself is a little vague. If you want to learn how to use a Linux distribution, trying out one should help you. If as a network or system administrator you want to learn how to manage one, the SAG and NAG guides should get you started. But if you want to learn how a Linux distribution works, how it interacts with all the pieces of free software internally, then you need to lock yourself in a room for a weekend with a copy of Linux From Scratch (http://www.linuxfromscratch.org).

Linux From Scratch or LFS as its popularly known, is actually a book, which takes you through the, pain staking and time consuming but very informative, process of putting together your own Linux distribution. The book which can be read online, or downloaded, or bought as printed book, has 9 chapters divided into 3 sections. The first chapter is an overview of the process. The second part of the book, takes you through the process of preparing a partition for the new system, getting all the required packages and creating a temporary system to work with. The third part helps to install several basic programs and setup scripts and files to get the system to boot and work.

Once through with this process, you'll end up with a system that's very secure, very flexible and also very compact. Some have managed to build an embedded system with LFS that's capable to run the Apache web server and takes less than 8 MB of disk space.

But the process doesn't stop here. As per the LFS FAQ (http://www.linuxfromscratch.org/faq/), "LFS is not intended to create your system as you want it. It's intended to be just enough to allow you to build your system as you want it. It's not an end, it's a beginning. When you're done with LFS, you've just started building your system." This is where Beyond Linux From Scratch or BLFS (http://www.linuxfromscratch.org/blfs/index.html) comes into picture.

BLFS is a much bigger manual of 43 chapters divided into 12 sections. They cover everything from installing system libraries to programming utilities, from network libraries to server applications, from simple and light-weight window managers like Fluxbox and Metacity to complex but popular ones such as KDE and GNOME. Choose what you'd want in your system and follow the instructions.

While traditionally LFS has required an existing Linux distribution to borrow several necessary files and libraries from, the project also has a Live CD (http://www.linuxfromscratch.org/livecd/index.html) that includes all the required files and the LFS manual as well.

The project has come a long way since its first release in 1999. It has several developers and users and various sub-projects. In an email interview I ask Gerard Beekmans, the guy who couldn't learn enough, how his little "note keeping" project has grown over the years.

 
Mayank Sharma: Could you please share a little about yourself? What do you do when not working on LFS? How you got started with computers?

Gerard Beekmans: I would have been around five or six years old. One evening I saw an ad on TV for some kind of computer system (might have been the Commodore 64 system that was popular at the time). I decided that I wanted to become a computer programmer.

What I do nowadays when I don't work on LFS? As far as work is concerned I'm the network admin for an ISP here in the area. I also do a fair bit of programming in Perl for another company (yes, twenty years after I saw that TV commercial I'm still a programmer).

When I don't work, I spend most my time climbing mountains and flying air planes.



MS
: What prompted you to write Linux From Scratch?

GB: I started working with Linux about eight years ago. I was living in The Netherlands at the time (where I was born and raised). After trying out a few distributions I couldn't settle on any one pre-packed system to fit my needs. I also didn't get the feeling I was learning everything I could learn about how Linux works, especially behind the scenes.

That's how the LFS project started. I was putting together a Linux system from scratch as an attempt to figure out how things worked. I wrote down the steps I took to get such a system up and running, thinking that there are probably other people out there who would be interested in it.

A few months into this project my immigration plans were finalized and I moved to Canada. I wasn't legally allowed to work for the first year, so I spent all my time on developing the LFS project.

 


MS: Computer Science students would definitely benefit from reading and trying out LFS. Who else do you think would benefit from the project?

GB: Anybody who wants to learn more about Linux, and at that, the behind the scenes things. In setting up an LFS system you need to become knowledgeable in just about every area of your system, which packages are required, which programs depend on what other programs. How to make it all fit together into a working system.

 

MS: LFS has been around forever. How has it grown over the years? It can now be extended with BLFS, hardened with HLFS, etc. Could you briefly run over the various sub-projects and how they came about?

GB: LFS has grown quite a bit. It started out as a HOWTO on what is no known as The Linux Documentation Project (TDLP). It quickly outgrew the HOWTO size and became a real book. In recent years we have published two of the editions as a real printed book.

Various sub-projects have sprung up over time:

  • BLFS - Beyond LFS. LFS provides the base of a system, but it's not ready for general use quite yet. You'll want to add more     to your system, software you'll be using for every day work (desktop managers, email programs, web browsing programs, multimedia, and more).
  • ALFS - Automated LFS. There are a few different ways of automating the LFS builds. This is especially helpful for those who build LFS systems all the time.
  • HLFS - Hardened LFS - security enhanced. Plain LFS isn't always the most secure. HLFS takes the LFS base, applies the necessary patches and techniques in order to build a more secure version of the base system.
  • CLFS - Cross-LFS - multi-platform build system. Basic LFS assumes you build and run the Linux system on the same machine.CLFS provides the mechanism to build LFS on one machine and run it on a different one (i.e.: build on a Pentium, run on an Alpha).

 

MS: What's a Live CD doing in a project that teaches people how to roll their own system?

GB: The basic technique assumes you already have Linux installed on a computer and you use an unused partition to install LFS onto.

The Live CD is a fully functional LFS system with many bells and whistles. It can function as your base system, allowing you to use a completely unused hard drive to install LFS onto, without the need to first install a regular distribution onto it.

It also makes for a great rescue CD.

 

MS: Can a system cooked up with LFS be used as a regular desktop? Could I "install" this system onto another box?

GB: You could. Of course, LFS brings with it a bit of a time burden in that you need to manually upgrade to new versions of software. I run LFS on my own desktop and server machines. It works well, if you can dedicate the time to maintaining it.

 


MS
: Since an LFS system technically isn't rpm or deb based, can packages be only installed from source?

GB: Generally, that is the case, yes. You could install rpm and dpkg programs and install RPM and DEB files. However, those packages are made especially for those distributions. Likely they won't function on other systems due to incompatible library versions for example.

However, I've been known to cut corners and grab a DEB file and use the pre-compiled programs inside of it.

 


MS
: Is LFS really platform agnostic? Will it work similarly in both 32-bit and 64-bit environments?

GB: 64-bit requires a few changes here and there, but they are already documented. A lot of people are using 64-bit platforms and the LFS system is compiled as 64-bit to take advantage of it. There have been some hurdles, but most of them are on their way of becoming history.

 

MS: Thank you for your time Gerard.

Digg!

Mayank Sharma is a freelance writer from New Delhi, India. He is blown away by the power of Free and Open Source Software and its usefulness to developing nations.

Check out his blog at http://www.geekybodhi.net/

 

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software