




























































































Estude fácil! Tem muito documento disponível na Docsity
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Prepare-se para as provas
Estude fácil! Tem muito documento disponível na Docsity
Prepare-se para as provas com trabalhos de outros alunos como você, aqui na Docsity
Encontra documentos específicos para os exames da tua universidade
Prepare-se com as videoaulas e exercícios resolvidos criados a partir da grade da sua Universidade
Responda perguntas de provas passadas e avalie sua preparação.
Ganhe pontos para baixar
Ganhe pontos ajudando outros esrudantes ou compre um plano Premium
Manual de Instalacao do Linux Livre
Tipologia: Manuais, Projetos, Pesquisas
1 / 345
Esta página não é visível na pré-visualização
Não perca as partes importantes!





























































































Created by Gerard Beekmans Edited by Matthew Burgess and Bruce Dubbs
by Created by Gerard Beekmans and Edited by Matthew Burgess and Bruce Dubbs Copyright © 1999-2012 Gerard Beekmans Copyright © 1999-2012, Gerard Beekmans All rights reserved. This book is licensed under a Creative Commons License. Computer instructions may be extracted from the book under the MIT License. Linux® is a registered trademark of Linus Torvalds.
viii
My journey to learn and better understand Linux began over a decade ago, back in 1998. I had just installed my first Linux distribution and had quickly become intrigued with the whole concept and philosophy behind Linux. There are always many ways to accomplish a single task. The same can be said about Linux distributions. A great many have existed over the years. Some still exist, some have morphed into something else, yet others have been relegated to our memories. They all do things differently to suit the needs of their target audience. Because so many different ways to accomplish the same end goal exist, I began to realize I no longer had to be limited by any one implementation. Prior to discovering Linux, we simply put up with issues in other Operating Systems as you had no choice. It was what it was, whether you liked it or not. With Linux, the concept of choice began to emerge. If you didn't like something, you were free, even encouraged, to change it. I tried a number of distributions and could not decide on any one. They were great systems in their own right. It wasn't a matter of right and wrong anymore. It had become a matter of personal taste. With all that choice available, it became apparent that there would not be a single system that would be perfect for me. So I set out to create my own Linux system that would fully conform to my personal preferences. To truly make it my own system, I resolved to compile everything from source code instead of using pre-compiled binary packages. This “perfect” Linux system would have the strengths of various systems without their perceived weaknesses. At first, the idea was rather daunting. I remained committed to the idea that such a system could be built. After sorting through issues such as circular dependencies and compile-time errors, I finally built a custom-built Linux system. It was fully operational and perfectly usable like any of the other Linux systems out there at the time. But it was my own creation. It was very satisfying to have put together such a system myself. The only thing better would have been to create each piece of software myself. This was the next best thing. As I shared my goals and experiences with other members of the Linux community, it became apparent that there was a sustained interest in these ideas. It quickly became plain that such custom-built Linux systems serve not only to meet user specific requirements, but also serve as an ideal learning opportunity for programmers and system administrators to enhance their (existing) Linux skills. Out of this broadened interest, the Linux From Scratch Project was born. This Linux From Scratch book is the central core around that project. It provides the background and instructions necessary for you to design and build your own system. While this book provides a template that will result in a correctly working system, you are free to alter the instructions to suit yourself, which is, in part, an important part of this project. You remain in control; we just lend a helping hand to get you started on your own journey. I sincerely hope you will have a great time working on your own Linux From Scratch system and enjoy the numerous benefits of having a system that is truly your own.
-- Gerard Beekmans [email protected]
There are many reasons why you would want to read this book. One of the questions many people raise is, “why go through all the hassle of manually building a Linux system from scratch when you can just download and install an existing one?”
x
The default 64-bit build that results from LFS is considered a "pure" 64-bit system. That is, it supports 64-bit executables only. Building a "multi-lib" system requires compiling many applications twice, once for a 32-bit system and once for a 64-bit system. This is not directly supported in LFS because it would interfere with the educational objective of providing the instructions needed for a straightforward base Linux system. You can refer to the Cross Linux From Scratch project for this advanced topic. There is one last comment about 64-bit systems. There are some packages that cannot currently be built in a "pure" 64- bit system or require specialized build instructions. Generally, these packages have some embedded 32-bit specific assembly language instructions that fail when building on a 64-bit system. This includes some Xorg drivers from Beyond Linux From Scratch (BLFS). Many of these problems can be worked around, but may require some specialized procedures or patches.
LFS and Standards
The structure of LFS follows Linux standards as closely as possible. The primary standards are:
Many people do not agree with the requirements of the LSB. The main purpose of defining it is to ensure that proprietary software will be able to be installed and run properly on a compliant system. Since LFS is source based, the user has complete control over what packages are desired and many choose not to install some packages that are specified by the LSB.
Creating a complete LFS system capable of passing the LSB certifications tests is possible, but not without many additional packages that are beyond the scope of LFS. Most of these additional packages have installation instructions in BLFS.
LSB Core: Bash, Binutils, Coreutils, Diffutils, File, Findutils, Gawk, Grep, Gzip, M4, Man- DB, Ncurses, Procps, Psmisc, Sed, Shadow, Tar, Util-linux, Zlib LSB C++: Gcc LSB Desktop: None LSB Runtime Languages: Perl LSB Printing: None LSB Multimeda: None
LSB Core: Bc, Cpio, Ed, Fcrontab, Initd-tools, PAM, Sendmail (or Postfix or Exim) LSB C++: None
xi
LSB Desktop: ATK, Cairo, Desktop-file-utils, Freetype, Fontconfig, Glib2, GTK+2, Icon- naming-utils, Libjpeg, Libpng, Libxml2, MesaLib, Pango, Qt3, Qt4, Xorg LSB Runtime Languages: Python LSB Printing: CUPS LSB Multimeda: Alsa Libraries, NSPR, NSS, OpenSSL, Java
LSB Core: At, Batch, Lsb_release LSB C++: None LSB Desktop: None LSB Runtime Languages: None LSB Printing: None LSB Multimeda: Xdg-utils
Rationale for Packages in the Book
As stated earlier, the goal of LFS is to build a complete and usable foundation-level system. This includes all packages needed to replicate itself while providing a relatively minimal base from which to customize a more complete system based on the choices of the user. This does not mean that LFS is the smallest system possible. Several important packages are included that are not strictly required. The lists below document the rationale for each package in the book.
xiii
This package contains programs for searching through files. These programs are used by most packages' build scripts.
This package contains programs for processing and formatting text. One important function of these programs is to format man pages.
This package is the Grand Unified Boot Loader. It is one of several boot loaders available, but is the most flexible.
This package contains programs for compressing and decompressing files. It is needed to decompress many packages in LFS and beyond.
This package provides data for network services and protocols. It is needed to enable proper networking capabilities.
This package contains programs for basic network administration.
This package contains programs for basic and advanced IPv4 and IPv6 networking. It was chosen over the other common network tools package (net-tools) for its IPv6 capabilities.
This package contains key-table files, keyboard utilities for non-US keyboards, and a number of console fonts.
This package contains programs needed to administer Linux kernel modules.
This package contains a very nice text file viewer that allows scrolling up or down when viewing a file. It is also used by Man-DB for viewing manpages.
This package contains the GNU generic library support script. It wraps the complexity of using shared libraries in a consistent, portable interface. It is needed by the test suites in other LFS packages.
This package is the Operating System. It is the Linux in the GNU/Linux environment.
This package contains a general text macro processor useful as a build tool for other programs.
This package contains a program for directing the building of packages. It is required by almost every package in LFS.
xiv
This package contains programs for finding and viewing man pages. It was chosen instead of the man package due to superior internationalization capabilities. It supplies the man program.
This package contains the actual contents of the basic Linux man pages.
This package contains functions for the arithmetic of complex numbers. It is required by Gcc.
This package contains functions for multiple precision arithmetic. It is required by Gcc.
This package contains libraries for terminal-independent handling of character screens. It is often used to provide cursor control for a menuing system. It is needed by a number of packages in LFS.
This package contains a program for modifying or creating files by applying a patch file typically created by the diff program. It is needed by the build procedure for several LFS packages.
This package is an interpreter for the runtime language PERL. It is needed for the installation and test suites of several LFS packages.
This package contains programs for monitoring processes. These programs are useful for system administration, and are also used by the LFS Bootscripts.
This package contains programs for displaying information about running processes. These programs are useful for system administration.
This package is a set of libraries that offers command-line editing and history capabilities. It is used by Bash.
This package allows editing of text without opening it in a text editor. It is also needed by most LFS packages' configure scripts.
This package contains programs for handling passwords in a secure way.
This package contains programs for logging system messages, such as those given by the kernel or daemon processes when unusual events occur.
This package provides the init program, which is the parent of all other processes on the Linux system.
xvi
Host System Requirements
Your host system should have the following software with the minimum versions indicated. This should not be an issue for most modern Linux distributions. Also note that many distributions will place software headers into separate packages, often in the form of “-devel” or “-dev”. Be sure to install those if your distribution provides them. Earlier versions of the listed software packages may work, but has not been tested.
xvii
To see whether your host system has all the appropriate versions, and the ability to compile programs, run the following:
cat > version-check.sh << "EOF" #!/bin/bash
export LC_ALL=C bash --version | head -n1 | cut -d" " -f2- echo "/bin/sh -> readlink -f /bin/sh" echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3- bison --version | head -n if [ -e /usr/bin/yacc ]; then echo "/usr/bin/yacc -> readlink -f /usr/bin/yacc"; else echo "yacc not found"; fi
bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f1,6- echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f diff --version | head -n find --version | head -n gawk --version | head -n if [ -e /usr/bin/awk ]; then echo "/usr/bin/awk -> readlink -f /usr/bin/awk"; else echo "awk not found"; fi
gcc --version | head -n ldd --version | head -n1 | cut -d" " -f2- # glibc version grep --version | head -n gzip --version | head -n cat /proc/version m4 --version | head -n make --version | head -n patch --version | head -n echo Perl perl -V:version sed --version | head -n tar --version | head -n echo "Texinfo: makeinfo --version | head -n1" xz --version | head -n
echo 'main(){}' > dummy.c && gcc -o dummy dummy.c if [ -x dummy ] then echo "gcc compilation OK"; else echo "gcc compilation failed"; fi rm -f dummy.c dummy EOF
bash version-check.sh
xix
passwd will print the first man page it finds that matches “passwd”, which will be /usr/share/man/man1/ passwd.1. For this example, you will need to run man 5 passwd in order to read the specific page being referred to. It should be noted that most man pages do not have duplicate page names in different sections. Therefore, man __ is generally sufficient.
Structure
This book is divided into the following parts.
Part I - Introduction
Part I explains a few important notes on how to proceed with the LFS installation. This section also provides meta- information about the book.
Part II - Preparing for the Build
Part II describes how to prepare for the building process—making a partition, downloading the packages, and compiling temporary tools.
Part III - Building the LFS System
Part III guides the reader through the building of the LFS system—compiling and installing all the packages one by one, setting up the boot scripts, and installing the kernel. The resulting Linux system is the foundation on which other software can be built to expand the system as desired. At the end of this book, there is an easy to use reference listing all of the programs, libraries, and important files that have been installed.
Errata
The software used to create an LFS system is constantly being updated and enhanced. Security warnings and bug fixes may become available after the LFS book has been released. To check whether the package versions or instructions in this release of LFS need any modifications to accommodate security vulnerabilities or other bug fixes, please visit http://www.linuxfromscratch.org/lfs/errata/7.1/ before proceeding with your build. You should note any changes shown and apply them to the relevant section of the book as you progress with building the LFS system.