### Install the Shadow package and man pages Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/shadow These commands install the compiled Shadow package and its man pages. 'make exec_prefix=/usr install' installs the binaries and libraries, while 'make -C man install-man' installs the documentation. ```shell make exec_prefix=/usr install make -C man install-man ``` -------------------------------- ### Install GMP Package and Documentation Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/gmp These commands install the compiled GMP libraries and their associated documentation to their designated locations on the system. 'make install' installs the libraries, and 'make install-html' installs the HTML documentation. ```bash make install make install-html ``` -------------------------------- ### Tracing Installation Scripts with strace Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/pkgmgt This technique utilizes the 'strace' command to log all system calls made during the execution of installation scripts. This provides a detailed trace of filesystem operations performed by the installer, enabling the identification of all installed files. It's a robust method for observing the installation process. ```shell strace -o install.log make install ``` -------------------------------- ### Install Readline Documentation Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/readline This command installs the documentation files for the Readline package. It copies PostScript, PDF, HTML, and DVI versions of the documentation to the specified directory. ```shell install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-8.3 ``` -------------------------------- ### Compile, Test, and Install Inetutils Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/inetutils Compiles the Inetutils package, runs its test suite, and installs the compiled binaries. The `make check` step may encounter a known failure with the `libls.sh` test, which is noted as acceptable. ```bash `make` `make check` `make install` ``` -------------------------------- ### Prepare and Compile Vim Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/vim Configures Vim for compilation with a specified installation prefix and then compiles the package. The --prefix=/usr option ensures Vim is installed in the standard user program directory. ```bash ./configure --prefix=/usr make ``` -------------------------------- ### Configure Inetutils for Installation Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/inetutils Configures the Inetutils package for compilation and installation with specific options. This includes setting installation directories and disabling optional programs that are either outdated, insecure, or replaced by other packages. ```bash `./configure --prefix=/usr \ --bindir=/usr/bin \ --localstatedir=/var \ --disable-logger \ --disable-whois \ --disable-rcp \ --disable-rexec \ --disable-rlogin \ --disable-rsh \ --disable-servers` ``` -------------------------------- ### Install Python 3 Documentation Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/Python Installs the preformatted HTML documentation for Python 3. This command ensures correct ownership and permissions for the documentation files. ```bash install -v -dm755 /usr/share/doc/python-3.13.7/html tar --strip-components=1 \ --no-same-owner \ --no-same-permissions \ -C /usr/share/doc/python-3.13.7/html \ -xvf ../python-3.13.7-docs-html.tar.bz2 ``` -------------------------------- ### Install Expect and Create Symbolic Link Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/expect This command installs the compiled Expect package and creates a symbolic link to the main Expect shared library in the system's library directory. 'make install' places the files in their designated locations, and the 'ln -svf' command creates the necessary link for system-wide access. ```shell make install ln -svf expect5.45.4/libexpect5.45.4.so /usr/lib ``` -------------------------------- ### Install Gawk Documentation Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/gawk Installs Gawk's documentation files into the appropriate system directory. This command copies various documentation files, including text, EPS, PDF, and JPG formats, to '/usr/share/doc/gawk-5.3.2', making them accessible for users. ```bash install -vDm644 doc/{awkforai.txt,*.{eps,pdf,jpg}} -t /usr/share/doc/gawk-5.3.2 ``` -------------------------------- ### Compile and Install Ncurses Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter06/ncurses Compiles the Ncurses package and then installs it into the LFS system. This includes creating a necessary symbolic link for `libncurses.so` and modifying the `curses.h` header file to ensure compatibility with wide-character support. ```shell make make DESTDIR=$LFS install ln -sv libncursesw.so $LFS/usr/lib/libncurses.so sed -e 's/^#if.*XOPEN.*$/#if 1/' \ -i $LFS/usr/include/curses.h ``` -------------------------------- ### Configure, Compile, and Install Texinfo Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/texinfo Standard build process for Texinfo. It involves configuring the package for installation in /usr, compiling the source code, checking the build, and installing the binaries and libraries. ```shell `./configure --prefix=/usr` `make` `make check` `make install` ``` -------------------------------- ### Install DejaGNU Package and Documentation Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/dejagnu Installs the compiled DejaGNU package and its generated documentation to their designated locations within the system. This makes the DejaGNU framework and its documentation accessible for use. ```shell make install install -v -dm755 /usr/share/doc/dejagnu-1.6.3 install -v -m644 doc/dejagnu.{html,txt} /usr/share/doc/dejagnu-1.6.3 ``` -------------------------------- ### Configure Ncurses Build Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/ncurses Configures the Ncurses build with options to enable shared libraries, C++ bindings, and pkg-config files, while disabling debug and static libraries. This setup is crucial for terminal-independent character screen handling. ```bash ./configure --prefix=/usr \ --mandir=/usr/share/man \ --with-shared \ --without-debug \ --without-normal \ --with-cxx-shared \ --enable-pc-files \ --with-pkg-config-libdir=/usr/lib/pkgconfig ``` -------------------------------- ### Switch to 'lfs' User's Login Shell (Bash) Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter04/addinguser This command switches the current user to the 'lfs' user and starts a login shell, which is recommended for running subsequent installation commands to ensure a clean and isolated environment. ```bash su - `lfs` ``` -------------------------------- ### Glibc Cross-Compilation Configuration Source: https://www.linuxfromscratch.org/lfs/view/stable/partintro/toolchaintechnotes This example demonstrates the configuration options used for cross-compiling Glibc. The '--host=$LFS_TGT' option ensures the use of tools prefixed with '$LFS_TGT-', while '--build=$(../scripts/config.guess)' enables cross-compilation mode. The DESTDIR variable is used for installation into the LFS file system. ```bash ./configure --prefix=/usr \ --host=$LFS_TGT \ --build=$(../scripts/config.guess) \ --enable-kernel=3.2 \ --with-headers=/usr/include \ libc_cv_forced_unwind=yes \ libc_cv_c_cleanup=yes make DESTDIR=$LFS make DESTDIR=$LFS install ``` -------------------------------- ### Generate Bootable ISO and Burn to CD-ROM with GRUB Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter10/grub This snippet demonstrates how to create a bootable GRUB ISO image using `grub-mkrescue` and then burn this ISO to a CD-ROM using `xorriso`. This is useful for creating an emergency boot disk. Ensure `xorriso` is installed from the libisoburn package before running. ```bash cd /tmp grub-mkrescue --output=grub-img.iso xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso ``` -------------------------------- ### Install Ncurses with DESTDIR Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/ncurses Installs the Ncurses package using a DESTDIR for staged installation, followed by manual installation of the shared library and modification of the curses.h header to ensure wide-character ABI compatibility. This process is designed to prevent potential shell crashes during installation. ```bash make DESTDIR=$PWD/dest install install -vm755 dest/usr/lib/libncursesw.so.6.5 /usr/lib rm -v dest/usr/lib/libncursesw.so.6.5 sed -e 's/^#if.*XOPEN.*$/#if 1/' \ -i dest/usr/include/curses.h cp -av dest/* / ``` -------------------------------- ### Configuration File Content Example Source: https://www.linuxfromscratch.org/lfs/view/stable/prologue/typography Shows an example of content for a configuration file, specifically the `/etc/group` file. This uses a heredoc syntax to define multiline input for file creation. ```shell cat > $LFS/etc/group << "EOF" root:x:0: bin:x:1: ...... EOF ``` -------------------------------- ### Create GRUB Configuration File Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter10/grub This snippet shows how to create the primary GRUB configuration file, `/boot/grub/grub.cfg`, using a here-document. This file contains the necessary directives for GRUB to locate and boot the LFS kernel and other system components. The exact content will depend on the user's specific LFS installation and desired boot options. ```bash cat > /boot/grub/grub.cfg << "EOF" ``` -------------------------------- ### GCC Configure Output Example Source: https://www.linuxfromscratch.org/lfs/view/stable/partintro/toolchaintechnotes This snippet shows example output from the GCC configure script, indicating which assembler and linker it has detected and will use. This is crucial for ensuring a correctly configured toolchain. ```text checking what assembler to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/as checking what linker to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/ld ``` -------------------------------- ### Install OpenSSL Package Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/openssl This command installs the OpenSSL package after successful compilation and testing. It first modifies the Makefile to remove specific library files from the installation list and then proceeds with the installation, setting the MANSUFFIX to 'ssl'. ```bash sed -i '/INSTALL_LIBS/s/libcrypto.a libssl.a//' Makefile make MANSUFFIX=ssl install ``` -------------------------------- ### Install Zstd 1.5.7 Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/zstd Installs the compiled Zstd package to the system with the specified installation prefix. This command copies the executables and libraries to their designated locations. ```bash `make prefix=/usr install` ``` -------------------------------- ### Install Ncurses Documentation Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/ncurses Copies the Ncurses documentation files to the system's documentation directory. This makes the Ncurses API and usage information accessible to users. ```bash cp -v -R doc -T /usr/share/doc/ncurses-6.5-20250809 ``` -------------------------------- ### Compile and Install Util-linux Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter07/util-linux Compiles the Util-linux package using the make command and then installs the compiled binaries and associated files into the system. ```shell make make install ``` -------------------------------- ### Build Zstd 1.5.7 Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/zstd Compiles the Zstd package with the specified installation prefix. This step prepares the software for installation without actually installing it on the system. ```bash `make prefix=/usr` ``` -------------------------------- ### Install Tcl Documentation (Shell) Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/tcl This optional snippet installs the HTML documentation for Tcl. It involves changing to the parent directory, extracting the HTML tarball, creating a documentation directory, and copying the extracted HTML files into it. ```shell cd .. tar -xf ../tcl8.6.16-html.tar.gz --strip-components=1 mkdir -v -p /usr/share/doc/tcl-8.6.16 cp -v -r ./html/* /usr/share/doc/tcl-8.6.16 ``` -------------------------------- ### Install and Link Vim Binaries and Man Pages Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/vim Installs the compiled Vim package and creates symbolic links to allow 'vi' commands to execute Vim. It links both the binary and man pages to maintain compatibility with users accustomed to 'vi'. ```bash make install ln -sv vim /usr/bin/vi for L in /usr/share/man/{,*/}man1/vim.1; do ln -sv vim.1 $(dirname $L)/vi.1 done ``` -------------------------------- ### Install Bzip2 Programs Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/bzip2 Installs the compiled Bzip2 programs into the system's binary directory, typically /usr/bin, making them available for general use. The PREFIX=/usr argument specifies the installation root. ```bash make PREFIX=/usr install ``` -------------------------------- ### Install Kbd Documentation (Shell) Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/kbd Copies the documentation files for the Kbd package to the system's documentation directory. This command ensures that the user-provided documentation is preserved. ```shell cp -R -v docs/doc -T /usr/share/doc/kbd-2.8.0 ``` -------------------------------- ### Install Gawk Package Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/gawk Installs the Gawk package and ensures system links are updated. It first removes a potentially existing hard link to prevent conflicts, then proceeds with the installation. This step places the compiled Gawk executable and related files into the system. ```bash rm -f /usr/bin/gawk-5.3.2 make install ``` -------------------------------- ### Verify PTY Support in Chroot Environment Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/expect This code snippet is used to verify that Pseudo-terminals (PTYs) are functioning correctly within the chroot environment. Proper PTY operation is crucial for Expect to work. If an 'OSError: out of pty devices' occurs, it indicates a problem with the virtual kernel file systems setup. ```shell python3 -c 'from pty import spawn; spawn(["echo", "ok"])' ``` -------------------------------- ### Install Glibc Shared Libraries with DESTDIR Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/glibc This command sequence performs a DESTDIR installation of Glibc and then installs the Glibc shared libraries to the system's /usr/lib directory. It's crucial for ensuring the correct placement of library files during an upgrade. ```bash make DESTDIR=$PWD/dest install install -vm755 dest/usr/lib/*.so.* /usr/lib ``` -------------------------------- ### Prepare and Run Vim Tests Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/vim Prepares the Vim test environment by changing ownership to a tester user and excluding a specific test file. Then, it runs the test suite as the tester user, redirecting output to a log file to avoid terminal issues. ```bash chown -R tester . sed '/test_plugin_glvs/d' -i src/testdir/Make_all.mak su tester -c "TERM=xterm-256color LANG=en_US.UTF-8 make -j1 test" &> vim-test.log ``` -------------------------------- ### Install All Supported Locales Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/glibc This command installs all locales listed in the 'glibc-2.42/localedata/SUPPORTED' file. This is a comprehensive but time-consuming process that ensures maximum locale support on the system. ```bash make localedata/install-locales ``` -------------------------------- ### Install MarkupSafe Python Package Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/markupsafe Installs the MarkupSafe Python package from a local wheel file. This command uses pip3 to install the package without relying on PyPI, using the specified local 'dist' directory for the package source. ```shell pip3 install --no-index --find-links dist Markupsafe ``` -------------------------------- ### Build and Test Expect Package Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/expect These commands compile the Expect package and then run its test suite. 'make' builds the software, and 'make test' executes the provided tests to ensure the build was successful and the package functions as expected. ```shell make ``` ```shell make test ``` -------------------------------- ### Install Wheel Python Package using pip3 Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/wheel This command installs the Wheel Python package from a local 'dist' directory. It uses pip3 to install the 'wheel' package, specifying that it should not use the Python Package Index (PyPI) and should find packages within the local 'dist' directory. ```bash pip3 install --no-index --find-links dist wheel ``` -------------------------------- ### Configure and Build DejaGNU Documentation Source: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/dejagnu Prepares DejaGNU for compilation using a configure script and generates HTML and plain text documentation from Texinfo source files. This step ensures documentation is available alongside the compiled package. ```shell ../configure --prefix=/usr makeinfo --html --no-split -o doc/dejagnu.html ../doc/dejagnu.texi makeinfo --plaintext -o doc/dejagnu.txt ../doc/dejagnu.texi ```