I’m going to start a new series here, one that I hope is very informative. But, first, I would like to give a little bit of real-world ideals as to how this will be beneficial.
This series is going to focus on Linux From Scratch (LFS), and how to build up from LFS to BLFS (Beyond LFS), and then HLFS (Hardened LFS). While this may not be substainable for companies already deploying pre-packaged servers (i.e.: CentOS, Debian, Arch Linux, etc…), the experience and knowledge gained from this will be substantial. It can not only provide a better service to your customers, but knowing how things actually work, what’s needed, and being able to make a Linux fitting your needs, instead of everyones, can make your life easier.
When building LFS, it will be a very painful, grueling task. At the time of writing this, I’ve spent a good five hours trying to make a successful build, and keep running into roadblocks. The documentation provided by LFS is helpful (the development side is a lot more detailed), but still fails to explain what’s going on in some aspects. However, getting to the finish line is a huge accomplishment.
The guide will focus on a more sysadmin approach, especially when reaching the BLFS and HLFS sections. My main goal is to provide scripts and programs that will make certain tasks easier for the sysadmins, but also give regular Linux users a bigger insight into how to make their Linux more secure.
This guide will have requirements that are not quite the same as the guide.
I will be using VMware (VirtualBox should work as well) to manage the whole process. This will be done for ease of use, and you will have to repartition the hard drive if you use your desktop, this makes the process easier. Also, it helps to reduce the amount of panics if you make a big mistake (which will most likely happen).
Next, you should have at least 512 MB of swap set up in the virtual machine, just to be on the safe side. My set up is 512 MB RAM for the virutal machine, and 1 GB (1024 MB) for the swap.
While LFS says that only about 10 GB at most will be fine, I created an 80 GB virtual drive, dedicating 60 GB to the main OS (guest OS in terms of virtualization), and 20 GB for the LFS development. I’d rather be safe than sorry, and since I save my virtual machines to a second hard drive (1 TB), I’m not too worried about space. However, 10-15 GB for the LFS should be fine, and about 5 GB for the main OS should suffice too.
This requires that the main OS be Linux, in order to use the system’s GCC and Binutils (which will be more clear later). I do highly recommend that a 32-bit system be used, even if your system supports 64-bit. If you try to do a 64-bit LFS, you’ll have to compile everything twice (which I won’t get into in this guide, as I haven’t done it yet). My OS of choice for this has been Fedora, but I’m sure any will be good. I’ll do my best to provide steps for both when possible, but you will have to make changes if it doesn’t work for you (or post a comment and I’ll try my best to help).
As I said, the main OS’s tool chain will be used to set up a temporary toolchain for the LFS. I’ll go into detail on how to set this up in the next post, but if you’d like to speed the process up a little bit, install your Linux’s build toolchain on your own.