📜 ⬆️ ⬇️

Meet Linux From Scratch

Instead of intro


Tux Construction. From early childhood I was interested in computers. This interest grew out of games under MS-DOS at kindergarten age, ending with all sorts of programming contests at the end of school. Not surprisingly, after school I went to study at a technical institute as a programmer. The most strange thing is that all these years I was absolutely far from such a wonderful operating system like GNU / Linux. But a year and a half ago, at the very beginning of the first semester, I met a guy (he was slightly older than me and went to college after the technical school - having work experience), who during one of the conversations said:
“Want to start learning GNU / Linux? Start with Linux From Scratch. ”


The only paper distribution


LFS (hereafter the abbreviation from Linux From Scratch ) is a book written by Gerard Beekmans, describing the process of building a minimal working version of GNU / Linux from source codes. Why paper? At one time, the book could have been purchased in hardcover, which makes the “distribution” somewhat unusual, isn't it? In addition to the book itself, for assembly, of course, you also need the Internet (or pre-loaded source codes), a free partition on the hard disk, and any operating system based on the Linux kernel that has a compiler. Personally, I always use either the LFS distribution I have already compiled, or the complete Slackware installation — it has everything you need, which can't be said about (for example) Ubuntu. Of course, you can always download missing packages, but we just want to learn how to Linux? And Slackware provides the required tools even in its basic installation and without configuration.


It should be said right away - the distribution kit compiled from the LFS book doesn’t really know how. Rather, nothing that would require an inexperienced user. He knows how to turn on, turn off, reboot, use an Ethernet connection, but most importantly - compile. So there are other books now supported by the community - Beyond LFS allows you to collect the most interesting programs for the user. From the browser and graphical environment to database management systems and a DHCP server. The book tends to lag behind the base book in the version, but the experience gained from the LFS is usually sufficient for self-resolution of version conflicts. Three other books - Automated LFS, Cross LFS and Hardened LFS are fully consistent with the titles and beyond the scope of this article. However, you can always read on the Internet, right?
')

But why start with it?


It's very simple, if not to say - ridiculously. In addition to the instructions, the book contains a lot of theoretical (but extremely compressed and as a result - not mournful) material. Install Ubuntu. Do you know what the libtool package does? Or Gawk? After a couple of successful LFS builds, you will know each package in your system, and most importantly, imagine how they interact. Yes, the composition of the system is minimal, but it constantly stirs interest in its improvement. He often teaches to google for help and read English documentation. At first, you will not understand even half of your actions, carefully reprinting or copying blocks of code into the console. But at the very end, the realization that this inconspicuous, without the support of graphics and your powerful video card, without the modern Aero and touch screens, you assembled the operating system yourself, will give you such a reserve of strength and pride that you will reach out for new knowledge and new victories. I'm exaggerating a bit, but the feeling after the first reboot into the new system is difficult to forget even now.

Numbers and the harsh truth of life


LFS is not at all a minimum distribution package. The build will require about 3 gigabytes of free disk space (this is in addition to the already working Linux-Based system) - however, after certain dances, the system can be turned into a Live-CD. If I have such an opportunity, I will tell you how this is done later. Compiling everything and everything (taking into account the need to create configuration files and other things) takes about two days. This is if with breaks for sleeping, powering and turning off the computer at night. On the other hand, it depends on the performance of the computer on which the system is built. My first victim was the MSI X-340 laptop, an Intel Core 2 Solo processor with a clock speed of 1.2 gigahertz (in general, LFS is recommended to be built on a single-core system). RAM - 2GB DDR2. Even lower performance is quite enough, and on a fast processor the assembly will go much faster.

By the way, the approximate build time of each package is indicated in the tutorial. Per unit of time, the build time of the Binutils package — assembly language, linker, and a number of other, smaller utilities for working with object files is taken. On the above system it took three minutes.

Distribution kit


Listing all LFS packages does not make much sense. The list will turn out to be long, and practically speaking to nothing about the newcomer; overweight for the person understanding. In this small section, I just wanted to give some general tips. First, when collecting a package that is not described in the book, take a look at the patch repository — perhaps it has already been adapted for use in LFS. Secondly, BLFS is almost entirely made up of optional packages — just choose the ones you need and feel free to add to your LFS build. And the third: from the very beginning use the package manager. The book is devoted to this chapter, but practical instructions are missing a little less than full. I can only recommend the Guarded Installation Tool — a script written in Bash that provides a minimal set of commands for managing packages, dependencies, and versions. In the LFS this will be enough. Later you can compile from the sources of APT or DPKG - this is well covered in community forums.

Instead of conclusion


Over the past year and a half, I have greatly advanced in my study. I advanced from the stage “There is such an operating system” to the level “I will raise the server under Gentoo in three days”. I'm still very far from ideal and I can hardly even call myself a real Linux user - an old Windows XP and Xubuntu 10.10 get along on a home computer, but do you know what I answer when they ask me where to start learning Linux? Start with Linux From Scratch.

Literature




PS Thanks to those who wrote in lichku. Corrected errors, slightly moved habrakat.

Source: https://habr.com/ru/post/113615/


All Articles