Installing basic system software

The installation of all the software is pretty straightforward and you'll think it's so much easier and shorter to give the generic installation instructions for each package and only explain how to install something if a certain package requires an alternate installation method. Although I agree with you on that, I, however, choose to give the full instructions for each and every package. This is simply to avoid any possible confusion and errors.

It's time to enter our chroot'ed environment now in order to install the rest of the software we need.

Entering the chroot'ed environment

Enter the following commands to setup the chroot'ed environment. From this point on there's no need to use the $LFS variable anymore, because everything you do will be restricted to the LFS partition (since / is actually /mnt/xxx but the shell doesn't know that).



root:~# cd $LFS
root:/mnt/hda5# chroot $LFS bash

Installing Linux Kernel

We won't be compiling a new kernel image yet. We'll do that after we have finished the installation of the basic system software in this chapter. But because certain software need the kernel header files, we're going to unpack the kernel archive now and setup the proper symlinks in /usr/include. Create the /usr/include/linux and /usr/include/asm symlinks by running the following commands:



root:~# cd /usr/include
root:/usr/include# ln -s ../src/linux/include/linux linux
root:/usr/include# ln -s ../src/linux/include/asm-i386 asm

Installing Ed

Install Ed by running the following commands:



root:/usr/src/ed-0.2# ./configure --prefix=/usr
root:/usr/src/ed-0.2# make
root:/usr/src/ed-0.2# make install

Installing Patch

Install Patch by running the following commands:



root:/usr/src/patch-2.5.4# ./configure --prefix=/usr
root:/usr/src/patch-2.5.4# make
root:/usr/src/patch-2.5.4# make install

Installing GCC

Install GCC by running the following commands:



root:/usr/src# mkdir /usr/src/gcc-build
root:/usr/src# cd /usr/src/gcc-build
root:/usr/src/gcc-build# ../gcc-2.95.2/configure \
> --prefix=/usr --with-local-prefix=/usr \
> --with-gxx-include-dir=/usr/include/g++ \
> --enable-shared --enable-languages=c,c++
root:/usr/src/gcc-build# make bootstrap
root:/usr/src/gcc-build# make install

Installing Bison

Install Bison by running the following commands:



root:/usr/src/bison-1.28# ./configure --prefix=/usr \
> --datadir=/usr/share/bison
root:/usr/src/bison-1.28# make
root:/usr/src/bison-1.28# make install

Installing Mawk

Install Mawk by running the following commands:



root:/usr/src/mawk-1.3.3# ./configure
root:/usr/src/mawk-1.3.3# make
root:/usr/src/mawk-1.3.3# make -e BINDIR=/usr/bin \
> MANDIR=/usr/share/man/man1 install
root:/usr/src/mawk-1.3.3# cd /usr/bin
root:/usr/bin# ln -s mawk awk

Installing Findutils

Install Findutils by running the following commands:



root:/usr/src/findutils-4.1# ./configure --prefix=/usr
root:/usr/src/findutils-4.1# make
root:/usr/src/findutils-4.1# make install

This package is known to cause compilation problem. If you're having trouble compiling this package as well, you can download a patch from http://www.linuxfromscratch.org/download/findutils-4.1.patch.gz

Install this patch by running the following command:



root:/usr/src/# patch -Np1 \
> -i ../findutils-4.1.patch.gz

Now recompile the package using the same commands as above.

Installing Termcap

Install Termcap by running the following commands:



root:/usr/src/termcap-1.3# ./configure --prefix=/usr
root:/usr/src/termcap-1.3# make
root:/usr/src/termcap-1.3# make install

Installing Ncurses

Install Ncurses by running the following commands:



root:/usr/src/ncurses-5.0# ./configure --prefix=/usr --with-shared
root:/usr/src/ncurses-5.0# make
root:/usr/src/ncurses-5.0# make install

Installing Less

Install Less by running the following commands:



root:/usr/src/less-340# ./configure --prefix=/usr
root:/usr/src/less-340# make
root:/usr/src/less-340# make install
root:/usr/src/less-340# mv /usr/bin/less /bin

Installing Perl

Install Perl by running the following commands:



root:/usr/src/perl-5.6.0# ./Configure
root:/usr/src/perl-5.6.0# make
root:/usr/src/perl-5.6.0# make test
root:/usr/src/perl-5.6.0# make install

Note that you have to change the installation path to /usr yourself. The Perl installation defaults to the /usr/local/subdir

Also note that a few tests during the make test phase will fail because we don't have network support installed yet.

Installing M4

Install M4 by running the following commands:



root:/usr/src/m4-1.4# ./configure --prefix=/usr
root:/usr/src/m4-1.4# make
root:/usr/src/m4-1.4# make install

Installing Texinfo

Install Texinfo by running the following commands:



root:/usr/src/texinfo-4.0# ./configure --prefix=/usr
root:/usr/src/texinfo-4.0# make
root:/usr/src/texinfo-4.0# make install

Installing Autoconf

Install Autoconf by running the following commands:



root:/usr/src/autoconf-2.13# ./configure --prefix=/usr
root:/usr/src/autoconf-2.13# make
root:/usr/src/autoconf-2.13# make install

Installing Automake

Install Automake by running the following commands:



root:/usr/src/automake-1.4# ./configure --prefix=/usr
root:/usr/src/automake-1.4# make install

Installing Bash

Install Bash by running the following commands:



root:/usr/src/bash-2.04# ./configure --prefix=/usr
root:/usr/src/bash-2.04# make
root:/usr/src/bash-2.04# make install
root:/usr/src/bash-2.04# mv /usr/bin/bash /bin

Installing Flex

Install Flex by running the following commands:



root:/usr/src/flex-2.5.4a# ./configure --prefix=/usr
root:/usr/src/flex-2.5.4a# make
root:/usr/src/flex-2.5.4a# make install

Installing Binutils

Install Binutils by running the following commands:



root:/usr/src/binutils-2.9.5.0.37# ./configure --prefix=/usr
root:/usr/src/binutils-2.9.5.0.37# make
root:/usr/src/binutils-2.9.5.0.37# make install

Installing Bzip2

Install Bzip2 by running the following commands:



root:/usr/src/bzip2-0.9.5d# make
root:/usr/src/bzip2-0.9.5d# make PREFIX=/usr install
root:/usr/src/bzip2-0.9.5d# cd /usr/bin
root:/usr/bin# mv bunzip2 bzip2 /bin

Installing Diffuitls

Install Diffutils by running the following commands:



root:/usr/src/diffutils-2.7# ./configure --prefix=/usr
root:/usr/src/diffutils-2.7# make
root:/usr/src/diffutils-2.7# make install

Installing E2fsprogs

Install E2fsprogs by running the following commands:



root:/usr/src/e2fsprogs-1.18# ./configure --prefix=/usr
root:/usr/src/e2fsprogs-1.18# make
root:/usr/src/e2fsprogs-1.18# make install
root:/usr/src/e2fsprogs-1.18# cd /usr/sbin
root:/usr/sbin# mv *e2* *fs* mklost+found /sbin

Installing File

Install File by running the following commands:



root:/usr/src/file-3.26# ./configure --prefix=/usr
root:/usr/src/file-3.26# make
root:/usr/src/file-3.26# make install

Installing Fileutils

Install Fileutils by running the following commands:



root:/usr/src/fileutils-4.0# ./configure --prefix=/usr
root:/usr/src/fileutils-4.0# make
root:/usr/src/fileutils-4.0# make install
root:/usr/src/fileutils-4.0# cd /usr/bin
root:/usr/bin# mv chgrp chmod chown cp dd df ln /bin
root:/usr/bin# mv ls mkdir mknod mv rm rmdir sync /bin

Installing Grep

Install Grep by running the following commands:



root:/usr/src/grep-2.4.2# ./configure --prefix=/usr
root:/usr/src/grep-2.4.2# make
root:/usr/src/grep-2.4.2# make install

Installing Groff

Install Groff by running the following commands:



root:/usr/src/groff-1.15# ./configure --prefix=/usr
root:/usr/src/groff-1.15# make
root:/usr/src/groff-1.15# make install

Installing Gzip

Install Gzip by running the following commands:



root:/usr/src/gzip-1.2.4a# ./configure --prefix=/usr
root:/usr/src/gzip-1.2.4a# make
root:/usr/src/gzip-1.2.4a# make install
root:/usr/src/gzip-1.2.4a# cd /usr/bin
root:/usr/bin# mv gunzip gzip /bin

Installing Ld.so

Install Ld.so by running the following commands:



root:/usr/src/ld.so-1.9.10# cd util
root:/usr/src/ld.so-1.9.10/util# make ldd ldconfig
root:/usr/src/ld.so-1.9.10/util# cp ldd /bin
root:/usr/src/ld.so-1.9.10/util# cp ldconfig /sbin
root:/usr/src/ld.so-1.9.10/util# rm /usr/bin/ldd

Installing Libtool

Install Libtool by running the following commands:



root:/usr/src/libtool-1.3.4# ./configure --prefix=/usr
root:/usr/src/libtool-1.3.4# make
root:/usr/src/libtool-1.3.4# make install

Installing Linux86

Install Linux86 by running the following commands:



root:/usr/src/linux-86# cd as
root:/usr/src/linux-86/as# make
root:/usr/src/linux-86# make install
root:/usr/src/linux-86# cd ../ld
root:/usr/src/linux-86# make ld86
root:/usr/src/linux-86# make install

Installing Lilo

Install Lilo by running the following commands:



root:/usr/src/lilo-21.4.1# make
root:/usr/src/lilo-21.4.1# make install

Installing Make

Install Make by running the following commands:



root:/usr/src/make-3.78.1# ./configure --prefix=/usr
root:/usr/src/make-3.78.1# make
root:/usr/src/make-3.78.1# make install

Installing Shell Utils

Install Shellutils by running the following commands:



root:/usr/src/sh-utils-2.0# ./configure --prefix=/usr
root:/usr/src/sh-utils-2.0# make
root:/usr/src/sh-utils-2.0# make install
root:/usr/src/sh-utils-2.0# cd /usr/bin
root:/usr/bin# mv date echo false pwd stty /bin
root:/usr/bin# mv su true uname hostname /bin

Installing Shadow Password Suite

Install the Shadow Password Suite by running the following commands:



root:/usr/src/shadow-19990827# ./configure --prefix=/usr
root:/usr/src/shadow-19990827# make
root:/usr/src/shadow-19990827# make install
root:/usr/src/shadow-19990827# cd etc
root:/usr/src/shadow-19990827/etc# cp limits login.access \
> login.defs.linux shells suauth /etc
root:/usr/src/shadow-19990827# mv /etc/login.defs.linux \
> /etc/login.defs

Installing Man

Install Man by running the following commands:



root:/usr/src/man�1.5h1# ./configure -default
root:/usr/src/man�1.5h1# make
root:/usr/src/man�1.5h1# make install

Installing Modutils

Install Modutils by running the following commands:



root:/usr/src/modutils-2.3.9# ./configure
root:/usr/src/modutils-2.3.9# make
root:/usr/src/modutils-2.3.9# make install

Installing Procinfo

Install Procinfo by running the following commands:



root:/usr/src/procinfo-17# make
root:/usr/src/procinfo-17# make install

Installing Procps

Install Procps by running the following commands:



root:/usr/src/procps-2.0.6# gcc -O3 -Wall -Wno-unused -c watch.c
root:/usr/src/procps-2.0.6# make
root:/usr/src/procps-2.0.6# make -e XSCPT="" install
root:/usr/src/procinfo-17# mv /usr/bin/kill /bin

Installing Psmisc

Install Psmisc by running the following commands:



root:/usr/src/psmisc-19# make
root:/usr/src/psmisc-19# make install

Installing Sed

Install Sed by running the following commands:



root:/usr/src/sec-3.02# ./configure --prefix=/usr
root:/usr/src/sec-3.02# make
root:/usr/src/sec-3.02# make install
root:/usr/src/sec-3.02# mv /usr/bin/sed /bin

Installing Start-stop-daemon

Install Start-stop-daemon by running the following commands:



root:/usr/src/ssd-0.4.1# make
root:/usr/src/ssd-0.4.1# make install

Installing Sysklogd

Install Sysklogd by running the following commands:



root:/usr/src/sysklogd-1.3-31# make
root:/usr/src/sysklogd-1.3-31# make install

Installing Sysvinit

Install Sysvinit by running the following commands:



root:/usr/src/sysvinit-2.78# cd src
root:/usr/src/sysvinit-2.78# make
root:/usr/src/sysvinit-2.78# make install

Installing Tar

Install Tar by running the following commands:



root:/usr/src/tar-1.13# ./configure --prefix=/usr
root:/usr/src/tar-1.13# make
root:/usr/src/tar-1.13# make install
root:/usr/src/tar-1.13# mv /usr/bin/tar /bin

Installing Textutils

Install Textutuils by running the following commands:



root:/usr/src/textutils-2.0# ./configure --prefix=/usr
root:/usr/src/textutils-2.0# make
root:/usr/src/textutils-2.0# make install
root:/usr/src/textutils-2.0# mv /usr/bin/cat /bin

Installing Vim

You need to unpack both the vim-rt and vim-src packages to install Vim. Install Vim by running the following commands:



root:/usr/src/vim-5.6# ./configure --prefix=/usr
root:/usr/src/vim-5.6# make
root:/usr/src/vim-5.6# make install
root:/usr/src/vim-5.6# cd /usr/bin
root:/usr/bin# ln -s vim vi

Installing Util-Linux

Before we can install the package we have to edit the MCONFIG file, find and modify the following variables as follows:


HAVE_PASSWD=yes
HAVE_SLN=yes
HAVE_TSORT=yes

Install Util-Linux by running the following commands:



root:/usr/src/util-linux-2.10h# groupadd -g 5 tty
root:/usr/src/util-linux-2.10h# ./configure
root:/usr/src/util-linux-2.10h# make
root:/usr/src/util-linux-2.10h# make install