Linux from Scratch

I was given the task a few weeks ago of finding point of sale software for our clinic. I started by looking at all the open source options. Two likely candidates were PHP Point of Sale and Lemon POS. Since this point of sale would be put on either a stand-alone system or be placed on a server I decided I would set up a system for testing.  I’ve been using Linux for the last 5 years or so but I’m more of a distro and windowing user. That’s why I like Ubuntu so much. It just works out of the box.  I don’t have to compile code to get an application working.
So my first thought was to just install Ubuntu and install these applications and give them a try.  However, my boss has a different philosophy on Linux. Every Linux system we have, he compiled from source. The kernel, Apache, MySQL, everything. When I asked him about it, he mentioned that he used the project, Linux from Scratch (LFS). I started thinking, if this system got put into production, it would best it was similar to our other systems. Plus, this would give the opportunity to get under the hood and learn more about Linux.

LFS has great documentation.  I got confused at the outset because I didn’t read the first chapter or two.  This is where they explain that they are making a few assumptions and will leave certain things out of the documentation.  They also have you create a user account specifically for LFS. I ran into a problem doing this with Ubuntu. I was logged into a GNOME session with the user I created on install but using this new lfs account in bash. I was unable to run the commands that had to be run as root.  Once I logged out of GNOME and back in as the lfs user everything worked as it should.

The LFS book walks you through compiling GCC from scratch and all the other utilities you’ll need to build your system. Once you get your toolchain, then you create a virtual system and begin building the kernel and other packages. So after a few days of unpacking tar files, configuring and making, my system was ready to go.  I rebooted and modified the grub file and my system came alive.  Now the downside to an LFS system is it is barebones. No networking or X Windows or anything else.

This is where Beyond Linux from Scratch comes in.  This book describes how to get DHCP, Apache, MySQL & other tools up and running.  I came across 2 big problems but again they were because I didn’t read closely.  The first one happened when installing DHCP.  The package I installed has both the client and server packages and I installed both. This wouldn’t have been a problem but I also didn’t configure something properly and so my system would not from boot.  The DHCP server would fail and require input before the system would finish booting.  Once I went back and re-read the documentation, I removed DHCP and recompiled it and everything works as it should.  The other issue occurred when I compiled PHP.  The documentation gives several options of things to be compiled into PHP. However, the main example did not list MySQL. So I compiled PHP and then spent several hours trying to figure out why PHP Point of Sale was not working properly.  Again, rereading the book, I found a link with a nearly exhaustive list of options and realized that I had left out MySQL.

It took me several days to finally get the system up and running.  Most of that time was simply building and testing the packages.  But now, I have a Linux system that works and a better understanding of Linux.  There is still a lot of Linux that feels like black magic but I do feel a lot more comfortable on the command line.  Most of the things that I have done in the past with GNOME, I can do on the command line now.  I don’t think I will give up GNOME or KDE at home but won’t be fearful when I come across a server with only a command line.

This has been a great learning experience. If you have the time and the patience, I would highly recommend it.

One thought on “Linux from Scratch”

  1. A great experience!
    I want to build BLFS but LFS system not network. I can’t run BLFS.
    Can you share me your experience.
    Thanks,

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>