- Знакомьтесь — Linux From Scratch
- Вместо вступления
- Единственный бумажный дистрибутив
- Но почему начинать с него?
- Цифры и суровая правда жизни
- Состав дистрибутива
- Вместо заключения
- What is Linux From Scratch?
- Why would I want an LFS system?
- What can I do with my LFS system?
- Who’s who:
- Download the Linux From Scratch Book
- Current Stable
- Current Development
- Systemd version of LFS
- Current Stable
- Current Development
- LFS Museum
- Packages for LFS
- Hunt and Peck
- LFS HTTP/FTP Sites
- Read the Linux From Scratch Book Online
- Current Stable
- Current Development
- Systemd version of LFS
- Current Stable
- Current Development
- Translations
- What is Automated Linux From Scratch?
- Why would I want to use ALFS?
- How is ALFS implemented?
- History
- nALFS
- Who’s who:
Знакомьтесь — Linux From Scratch
Вместо вступления
«Хочешь начать изучать GNU/Linux? Начни с Linux From Scratch.»
Единственный бумажный дистрибутив
LFS (здесь и далее аббревиатура от Linux From Scratch) – книга, написанная Герардом Бикмансом, описывающая процесс сборки минимального рабочего варианта GNU/Linux из исходных кодов. Почему бумажный? В свое время книгу можно было купить в твердом переплете, что делает «дистрибутив» несколько необычным, не правда-ли? Помимо самой книги, для сборки конечно-же понадобится интернет (или заранее загруженные исходные коды), свободный раздел на жестком диске, и любая операционная система на базе ядра Linux, имеющая компилятор. Лично я всегда использую либо уже собранный дистрибутив LFS, либо полную установку Slackware – в нем есть все необходимое, чего не скажешь про (например) Ubuntu. Конечно, всегда можно загрузить нехватающие пакеты, но ведь мы хотим только-только научиться линуксу? А Slackware даже в своей базовой установке и без конфигурирования предоставляет требуемый инструментарий.
Следует сказать сразу — дистрибутив собранный по книге LFS не умеет толком ничего. Вернее, ничего такого, что потребуется неискушенному пользователю. Он умеет включаться, выключаться, перезагружаться, использовать Ethernet подключение, но что самое главное — компилировать. Так существуют другие книги, теперь уже поддерживаемые сообществом — Beyond LFS позволяет собрать те самые, интересные пользователю, программы. От браузера и графической среды, до систем управления базами данных и DHCP сервера. Книга имеет свойство отставать в версии от базовой книги, но полученный от LFS опыт обычно достаточен, для самостоятельного разрешения конфликтов версий. Три другие книги — Automated LFS, Cross LFS и Hardened LFS полностью соответствуют названиям и выходят за пределы этой статьи. Впрочем, всегда можно почитать в интернете, правда?
Но почему начинать с него?
Все очень просто, если не сказать — до смешного. Помимо инструкций, в книге много теоретического (но крайне сжатого и как следствие — не заунывного) материала. Установите Ubuntu. Вы знаете что делает пакет Libtool? Или Gawk? После пары успешных сборок LFS, вы будете знать каждый пакет в своей системе и что самое главное — представлять, как они взаимодействуют. Да, состав системы минимальный, но это постоянно подогревает интерес к ее усовершенствованию. Приучит частенько обращаться за помощью к Google и читать англоязычную документацию. Поначалу вы не будете понимать и половины своих действий, внимательно перепечатывая или копируя блоки кода в консоль. Но в самом конце, осознание того, что эту неказистую, без поддержки графики и вашей мощной видеокарты, без новомодного Aero и сенсорных экранов, операционную систему вы собрали сами, придаст вам такой запас сил и гордость, что вы сами потянитесь за новыми знаниями и новыми победами. Я немного утрирую, но ощущения после первой перезагрузки в новую систему сложно забыть даже сейчас.
Цифры и суровая правда жизни
LFS вовсе не минимальный по своему весу дистрибутив. Для сборки потребуется порядка 3 свободный гигабайтов на диске (это помимо уже рабочей Linux-Based системы) — тем не менее, после определенных танцев, систему можно будет превратить в Live-CD. Если у меня будет такая возможность, я расскажу как это делается, в последствии. Компиляция всего и вся (с учетом необходимости создания конфигурационных файлов и прочего) занимает около двух дней. Это если с перерывами на сон, питание и отключение компьютера на ночь. С другой стороны, это зависит от производительности компьютера, на котором собирается система. Моей первой жертвой был ноутбук MSI X-340 — процессор Intel Core 2 Solo с тактовой частотой 1.2 гигагерца (вообще говоря, LFS рекомендуется собирать на одноядерной системе). Оперативная память — 2GB DDR2. Вполне достаточно даже более низких характеристик, а на быстром процессоре сборка пойдет значительно быстрее.
Кстати, приблизительное время сборки каждого из пакетов указано в учебнике. За единицу времени, принимается время сборки пакета Binutils — ассемблера, линкера и ряда других, более мелких утилит для работы с объектными файлами. На вышеуказанной системе это заняло три минуты.
Состав дистрибутива
Перечислять все входящие в LFS пакеты не имеет большого смысла. Список получится длинным, и практически ни о чем не говорящим новичку; избыточным для человека разбирающегося. В этом небольшом разделе я лишь хотел дать несколько общих советов. Во-первых, собирая пакет, не описанный в книге, загляните в репозиторий патчей — возможно его уже адаптировали для использования в LFS. Во-вторых, BLFS почти полностью состоит из опциональных пакетов — просто выбирайте те, которые вам нужны и смело добавляйте в свою сборку LFS. И третье: с самого начала используйте пакетный менеджер. В книге этому уделяется глава, но практические инструкции отсутствуют чуть менее, чем полностью. Я лишь могу порекомендовать Guarded Installation Tool – написанный на Bash’е скрипт, обеспечивающий минимальный набор команд, для управления пакетами, зависимостями и версиями. В LFS этого будет достаточно. В последствии вы можете скомпилировать из исходных кодов APT или DPKG — это неплохо освещено на форумах сообщества.
Вместо заключения
За прошедшие полтора года я сильно продвинулся в своем изучении. Продвинулся со стадии «Есть такая операционная система» до уровня «Подниму сервер под Gentoo за трое суток». Я еще очень далек от идеала и вряд ли могу даже называть себя настоящий линуксоидом — на домашнем компьютере уживаются старенькая Windows XP и Xubuntu 10.10, но знаете что я отвечаю, когда меня спрашивают с чего начать изучать линукс? Начните с Linux From Scratch.
Источник
What is Linux From Scratch?
Linux From Scratch (LFS) is a project that provides you with step-by-step instructions for building your own customized Linux system entirely from source.
Why would I want an LFS system?
Many wonder why they should go through the hassle of building a Linux system from scratch when they could just download an existing Linux distribution. However, there are several benefits of building LFS. Consider the following:
LFS teaches people how a Linux system works internally
Building LFS teaches you about all that makes Linux tick, how things work together and depend on each other. And most importantly, how to customize it to your own tastes and needs.
Building LFS produces a very compact Linux system
When you install a regular distribution, you often end up installing a lot of programs that you would probably never use. They’re just sitting there taking up (precious) disk space. It’s not hard to get an LFS system installed under 100 MB. Does that still sound like a lot? A few of us have been working on creating a very small embedded LFS system. We installed a system that was just enough to run the Apache web server; total disk space usage was approximately 8 MB. With further stripping, that can be brought down to 5 MB or less. Try that with a regular distribution.
LFS is extremely flexible
Building LFS could be compared to a finished house. LFS will give you the skeleton of a house, but it’s up to you to install plumbing, electrical outlets, kitchen, bath, wallpaper, etc. You have the ability to turn it into whatever type of system you need it to be, customized completely for you.
LFS offers you added security
You will compile the entire system from source, thus allowing you to audit everything, if you wish to do so, and apply all the security patches you want or need to apply. You don’t have to wait for someone else to provide a new binary package that (hopefully) fixes a security hole. Often, you never truly know whether a security hole is fixed or not unless you do it yourself.
What can I do with my LFS system?
A by-the-book LFS system is fairly minimal, but is designed to provide a strong base on which you can add any packages you want. See the BLFS project for a selection of commonly used packages.
Who’s who:
- Project Creator: Gerard Beekmans
- Managing Editor: Bruce Dubbs
- Editor: Ken Moffat
- Editor: Pierre Labastie
- Editor: DJ Lucas
- Editor: Douglas R. Reno
- Editor: Thomas Trepl
- Editor: Tim Tassonis
- Editor: Xi Ruoyao
- Plus numerous people who contribute to the book and its side projects.
© 1998-2021 Gerard Beekmans. Website design by Jeremy Huntwork & Matthew Burgess.
Источник
Download the Linux From Scratch Book
Several versions of the LFS book are available for download, in several formats:
Current Stable
This is the latest released LFS book, well tested and mature enough for everyday use.
You may download the stable book in various formats from the stable book directory.
Current Development
This is the LFS Book in its current development state. Changes can happen that break the build temporarily.
Not recommended for inexperienced LFS’ers.
Daily rendered snapshots may be downloaded. Or check out the book’s XML source from our Git repository and render it yourself:
git clone git://git.linuxfromscratch.org/lfs.git lfs-git
Systemd version of LFS
Current Stable
This is the latest released LFS systemd book, well tested and mature enough for everyday use.
You may download the stable book in various formats from the stable book directory.
Current Development
This is the LFS systemd Book in its current development state. Changes can happen that break the build temporarily.
Not recommended for inexperienced LFS’ers.
Daily rendered snapshots may be downloaded. Or check out the book’s XML as above and render it yourself:
After the prerequisites listed in the INSTALL file are present, use ‘make REV=systemd’, to render the book. Additional information is listed in the README file.
LFS Museum
Old and crusty. But still useful as an educational experience, or to see how LFS has grown over the years. https://www.linuxfromscratch.org/lfs/downloads/
Packages for LFS
LFS has a list of packages and patches which you should download. Please use the versions which are listed in the book (see the FAQ); these are tested versions which are known to work with each other. There are several ways to download the packages.
Hunt and Peck
When a package is not available from the location listed in the book, some other places to try are:
- A search for the full package name in google or your favorite search engine
- Debian Package Search Page
- Sources from your linux distro
LFS HTTP/FTP Sites
If the above methods are not available to you, the packages are also available in a tarball and individually on the following ftp and http mirrors.
© 1998-2021 Gerard Beekmans. Website design by Jeremy Huntwork & Matthew Burgess.
Источник
Read the Linux From Scratch Book Online
Two versions of the LFS Book are available for viewing online, the stable released book and the daily rendered development book:
Current Stable
This is the latest released LFS book that is considered stable. Most people will want to read this book.
As a result of bugs and security warnings, please be sure to read both the errata page and the Security Advisories for any modifications needed to the LFS build.
Current Development
This is the LFS Book in its current development state. While it may provide more features and updated upstream packages than the stable book, it is more prone to bugs and security vulnerabilities. Use with care.
Security vulnerabilities and other bugs may be present in the bug database but there may be others not yet reported.
Note: There is an automatically generated wget list available to fetch all LFS Book packages automatically.
Systemd version of LFS
Current Stable
This is the latest released LFS systemd book, considered stable. Most people will want to read this book.
As a result of bugs and security warnings, please be sure to read both the errata page and the Security Advisories for any modifications needed to the LFS build.
Current Development
This is the LFS systemd Book in its current development state. Whilst it may provide more features and updated upstream packages than the stable book, it is more prone to bugs and security vulnerabilities. Use with care.
Translations
The LFS book has been translated in various languages. Note that these translations were done by volunteers and may contain translation errors which the LFS team cannot control. In that case, contact the translator directly.
Please note that all versions of LFS | LFS development (sysv) | LFS development (systemd)
Translated by Xi Ruoyao
If you find any issue or potential improvement of the translation, please report to the issue tracker of the the GitHub repository.
Источник
What is Automated Linux From Scratch?
Automated Linux From Scratch (ALFS) is a project that allows building the LFS system automatically. It also allows building packages from the BLFS book, but that needs some manual intervention.
Why would I want to use ALFS?
After having gone through the LFS and BLFS books more than 2 or 3 times, you will quickly appreciate the ability to automate the task of compiling the software you want for your systems.
The goal of ALFS is to automate the process of creating an LFS system. It seeks to follow the book as closely as possible by directly extracting instructions from the XML sources. This is the reason why it may also be used as a test of the current book instructions.
How is ALFS implemented?
The official implementation of ALFS is called jhalfs. It was originally created by Jeremy Huntwork, then developed and maintained by Manuel Canales Esparcia, George Boudreau, Thomas Pegg, and Pierre Labastie. It has become a light-weight, practical method of automating an LFS build. It is a Bash shell script that makes use of Git and xsltproc to first download the XML sources of the Linux From Scratch book and then extract any necessary commands, placing them into executable shell scripts. If you do not already have the necessary source packages in place on your system, jhalfs can fetch them. Finally, jhalfs generates a Makefile which will control the execution of the shell scripts, allowing for recovery if the build should encounter an error. A framework to use package management has been added by Pierre Labastie.
Due to a lack of developers, jhalfs is maintained as a rolling release. It can be obtained by cloning the git repository:
git clone git://git.linuxfromscratch.org/jhalfs.git jhalfs
An extension of ALFS aimed at automating the building of packages in the BLFS book is now included in jhalfs. It still needs editing some scripts (about 1%), mainly when the book layout diverges from standard, but works rather well and most of the packages can be built automatically.
History
Before jhalfs, an implementation named nALFS was developed. A more ambitious project, named simply alfs was designed around 2004, but was never pushed to completion.
nALFS
The first ALFS implementation was nALFS by Neven Has. nALFS was a small program written in C. It first parsed an XML profile that contained information concerning the LFS build process into a series of internal commands. It could then execute these at your discretion, thus automating the compilation of LFS.
There were many in-depth features that had been requested for ALFS implementations. Because of this, development had been slated for an entirely new build tool which would have been called alfs. Eventually, the ease of use of jhalfs ultimately pushed development of alfs to the bottom of the stack.
Who’s who:
- Project Leader and Developper/Maintainer: Pierre Labastie
- Former Maintainer: Thomas Pegg
- Former Developers(jhalfs): Jeremy Huntwork, George Boudreau
- Former Developer(jhalfs, blfs tools): Manuel Canales Esparcia
© 1998-2021 Gerard Beekmans. Website design by Jeremy Huntwork & Matthew Burgess.
Источник