LDP/LDP/howto/linuxdoc/Linux-From-Scratch-HOWTO.sgml

3845 lines
104 KiB
Plaintext

<!doctype linuxdoc system>
<!-- LinuxDoc file was created by LyX 1.0 (C) 1995-1999 by <chaser> Tue Apr 4 10:18:08 2000
-->
<article>
<title>
Linux From Scratch
</title>
<author>
Gerard Beekmans
</author>
<date>
Version 2.2, April 3rd, 2000
</date>
<abstract>
This document describes the process of creating your own Linux system from
scratch from an already installed Linux distribution, using nothing but the
source code of software that we need
</abstract>
<toc>
<sect>
Introduction
<sect1>
What's this all about?
<p>
Having used a number of different Linux distributions, I was never fully
satisfied with either of those. I didn't like the way the bootscripts were
arranged, or I didn't like the way certain programs were configured by default
and more of those things. I came to realize that when I want to be totally
satisfied with a Linux system, I have to build my own Linux system from scratch.
Ideally only using the source code. No pre-compiled packages of any kind. No
help from some sort of cdrom or bootdisk that would install some basic utilities.
You would use your current Linux system and use that one to build your own.
</p>
<p>
This, at one time, wild idea seemed very difficult and at times almost
impossible. The reason for most problems were due to my lack of knowledge about
certain programs and procedures. After sorted out all kinds of dependency problems,
compilation problems, etcetera, a manually Linux system was created and fully
operational. I called this system and LFS system which stands for LinuxFromScratch.
</p>
<sect1>
New versions
<p>
The latest version of the document can always be found at <htmlurl url="http://www.linuxfromscratch.org" name="http://www.linuxfromscratch.org">
</p>
<sect1>
Version history
<p>
2.1.5 - March 26th, 2000
</p>
<p>
This is not a full list of modified things. Because v2.0 is a major release,
only the major changes are mentioned and not the minor ones.
</p>
<p>
<itemize>
<item>
Directory structure modified - LFS is FHS compliant now. Perhaps not 100&percnt;,
but getting there.
<item>
New Glibc installation method
<item>
New GCC installation method
<item>
Eliminated the need for the pre-compiled Debian packages.
<item>
Totally revised software installation method - eliminated the need of all
the statically linked packages in former chapter 6.1.
<item>
Various bugs fixed in software installation
<item>
Installed a few more programs from the util-linux package
<item>
Added the installation of the Bzip2 program
<item>
Explained in greater detail what the &dollar;LFS is all about - how to
and how not to use it.
<item>
Simplified installation procedures for all packages in chapters 5 through
9.1
<item>
Moved the installation of Glibc and GCC to chapter 7 in stead of having
their own chapters which isn't necessary.
<item>
Modified Internet servers chapter: separated into Network Daemons and Network
Clients chapter. Internet chapter has merged with these two new chapters.
<item>
Switched chapters 13 and 14 (X and Internet) and merged the chapters about
X and Window Maker into chapter 14.
<item>
We're using a new Man program. This one is easier to use and configure
than the man-db one we previously used. Both versions perform nearly the same
jobs.
<item>
Added new chapter 13: Resources. This chapter contains a number of books
and HOWTOs you'll find useful to read during or after building an LFS system.
<item>
Chapter 3: Fixed bzip2 link
<item>
Chapter 7.2.42: Simplified Util-Linux installation method
<item>
Chapter 3.1: Changed procps location
<item>
Chapter 7.2: Switched installation of Vim and Util-Linux (as we need an
editor to install Util-Linux)
<item>
Chapter 7.3.33: Fixed procps installation.
<item>
Chapter 5.2: stripped inittab file so it won't complain about missing files
at boot time.
<item>
Chapter 6: Rewrote kernel installation
<item>
Chapter 10.3: Fixed Apache bootscript
<item>
Chapter 10.3.2: Removed section about modifying the httpd.conf file. No
longer necessary. Added the addition of /usr/apache/man to the /usr/share/misc/man.conf
file
<item>
Chapter 11.1: Provided a fixed mailx package with a working Makefile file
to simplify the installation procedure
<item>
Chapter 11.3.1: Added the --shared switch to configure so that Zlib is
installed as a dynamic library rather than a static one.
<item>
Chapter 11.6: Have Lynx link against the Ncurses library in stead of the
Slang.
<item>
Chapter 12: The newer man-db already has the X11/man directory in it's
man_db.config file
</itemize>
</p> <p>
2.2 - April 3rd, 2000
</p>
<p>
<itemize>
<item>
The linuxfromscratch.org and linuxfromscratch.com domains are now operational.
All former links to huizen.dds.nl/&tilde;glb and tts.ookhoi.dds.nl have been
replaced by the appropriate links on www.linuxfromscratch.org
<item>
After the reboot in chapter 7.3, the swap partition is made active before
we start compiling software.
</itemize>
</p> <sect1>
Mailinglists
<p>
There are two mailing lists you can subscribe to. The lfs-discuss and the
lfs-announce list. The former is an open non-moderated list discussing anything
that has got anything to do with this document. The latter is an open moderated
list. Anybody can subscribe to it, but you cannot post messages to it (only
the moderator(s) can do this). This list is primarily used for announcements
of new versions of this document.
</p>
<p>
If you're subscribed to the lfs-discuss list you don't need to be subscribed
to the lfs-announce list as well. Everything that is sent over the lfs-announce
list is also sent over the lfs-discuss list.
</p>
<sect2>
Subscribing
<p>
To subscribe to a list, send an email to <htmlurl url="mailto:majordomo@fist.org" name="majordomo@fist.org"> and type in the body either <em>subscribe
lfs-discuss</em> or <em>subscribe lfs-announce</em>
</p>
<p>
Majordomo will send you a confirmation-request email. This email will contain
an authentication code. Once you send this email back to Majordomo (instructions
are provided in that email) you will be subscribed.
</p>
<sect2>
Unsubscribing
<p>
To unsubscribe from a list, send an email to <htmlurl url="mailto:majordomo@fist.org" name="majordomo@fist.org"> and type in the the body
either <em>unsubscribe lfs-discuss</em> or <em>unsubscribe lfs-announce</em>
</p>
<sect1>
Contact info
<p>
Direct all your questions preferably to the mailing list. If you need to
reach me personally, send an email to <htmlurl url="mailto:gerard@linuxfromscratch.org" name="gerard@linuxfromscratch.org">
</p>
<sect>
Conventions used in this document
<sect1>
About &dollar;LFS
<p>
Please read the following carefully: throughout this document you will
frequently see the variable name &dollar;LFS. &dollar;LFS must at all times
be replaced by the directory where the partition that contains the LFS system
is mounted. How to create and where to mount the partition will be explained
later on in full detail in chapter 4. In my case the LFS partition is mounted
on /mnt/hda5. If I read this document myself and I see &dollar;LFS somewhere,
I will pretend that I read /mnt/hda5. If I read that I have to run this command:
<tt>cp inittab &dollar;LFS/etc </tt>I actually will run this: <tt>cp inittab /mnt/hda5/etc
</tt>
</p>
<p>
It's important that you do this no matter where you read it; be it in commands
you enter on the prompt, or in some file you edit or create.
</p>
<p>
If you want, you can set the environment variable LFS. This way you can
literally enter &dollar;LFS in stead of replacing it by something like /mnt/hda5.
This is accomplished by running: export LFS=/mnt/hda5
</p>
<p>
If I read cp inittab &dollar;LFS/etc, I literally can type cp inittab &dollar;LFS/etc
and the shell will replace this command by cp inittab /mnt/hda5/etc automatically.
</p>
<p>
Do not forget to set the LFS variable at all times. If you haven't set
the variable and you use it in a command, &dollar;LFS will be ignored and whatever
is left will be executed. The command cp inittab &dollar;LFS/etc without the
LFS variable set, will result in copying the inittab file to the /etc directory
which will overwrite your system's inittab. A file like inittab isn't that
big a problem as it can easily be restored, but if you would make this mistake
during the installation of the C Library, you can break your system badly and
might have to reinstall it if you don't know how to repair it. So that's why
I strongly advise against using the LFS variable. You better replace &dollar;LFS
yourself by something like /mnt/hda5. If you make a typo while entering /mnt/hda5,
the worst thing that can happen is that you'll get an error saying "no such
file or directory" but it won't break your system. Don't say I didn't warn you
;)
</p>
<sect1>
How to download the software
<p>
Throughout this document I will assume that you have stored all the packages
you have downloaded in a subdirectory under &dollar;LFS/usr/src.
</p>
<p>
I myself have use the convention of having a &dollar;LFS/usr/src/sources
directory. Under sources you'll find the directory 0-9 and the directories
a through z. A package as sysvinit-2.78.tar.gz is stored under &dollar;LFS/usr/src/sources/s/
A package as bash-3.02.tar.gz is stored under &dollar;LFS/usr/src/sources/b/
and so forth. You don't have to follow this convention of course, I was just
giving an example. It's better to keep the packages out of &dollar;LFS/usr/src
and move them to a subdirectory, so we'll have a clean &dollar;LFS/usr/src
directory in which we will unpack the packages and work with them.
</p>
<p>
The next chapter contains the list of all the packages you need to download,
but the partition that is going to contain our LFS system isn't created yet.
Therefore store the files temporarily somewhere where you want and remember
to copy them to &dollar;LFS/usr/src/&lt;somesubdirectory&gt; when you have
finished chapter 4.
</p>
<sect1>
How to install the software
<p>
Before you can actually start doing something with a package, you need
to unpack it first. Often you will find the package files being tar'ed and
gzip'ed (you can see this from a .tar.gz or .tgz extension). I'm not going
to write down every time how to ungzip and how to untar an archive. I will
tell you how to that once, in this paragraph. There is also the possibility
that you have the possibility of downloading a .tar.bz2 file. Such a file is
tar'ed and compressed with the bzip2 program. Bzip2 achieves a better compression
than the commonly used gzip does. In order to use bz2 archives you need to
have the bzip2 program installed. Most if not every distribution comes with
this program so chances are high it is already installed on your system. If
not, install it using your distribution's installation tool.
</p>
<p>
<itemize>
<item>
Start by <em>copying</em> the package from wherever you have stored it to the <em>&dollar;LFS/usr/src</em>
directory
<item>
When you have a file that is tar'ed and gzip'ed, you unpack it by running:
<tt>tar xvfz filename.tar.gz; rm filename.tar.gz</tt> or <tt>tar xvfz filename.tgz; rm filename.tgz
</tt>
<item>
When you have a file that is tar'ed and bzip'ed, you unpack it by running:
<tt>tar --use-compress-prog=bzip2 -xvf filename.tar.bz2; rm filename.tar.bz2
</tt>
<item>
When you have a file that is only tar'ed, you unpack it by running <tt>tar
xvf filename.tar; rm filename.tar</tt>
</itemize>
</p> <p>
Note that immediately after we have unpacked the archive, we delete the
package file as we don't need it anymore. That's why you have to <em>copy</em> the file
and not <em>move</em> it. If you move it and then delete it, you will need to re-download
it when you need it again.
</p>
<p>
When the archive is unpacked a new directory will be created under the
current directory (and this document assumes that you unpack the archives under
the &dollar;LFS/usr/src directory). You have to enter that new directory before
you continue with the installation instructions. All the above will be summarized
as 'Unpack the xxx archive'. So, when you read it, you copy the package to
&dollar;LFS/usr/src, you run the tar program to ungzip/unbzip and untar it,
then you enter the directory that was created and then you read the next line
of the installation instructions.
</p>
<p>
After you have installed a package you can do two things with it. You can
either delete the directory that contains the sources or you can keep it. If
you decide to keep it, that's fine by me. But if you need the same package
again in a later chapter (all software up to chapter 7.2 will be re-installed
in chapter 7.3) you need to delete the directory first before using it again.
If you don't do this, you might end up in trouble because old settings will
be used (settings that apply to your normal Linux system but which don't apply
anymore when you have restarted your computer into the LFS system). Doing a
<tt>simple make</tt> clean does not always guarantee a totally clean source tree. The
configure script also has files lying around in various subdirectories which
are rarely removed by the make clean process.
</p>
<sect>
Packages you need to download
<p>
Below is a list of all the software that you need to download for use in
this document. I display the sites and directories where you can download the
software, but it is up to you to make sure you download the source archive
and the latest version. The version numbers correspondent to versions of the
software that is known to work and which this document is going to be based
on. If you experience problems which you can't solve yourself, download the
version that is assumed in this document (in case you download a newer version).
</p>
<sect1>
Mandatory software
<p>
Sysvinit (2.78) : <htmlurl url="ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/" name="ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/">
</p>
<p>
Bash (2.03) : <htmlurl url="ftp://ftp.gnu.org/gnu/bash/" name="ftp://ftp.gnu.org/gnu/bash/">
</p>
<p>
Linux Kernel (2.2.14) : <htmlurl url="ftp://ftp.kernel.org/pub/linux/kernel/" name="ftp://ftp.kernel.org/pub/linux/kernel/">
</p>
<p>
Binutils (2.9.1) : <htmlurl url="ftp://ftp.gnu.org/gnu/binutils/" name="ftp://ftp.gnu.org/gnu/binutils/">
</p>
<p>
Bzip2 (0.9.5d) : <htmlurl url="http://sourceware.cygnus.com/bzip2/" name="http://sourceware.cygnus.com/bzip2/">
</p>
<p>
Diff Utils (2.7) : <htmlurl url="ftp://ftp.gnu.org/gnu/diffutils/" name="ftp://ftp.gnu.org/gnu/diffutils/">
</p>
<p>
File Utils (4.0) : <htmlurl url="ftp://ftp.gnu.org/gnu/fileutils/" name="ftp://ftp.gnu.org/gnu/fileutils/">
</p>
<p>
GCC (2.95.2) : <htmlurl url="ftp://ftp.gnu.org/gnu/gcc/" name="ftp://ftp.gnu.org/gnu/gcc/">
</p>
<p>
Glibc (2.1.3) : <htmlurl url="ftp://ftp.gnu.org/gnu/glibc/" name="ftp://ftp.gnu.org/gnu/glibc/">
</p>
<p>
Glibc-crypt (2.1.2) : <htmlurl url="ftp://ftp.gwdg.de/pub/linux/glibc/" name="ftp://ftp.gwdg.de/pub/linux/glibc/">
</p>
<p>
Glibc-linuxthreads (2.1.3) : <htmlurl url="ftp://ftp.gnu.org/gnu/glibc/" name="ftp://ftp.gnu.org/gnu/glibc/">
</p>
<p>
Grep (2.4) : <htmlurl url="ftp://ftp.gnu.org/gnu/grep/" name="ftp://ftp.gnu.org/gnu/grep/">
</p>
<p>
Gzip (1.2.4) : <htmlurl url="ftp://ftp.gnu.org/gnu/gzip/" name="ftp://ftp.gnu.org/gnu/gzip/">
</p>
<p>
Make (3.78.1) : <htmlurl url="ftp://ftp.gnu.org/gnu/make/" name="ftp://ftp.gnu.org/gnu/make/">
</p>
<p>
Sed (3.02) : <htmlurl url="ftp://ftp.gnu.org/gnu/sed/" name="ftp://ftp.gnu.org/gnu/sed/">
</p>
<p>
Shell Utils (2.0) : <htmlurl url="ftp://ftp.gnu.org/gnu/sh-utils/" name="ftp://ftp.gnu.org/gnu/sh-utils/">
</p>
<p>
Tar (1.13) : <htmlurl url="ftp://ftp.gnu.org/gnu/tar/" name="ftp://ftp.gnu.org/gnu/tar/">
</p>
<p>
Text Utils (2.0) : <htmlurl url="ftp://ftp.gnu.org/gnu/textutils/" name="ftp://ftp.gnu.org/gnu/textutils/">
</p>
<p>
Util Linux (2.10f) : <htmlurl url="ftp://ftp.win.tue.nl/pub/linux/utils/util-linux/" name="ftp://ftp.win.tue.nl/pub/linux/utils/util-linux/">
</p>
<p>
Bison (1.28) : <htmlurl url="ftp://ftp.gnu.org/gnu/bison/" name="ftp://ftp.gnu.org/gnu/bison/">
</p>
<p>
Mawk (1.3.3) : <htmlurl url="ftp://ftp.whidbey.net/pub/brennan/" name="ftp://ftp.whidbey.net/pub/brennan/">
</p>
<p>
Find Utils (4.1) : <htmlurl url="ftp://ftp.gnu.org/gnu/findutils/" name="ftp://ftp.gnu.org/gnu/findutils/">
</p>
<p>
Ncurses (5.0) : <htmlurl url="ftp://ftp.gnu.org/gnu/ncurses/" name="ftp://ftp.gnu.org/gnu/ncurses/">
</p>
<p>
Less (340) : <htmlurl url="ftp://ftp.gnu.org/gnu/less/" name="ftp://ftp.gnu.org/gnu/less/">
</p>
<p>
Perl (5.005_03) : <htmlurl url="ftp://ftp.gnu.org/gnu/perl/" name="ftp://ftp.gnu.org/gnu/perl/">
</p>
<p>
M4 (1.4) : <htmlurl url="ftp://ftp.gnu.org/gnu/m4/" name="ftp://ftp.gnu.org/gnu/m4/">
</p>
<p>
Texinfo (4.0) : <htmlurl url="ftp://ftp.gnu.org/gnu/texinfo/" name="ftp://ftp.gnu.org/gnu/texinfo/">
</p>
<p>
Autoconf (2.13) : <htmlurl url="ftp://ftp.gnu.org/gnu/autoconf/" name="ftp://ftp.gnu.org/gnu/autoconf/">
</p>
<p>
Automake (1.4) : <htmlurl url="ftp://ftp.gnu.org/gnu/automake/" name="ftp://ftp.gnu.org/gnu/automake/">
</p>
<p>
Flex (2.5.4a) : <htmlurl url="ftp://ftp.gnu.org/gnu/flex/" name="ftp://ftp.gnu.org/gnu/flex/">
</p>
<p>
E2fsprogs (1.18) : <htmlurl url="ftp://tsx-11.mit.edu/pub/linux/packages/ext2fs/" name="ftp://tsx-11.mit.edu/pub/linux/packages/ext2fs/">
</p>
<p>
File (3.26) : <htmlurl url="http://www.linuxfromscratch.org/download/file-3.26-lfs.tar.gz" name="http://www.linuxfromscratch.org/download/file-3.26-lfs.tar.gz">
</p>
<p>
Groff (1.15) : <htmlurl url="ftp://ftp.gnu.org/gnu/groff/" name="ftp://ftp.gnu.org/gnu/groff/">
</p>
<p>
Ld.so (1.9.9) : <htmlurl url="ftp://tsx-11.mit.edu/pub/linux/packages/GCC/" name="ftp://tsx-11.mit.edu/pub/linux/packages/GCC/">
</p>
<p>
Libtool (1.3.4) : <htmlurl url="ftp://ftp.gnu.org/gnu/libtool/" name="ftp://ftp.gnu.org/gnu/libtool/">
</p>
<p>
Linux86 (0.14.3) : <htmlurl url="http://www.linuxfromscratch.org/download/linux86-0.14.3-lfs.tar.gz" name="http://www.linuxfromscratch.org/download/linux86-0.14.3-lfs.tar.gz">
</p>
<p>
Lilo (21) : <htmlurl url="ftp://sunsite.unc.edu/pub/Linux/system/boot/lilo/" name="ftp://sunsite.unc.edu/pub/Linux/system/boot/lilo/">
</p>
<p>
Shadow Password Suite (19990827) : <htmlurl url="ftp://piast.t19.ds.pwr.wroc.pl/pub/linux/shadow/" name="ftp://piast.t19.ds.pwr.wroc.pl/pub/linux/shadow/">
</p>
<p>
Man (1.5h1) : <htmlurl url="ftp://ftp.win.tue.nl/pub/linux-local/utils/man/" name="ftp://ftp.win.tue.nl/pub/linux-local/utils/man/">
</p>
<p>
Modutils (2.3.9) : <htmlurl url="ftp://ftp.ocs.com.au/pub/modutils/" name="ftp://ftp.ocs.com.au/pub/modutils/">
</p>
<p>
Termcap (1.3) : <htmlurl url="ftp://ftp.gnu.org/gnu/termcap/" name="ftp://ftp.gnu.org/gnu/termcap/">
</p>
<p>
Procinfo (17) : <htmlurl url="ftp://ftp.cistron.nl/pub/people/svm/" name="ftp://ftp.cistron.nl/pub/people/svm/">
</p>
<p>
Procps (2.0.6) : <htmlurl url="ftp://people.redhat.com/johnsonm/procps/" name="ftp://people.redhat.com/johnsonm/procps/">
</p>
<p>
Psmisc (19) : <htmlurl url="ftp://lrcftp.epfl.ch/pub/linux/local/psmisc/" name="ftp://lrcftp.epfl.ch/pub/linux/local/psmisc/">
</p>
<p>
Start-stop-daemon (0.4.1) : <htmlurl url="http://www.linuxfromscratch.org/download/ssd-0.4.1-lfs.tar.gz" name="http://www.linuxfromscratch.org/download/ssd-0.4.1-lfs.tar.gz">
</p>
<p>
Sysklogd (1.3.31) : <htmlurl url="ftp://sunsite.unc.edu/pub/Linux/system/daemons/" name="ftp://sunsite.unc.edu/pub/Linux/system/daemons/">
</p>
<p>
Vim (5.6) : <htmlurl url="ftp://ftp.vim.org/pub/editors/vim/unix/" name="ftp://ftp.vim.org/pub/editors/vim/unix/">
</p>
<sect1>
Optional software
<p>
All software below is used in sections 13 and above and are not strictly
necessary. You have to determine for yourself if you want to install certain
packages. If, for example, you don't intend to go online with the LFS system,
you might not want to install the email, telnet, ftp, www, etc. utilities.
</p>
<p>
Netkit-base (0.17) : <htmlurl url="ftp://ftp.uk.linux.org/pub/linux/Networking/netkit-devel/" name="ftp://ftp.uk.linux.org/pub/linux/Networking/netkit-devel/">
</p>
<p>
Net-tools (1.54) : <htmlurl url="http://www.tazenda.demon.co.uk/phil/net-tools/" name="http://www.tazenda.demon.co.uk/phil/net-tools/">
</p>
<p>
Procmail (3.14) : <htmlurl url="ftp://ftp.procmail.org/pub/procmail/" name="ftp://ftp.procmail.org/pub/procmail/">
</p>
<p>
Sendmail (8.9.3) : <htmlurl url="ftp://ftp.sendmail.org/pub/sendmail/" name="ftp://ftp.sendmail.org/pub/sendmail/">
</p>
<p>
Mailx (8.1.1) : <htmlurl url="http://www.linuxfromscratch.org/download/mailx-8.1.1-fixed.tar.gz" name="http://www.linuxfromscratch.org/download/mailx-8.1.1-fixed.tar.gz">
</p>
<p>
Mutt (1.0i) : <htmlurl url="ftp://ftp.mutt.org/pub/mutt/" name="ftp://ftp.mutt.org/pub/mutt/">
</p>
<p>
Fetchmail (5.2.0) : <htmlurl url="http://www.tuxedo.org/~esr/fetchmail/" name="http://www.tuxedo.org/~esr/fetchmail/">
</p>
<p>
Netkit-telnet (0.17) : <htmlurl url="ftp://ftp.uk.linux.org/pub/linux/Networking/netkit-devel/" name="ftp://ftp.uk.linux.org/pub/linux/Networking/netkit-devel/">
</p>
<p>
Proftpd (1.2.0pre9) : <htmlurl url="ftp://ftp.tos.net/pub/proftpd/" name="ftp://ftp.tos.net/pub/proftpd/">
</p>
<p>
Netkit-ftp (0.17) : <htmlurl url="ftp://ftp.uk.linux.org/pub/linux/Networking/netkit-devel/" name="ftp://ftp.uk.linux.org/pub/linux/Networking/netkit-devel/">
</p>
<p>
Apache (1.3.11) : <htmlurl url="http://www.apache.org/dist/" name="http://www.apache.org/dist/">
</p>
<p>
Zlib Library (1.1.3) : <htmlurl url="http://www.cdrom.com/pub/infozip/zlib/" name="http://www.cdrom.com/pub/infozip/zlib/">
</p>
<p>
Lynx (2.8.2) : <htmlurl url="http://www.slcc.edu/lynx/release/" name="http://www.slcc.edu/lynx/release/">
</p>
<p>
PPP (2.3.11) : <htmlurl url="ftp://cs.anu.edu.au/pub/software/ppp/" name="ftp://cs.anu.edu.au/pub/software/ppp/">
</p>
<p>
Xfree86 (3.3.5) : <htmlurl url="ftp://ftp.xfree86.org/pub/XFree86/" name="ftp://ftp.xfree86.org/pub/XFree86/">
</p>
<p>
libPropList (0.9.1) : <htmlurl url="ftp://ftp.windowmaker.org/pub/libs/" name="ftp://ftp.windowmaker.org/pub/libs/">
</p>
<p>
libXpm (4.7) : <htmlurl url="ftp://sunsite.unc.edu/pub/Linux/libs/X/" name="ftp://sunsite.unc.edu/pub/Linux/libs/X/">
</p>
<p>
libpng (1.0.3) : <htmlurl url="http://www.cdrom.com/pub/png/" name="http://www.cdrom.com/pub/png/">
</p>
<p>
libtiff (3.4) : <htmlurl url="ftp://ftp.sgi.com/graphics/tiff/" name="ftp://ftp.sgi.com/graphics/tiff/">
</p>
<p>
libjpeg (6b) : <htmlurl url="http://www.ijg.org/" name="http://www.ijg.org/">
</p>
<p>
libungif (4.1.0) : <htmlurl url="ftp://prtr-13.ucsc.edu/pub/libungif/" name="ftp://prtr-13.ucsc.edu/pub/libungif/">
</p>
<p>
WindowMaker (0.61.1) : <htmlurl url="ftp://ftp.windowmaker.org/pub/release/" name="ftp://ftp.windowmaker.org/pub/release/">
</p>
<sect>
Preparing the new system
<sect1>
How we are going to do things
<p>
We are going to build the LFS system using an already installed Linux distribution
such as Debian, SuSe, Slackware, Mandrake, RedHat, etc. You don't need to have
any kind of bootdisk. We will use an existing Linux system as the base (since
we need a compiler, linker, text editor and other tools).
</p>
<p>
If you don't have Linux installed yet, you won't be able to put this document
to use right away. I suggest you first install a Linux distribution. It really
doesn't matter which one you install. It also doesn't need to be the latest
version, though it shouldn't be a too old one. If it is about a year old or
newer it'll do just fine. You will safe yourself a lot of trouble if your normal
system uses glibc-2.0 or newer. Libc5 can cause some problems and is not supported
in this document as I don't have access to such a machine anymore.
</p>
<sect1>
Creating a new partition
<p>
Before we can build our new Linux system, we need to have an empty Linux
partition on which we can build our new system. I recommend a partition size
of at least 5 00 MB. You can get away with around 250MB for a bare system with
no extra whistles and bells (such as software for emailing, networking, Internet,
X Window System and such). If you already have a Linux Native partition available,
you can skip this subsection.
</p>
<p>
Start the <tt>fdisk</tt> program (or some other fdisk program if you prefer) with
the appropriate hard disk as the option (like /dev/hda if you want to create
a new partition on the primary master IDE disk). Create a Linux Native partition,
write the partition table and exit the fdisk program. If you get the message
that you need to reboot your system to ensure that that partition table is
updated, then please reboot your system now before continuing. Remember what
your new partition's designation is. It could be something like hda5 (as it
is in my case). This newly created partition will be referred to as the <em>LFS
partition</em> in this document.
</p>
<sect1>
Creating an ext2 file system on the new partition
<p>
Once the partition is created, we have to create a new ext2 file system
on that partition. To create a new ext2 file system we use the <tt>mke2fs</tt> command.
Enter the new partition as the only option and the file system will be created.
If your partition was hda5, you would run the command as <tt>mke2fs /dev/hda5
</tt>
</p>
<sect1>
Mounting the new partition
<p>
Once we have created the ext2 file system, it is ready for use. All we
have to do to be able to access it (as in reading from and writing date to
it) is mounting it. If you mount it under /mnt/hda5, you can access this partition
by going to the /mnt/hda5 directory and then do whatever you need to do. This
document will assume that you have mounted the partition on a subdirectory
under /mnt. It doesn't matter which subdirectory you choose (or you can use
just the /mnt directory as the mounting point), but a good practice is to create
a directory with the same name as the partition's designation. In my case the
LFS partition is called hda5 and therefore I mount it on /mnt/hda5
</p>
<p>
<itemize>
<item>
Create the /mnt directory if it doesn't exist yet
<item>
Create the /mnt/xxx directory where xxx is to be replaced by your LFS partition's
designation.
<item>
Mount the LFS partition by running: mount /dev/xxx /mnt/xxx and replace
xxx by your LFS partition's designation.
</itemize>
</p> <p>
This directory (/mnt/xxx) is the &dollar;LFS you have read about earlier.
So if you read somewhere to "cp inittab &dollar;LFS/etc" you actually will type
"cp inittab /mnt/xxx/etc" where xxx is replaced by your partition's designation.
</p>
<sect1>
Creating directories
<p>
Let's create the directory tree on the LFS partition according to the FHS
standard which can be found at <htmlurl url="http://www.pathname.com/fhs/" name="http://www.pathname.com/fhs/">. Issuing the following commands will create
the necessary directories.
</p>
<p>
<verb>
cd &dollar;LFS
mkdir bin boot dev etc home lib mnt proc root sbin tmp usr var
cd &dollar;LFS/usr
mkdir bin include lib sbin share src
ln -s share/man man
ln -s share/doc doc
ln -s . local
ln -s ../etc etc
ln -s ../var var
cd &dollar;LFS/usr/share
mkdir dict doc info locale man nls misc terminfo zoneinfo
cd &dollar;LFS/usr/share/man
mkdir man1 man2 man3 man4 man5 man6 man7 man8
cd &dollar;LFS/var
mkdir lock log run spool tmp
</verb>
</p> <p>
Now that the directories are created, copy the source files you have downloaded
in chapter 3 to some subdirectory under &dollar;LFS/usr/src (you will need
to create this subdirectory yourself).
</p>
<sect1>
Copying the /dev directory
<p>
We can create every single file that we need to be in the &dollar;LFS/dev
directory using the mknod command, but that just takes up a lot of time. I
choose to just simply copy the current /dev directory to the &dollar;LFS partition.
Use this command to copy the entire directory while preserving original rights,
symlinks and ownerships:
</p>
<p>
<verb>
cp -av /dev &dollar;LFS
chown root.root &dollar;LFS/dev/*
</verb>
</p> <sect>
Making the LFS system bootable
<sect1>
Installing Sysvinit
<p>
Under normal circumstances, after the kernel is done loading and initializing
various system components, it attempts to load a program called <tt>init</tt> which
will finalize the system boot process. The package found on most if not every
single Linux system is called Sysvinit and that's the program we're going to
install on our LFS system.
</p>
<p>
<itemize>
<item>
Unpack the Sysvinit archive
<item>
Enter the src directory
<item>
Edit the <tt>Makefile</tt> file
<item>
Somewhere in this file, but before the rule <em>all:</em> put this line: <em>ROOT =
&dollar;LFS</em>
<item>
Precede every /dev on the last four lines in this file by <em>&dollar;(ROOT)
</em>
</itemize>
</p> <p>
After applying the &dollar;(ROOT) parts to the last four lines, they should
look like this:
</p>
<p>
<verb>
@if &lsqb;! -p &dollar;(ROOT)/dev/initctl &rsqb;; then &bsol;
echo "Creating &dollar;(ROOT)/dev/initctl"; &bsol;
rm -f &dollar;(ROOT)/dev/initctl; &bsol;
mknod -m 600 &dollar;(ROOT)/dev/initctl p; fi
</verb>
<p>
<itemize>
<item>
Install the package by running:
</itemize>
<p>
<verb>
make -e LDFLAGS=-static; make install
</verb>
</p> <sect1>
Configuring Sysvinit
<p>
In order for Sysvinit to work, we need to create it's configuration file.
Create the <tt>&dollar;LFS/etc/inittab</tt> file containing the following:
</p>
<p>
<verb>
&num; Begin /etc/inittab
id:2:initdefault:
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
1:2345:respawn:/sbin/sulogin
&num; End /etc/inittab
</verb>
</p> <sect1>
Creating passwd &amp; group files
<p>
As you can see from the inittab file, when we boot the system, init will
start the sulogin program and sulogin will ask you for user root's password.
This means we need to have at least a passwd file present on the LFS system.
</p>
<p>
<itemize>
<item>
Create the &dollar;LFS/etc/passwd file containing the following: <em>root:s394ul1Bkvmq2:0:0:root:/root:/bin/bash
</em>
<item>
Create the &dollar;LFS/etc/group file containing the following: <em>root::0:
</em>
</itemize>
</p> <p>
The encoded password string above is: <em>lfs123</em>
</p>
<p>
When you logon to your LFS system, enter <em>lfs123</em> when asked to enter user
root's password.
</p>
<sect1>
Installing the Bash shell
<p>
When sulogin asks you for the root password and you've entered the password,
a shell needs to be started. Usually this is the bash shell. Since there are
no libraries installed yet, we need to link bash statically, just like we did
with Sysvinit.
</p>
<p>
<itemize>
<item>
Unpack the Bash archive
<item>
Install Bash by running:
</itemize>
<p>
<verb>
./configure --enable-static-link
make; make -e prefix=&dollar;LFS/usr install
mv &dollar;LFS/usr/bin/bash &dollar;LFS/bin
cd &dollar;LFS/bin; ln -s bash sh
</verb>
</p> <sect1>
Adding an entry to LILO
<p>
In order to being able to boot from this partition, we need to update our
<tt>/etc/lilo.conf</tt> file. Add the following lines to lilo.conf:
</p>
<p>
<verb>
image=&lt;currently used image&gt;
label=&lt;label&gt;
root=&dollar;LFS
read-only
</verb>
</p> <p>
Replace &lt;currently used image&gt; by the kernel image file that you
are using to boot your normal Linux system. &lt;label&gt; can be anything you
want it to be. I named the label &quot;lfs&quot; What you enter as &lt;label&gt;
is what you enter at the LILO-prompt when you choose with system to boot.
</p>
<p>
Now run the <tt>lilo</tt> program to update the boot loader.
</p>
<sect1>
Testing the system
<p>
After you've completed this section, we can test the system by rebooting
into LFS and see if we can log on to it. When you reboot and are at the LILO
prompt, enter the label you have entered in the lilo.conf file to start the
LFS system. Then enter root's password and you should be on the bash-prompt
now. You won't be able to shutdown the system with a program like shutdown.
Although the program is present, it will give you the following error: &quot;You
don't exist. Go away.&quot; when you try to use the program. The meaning of
this error is that the system isn't able to locate the password file. Although
the shutdown program is statically linked against the libraries it needs, it
still depends on the NSS Library (Name Server Switch) which is part of the
GNU C Library, which will be installed in a later chapter. This NSS library
passes on information where (in this case) the passwd file can be found.
</p>
<p>
For now you can reboot the system using the <tt>reboot -f</tt> command. This will
bypass shutting down the system using the shutdown program and reboot immediately.
Since the file system is mounted read-only this will not harm our system in
any way (though you might get a warning next time you try to mount the system
that it wasn't unmounted cleanly the last time and that you should run e2fsck
to make sure the file system is still intact).
</p>
<sect>
Installing a kernel
<sect1>
Note on ftp.kernel.org
<p>
In section 2 above I mentioned you can download a new kernel from ftp://ftp.kernel.org/
However, this site is often too busy to get through and the maintainers of
this site encourage you to download the kernel from a location near you. You
can access a mirror site by going to ftp://ftp.&lt;country code&gt;.kernel.org/
(like ftp.ca.kernel.org).
</p>
<sect1>
Configuring the kernel
<p>
<itemize>
<item>
Rename the current /usr/src/linux directory to something else (/usr/src/linux
can be a symlink rather than an actual directory. Either way, rename it) by
running <tt>mv /usr/src/linux /usr/src/linux-old</tt>
<item>
Remove /usr/include/linux and /usr/include/asm by running <tt>rm -r /usr/include/linux
/usr/include/asm</tt>
<item>
Unpack the Kernel archive in the <tt>/usr/src/</tt> directory (this will create
a new /usr/src/linux directory)
<item>
Create the /usr/include/linux and /usr/include/asm symlinks by running:
</itemize>
<p>
<verb>
cd /usr/include
ln -s ../src/linux/include/linux linux
ln -s ../src/linux/include/asm-&lt;cpu&gt; asm
</verb>
</p> <p>
Look in the /usr/src/linux/include directory and see which asm-* directories
are present. Choose the correct one for your platform. If you're on an Intel
platform, you'd run ln -s ../src/linux/include/asm-i386 asm
</p>
<p>
<itemize>
<item>
Choose a method to configure the kernel (see the README file for more details
on configuration methods) and make sure you don't configure anything as modules
at this point. This is because we won't have the necessary software available
to load kernel modules for a while.
<item>
After you're done with your kernel configuration, run<tt> make dep</tt>
<item>
Compile the kernel by running <tt>make bzImage</tt>
<item>
Copy the <tt>arch/&lt;cpu&gt;/boot/bzImage</tt> file to the <tt>/boot</tt> directory (or
some place else if your Linux system uses a different convention where kernel
images and the like are stored)
<item>
Optionally you can rename the <tt>/boot/bzImage</tt> file to something like <tt>/boot/lfskernel
</tt>
<item>
Copy the entire kernel source tree to the LFS partition by running: <tt>cp
-av /usr/src/linux &dollar;LFS/usr/src</tt>
<item>
Create the &dollar;LFS/usr/include/linux and &dollar;LFS/usr/include/asm
symlinks by running:
</itemize>
<p>
<verb>
cd &dollar;LFS/usr/include
ln -s ../src/linux/include/linux linux
ln -s ../src/linux/include/asm asm
</verb>
</p> <sect1>
Updating LILO
<p>
<itemize>
<item>
Edit the <tt>/etc/lilo.conf</tt> file and go to the LFS section
<item>
Change the image name to <tt>lfskernel </tt>(or whatever you've named the originally
called bzImage file)
<item>
Run <tt>lilo </tt>to update the boot loader.
</itemize>
</p> <sect1>
Testing the system
<p>
Reboot your system and start your LFS system. Verify that the newly installed
kernel doesn't perform out-of-the-ordinary actions (such as crashing).
</p>
<sect>
Installing basic system software
<p>
In this chapter we will install all the software that belongs to a basic
Linux system. After you're done with this chapter you have a fully working
Linux system. The remaining chapters deals with optional issues such as setting
up networking, Internet servers + clients (telnet, ftp, http, email), setting
up Internet itself and the X Window System. You can skip chapters at your own
discretion. If you don't plan on going online with the LFS system there's little
use to setup Internet for example.
</p>
<p>
There are a number of packages that need to be already installed before
we can start installing all the basic system software. A typical configure
scripts needs programs like rm, grep, sed, mv, cat, cp, diff. You need to be
able to ungzip and untar archives, you need to link programs after you have
compiled the objects files. All these (and a few more) programs needs to be
available before we can install anything else. These programs are going to
be linked statically. The reasoning behind this is that your normal Linux system
may have a different C Library version than the LFS system is going to have.
The programs you install in this section will be linked against the C Library
of your normal Linux system. This may cause library conflicts if you run those
programs on the LFS system. Therefore we have to link those programs statically.
During the installation of the basic system software set, we will re-install
the statically linked software so that they are linked dynamically against
the C library on the LFS system.
</p>
<sect1>
About debugging symbols
<p>
Every program and library is default compiled with debugging symbols. This
means you can run a program or library through a debugger and the debugger's
output will be more user friendly. These debugging symbols also enlarge the
program or binary significantly. This document will not install software without
debugging symbols (as I don't know if the majority of readers do or don't debug
software). In stead, you can remove those symbols manually if you want with
the <tt>strip</tt> program.
</p>
<p>
To remove debugging symbols from a binary (must be an a.out or ELF binary)
run <tt>strip --strip-debug filename</tt> You can use wild cards if you need to strip
debugging symbols from multiple files (use something like <tt>strip --strip-debug
&dollar;LFS/usr/bin/*</tt>).
</p>
<p>
Before you wonder if these debugging symbols would make a big difference,
here are some statistics:
</p>
<p>
<itemize>
<item>
A static Bash binary with debugging symbols: 2.3MB
<item>
A static Bash binary without debugging symbols: 645KB
<item>
A dynamic Bash binary with debugging symbols: 1.2MB
<item>
A dynamic Bash binary without debugging symbols: 478KB
<item>
&dollar;LFS/usr/lib (glibc and gcc files) with debugging symbols: 87MB
<item>
&dollar;LFS/usr/lib (glibc and gcc files) without debugging symbols: 16MB
</itemize>
</p> <p>
Sizes may vary depending on which compiler has been used and which C library
version is used to link dynamic programs against, but your results will be
very similar if you compare programs with and without debugging symbols. After
I was done with this chapter and stripped all debugging symbols from all LFS
binaries and libraries I regained a little over 102 MB of disk space. Quite
the difference. The difference would be even greater when I would do this at
the end of this document when everything is installed.
</p>
<sect1>
Preparing LFS system for installing basic system software
<sect2>
Installing Binutils
<p>
<itemize>
<item>
Unpack the binutils archive
<item>
Install the package by running:
</itemize>
<p>
<verb>
./configure
make -e LDFLAGS=-all-static
make -e prefix=&dollar;LFS/usr install
</verb>
</p> <sect2>
Installing Bzip2
<p>
<itemize>
<item>
Unpack the Bzip2 archive
<item>
Edit the Makefile file in a text editor
<item>
Find the lines that start with : &dollar;(CC) &dollar;(CFLAGS) -o
<item>
Replace those parts with: &dollar;(CC) &dollar;(CFLAGS) &dollar;(LDFLAGS)
-o
<item>
Install the package by running:
</itemize>
<p>
<verb>
make -e LDFLAGS=-static
make -e PREFIX=&dollar;LFS/usr install
cd &dollar;LFS/usr/bin
mv bunzip2 bzip2 &dollar;LFS/bin
</verb>
</p> <sect2>
Install Diffutils
<p>
<itemize>
<item>
Unpack the diffutils archive
<item>
Install the package by running:
</itemize>
<p>
<verb>
./configure
make -e LDFLAGS=-static
make -e prefix=&dollar;LFS/usr install
</verb>
</p> <p>
This package is known to cause static linking problems on certain platforms.
If you're having trouble compiling this package as well, you can download a
fixed package from <htmlurl url="http://www.linuxfromscratch.org/download/diffutils-2.7-fixed.tar.gz" name="http://www.linuxfromscratch.org/download/diffutils-2.7-fixed.tar.gz">
</p>
<sect2>
Installing Fileutils
<p>
<itemize>
<item>
Unpack the fileutils archive
<item>
Install the package by running:
</itemize>
<p>
<verb>
./configure --disable-nls
make -e LDFLAGS=-static
make -e prefix=&dollar;LFS/usr install
cd &dollar;LFS/usr/bin
mv chgrp chmod chown cp dd df ln ls mkdir mknod mv rm rmdir sync &dollar;LFS/bin
</verb>
</p> <sect2>
Installing GCC on the normal system if necessary
<p>
In order to compile Glibc-2.1.3 you need to have gcc-2.95.2 installed.
Any version from 2.8 and up would do, but 2.95.2 is recommended. Many glibc-2.0
based systems have gcc-2.7.2.3 installed and you can't compile glibc-2.1 with
that compiler. Therefore we will install gcc-2.95.2. also on the normal system,
but without overwriting the existing compiler. Before you install gcc on your
normal system, make sure whether you need it or not. Run <tt>gcc --version</tt> and
check if the version number it reports equals or is higher than 2.8. If not,
you need to install gcc-2.95.2. If you experience difficulties compiling glibc
later on, you might want to install gcc-2.95.2 anyways.
</p>
<p>
<itemize>
<item>
Unpack the GCC archive
<item>
Install the package by running:
</itemize>
<p>
<verb>
mkdir &dollar;LFS/usr/src/gcc-build; cd &dollar;LFS/usr/src/gcc-build
../gcc-2.95.2/configure --prefix=/usr/gcc2952 &bsol;
--with-local-prefix=/usr/gcc2952 --with-gxx-include-dir=/usr/gcc2952/include/g++ &bsol;
--enable-shared --enable-languages=c,c++
make bootstrap; make install
</verb>
</p> <sect2>
Installing GCC on the LFS system
<p>
<itemize>
<item>
Unpack the GCC archive
<item>
Install the package by running:
</itemize>
<p>
<verb>
mkdir &dollar;LFS/usr/src/gcc-build;cd &dollar;LFS/usr/src/gcc-build
../gcc-2.95.2/configure --enable-languages=c --disable-nls
make -e LDFLAGS=-static bootstrap
make -e prefix=&dollar;LFS/usr local_prefix=&dollar;LFS/usr install
</verb>
</p> <sect3>
Creating necessary symlinks
<p>
The system needs a few symlinks to ensure every program is able to find
the compiler and the pre-processor. Some programs run the cc program, others
run the gcc program, some programs expect the cpp program to be in /lib (which
is /usr/lib on the LFS system) and others expect to find it in /usr/bin.
</p>
<p>
<itemize>
<item>
Create those symlinks by running:
</itemize>
<p>
<verb>
cd &dollar;LFS/lib; ln -s ../usr/lib/gcc-lib/&lt;host&gt;/2.95.2/cpp cpp
cd &dollar;LFS/usr/lib; ln -s gcc-lib/&lt;host&gt;/2.95.2/cpp cpp
cd &dollar;LFS/usr/bin; ln -s gcc cc
</verb>
</p> <p>
Replace &lt;host&gt; with the directory where the gcc-2.95.2 files were
installed (i686-unknown-linux in my case). You will most likely find two different
directories.
</p>
<sect2>
Installing Glibc
<p>
A note on the glibc-crypt package:
</p>
<p>
<verb>
-*-*-*-*-*-
The add-on is not included in the main distribution of the GNU
C library because some governments, mostly notable those of
France, Russia and the US, have very restrictive rules
governing the distribution and use of encryption software.
Please read the node "Legal Problems" in the manual for more
details.
In particular, the US does not allow export of this software
without a license, including via the Internet. So please do not
download it from the main FSF FTP site at ftp.gnu.org if you
are outside of the US. This software was completely developed
outside the US.
-*-*-*-*-*-
</verb>
</p> <p>
"This software" refers to the glibc-crypt package at ftp://ftp.gwdg.de/pub/linux/glibc/.
This law only affects people who don't live in the US. It's not prohibited
to import DES software, so if you live in the US you can import it from that
German site.
</p>
<p>
<itemize>
<item>
Unpack the Glibc archive
<item>
Copy the glibc-crypt and glibc-linuxthreads archives into the unpacked
glibc directory
<item>
Unpack the glibc-crypt and glibc-linuxthreads there, but don't enter these
directories. Just ungzip and untar them.
<item>
Create a new file <tt>configparms</tt> containing:
</itemize>
<p>
<verb>
&num; Begin configparms
slibdir=/lib
sysconfdir=/etc
&num; End configparms
</verb>
<p>
<itemize>
<item>
If your normal system already had a gcc version suitable to compile glibc
with, install the package by running:
</itemize>
<p>
<verb>
mkdir &dollar;LFS/usr/src/glibc-build;cd &dollar;LFS/usr/src/glibc-build
../glibc-2.1.3/configure --enable-add-ons
make; make install_root=&dollar;LFS install
</verb>
<p>
<itemize>
<item>
If your normal didn't had a suitable gcc version and you installed gcc-2.95.2
on your normal system, install the package by running:
</itemize>
<p>
<verb>
mkdir &dollar;LFS/usr/src/glibc-build; cd &dollar;LFS/usr/src/glibc-build
CC=/usr/gcc2952/bin/gcc ../glibc-2.1.3/configure --enable-add-ons
make; make install_root=&dollar;LFS install
</verb>
</p> <sect3>
Copying old NSS Library files
<p>
If your normal Linux system runs libc-2.0.x, you need to copy the NSS library
files to the LFS partition. Certain statically linked programs still depend
on the NSS library, especially programs that need to lookup usernames, userid's
and groupid's. You can check which C Library version your normal Linux system
uses by running: <tt>ls -l libc.so.*</tt>
</p>
<p>
Your system uses glibc-2.0 if the output looks like: /lib/libc.so.6 -&gt;
libc-2.0.7.so
</p>
<p>
Your system uses glibc-2.1 is the output looks like: /lib/libc.so.6 -&gt;
libc-2.1.2.so
</p>
<p>
If your have a libc-2.0.x.so file (where x is the micro version number
such as 7) copy the NSS Library files by running: <tt>cp -av /lib/*nss* &dollar;LFS/lib
</tt>
</p>
<sect2>
Installing grep
<p>
<itemize>
<item>
Unpack the grep archive
<item>
Install the package by running:
</itemize>
<p>
<verb>
./configure --disable-nls
make -e LDFLAGS=-static
make -e prefix=&dollar;LFS/usr install
</verb>
</p> <p>
This package is known to cause static linking problems on certain platforms.
If you're having trouble compiling this package as well, you can download a
fixed package from <htmlurl url="http://www.linuxfromscratch.org/download/grep-2.4-fixed.tar.gz" name="http://www.linuxfromscratch.org/download/grep-2.4-fixed.tar.gz">
</p>
<sect2>
Installing gzip
<p>
<itemize>
<item>
Unpack the gzip archive
<item>
Install the package by running:
</itemize>
<p>
<verb>
./configure
make -e LDFLAGS=-static
make -e prefix=&dollar;LFS/usr install
cd &dollar;LFS/usr/bin
mv gunzip gzip &dollar;LFS/bin
</verb>
</p> <p>
This package is known to cause compilation problems on certain platforms.
If you're having trouble compiling this package as well, you can download a
fixed package from <htmlurl url="http://www.linuxfromscratch.org/download/gzip-1.2.4-fixed.tar.gz" name="http://www.linuxfromscratch.org/download/gzip-1.2.4-fixed.tar.gz">
</p>
<sect2>
Installing Make
<p>
<itemize>
<item>
Unpack the Make archive
<item>
Install the package by running:
</itemize>
<p>
<verb>
./configure
make -e LDFLAGS=-static
make -e prefix=&dollar;LFS/usr install
</verb>
</p> <sect2>
Installing Sed
<p>
<itemize>
<item>
Unpack the sed archive
<item>
Install the package by running:
</itemize>
<p>
<verb>
./configure
make -e LDFLAGS=-static
make -e prefix=&dollar;LFS/usr install
mv &dollar;LFS/usr/bin/sed &dollar;LFS/bin
</verb>
</p> <p>
This package is known to cause static linking problems on certain platforms.
If you're having trouble compiling this package as well, you can download a
fixed package from <htmlurl url="http://www.linuxfromscratch.org/download/sed-3.02-fixed.tar.gz" name="http://www.linuxfromscratch.org/download/sed-3.02-fixed.tar.gz">
</p>
<sect2>
Installing Sh-utils
<p>
<itemize>
<item>
Unpack the sh-utils archive
<item>
Install the package by running:
</itemize>
<p>
<verb>
./configure --disable-nls
make -e LDFLAGS=-static
make -e prefix=&dollar;LFS/usr install
cd &dollar;LFS/usr/bin
mv date echo false pwd stty su true uname hostname &dollar;LFS/bin
</verb>
</p> <sect2>
Installing Tar
<p>
<itemize>
<item>
Unpack the tar archive
<item>
Install the package by running:
</itemize>
<p>
<verb>
./configure --disable-nls
make -e LDFLAGS=-static
make -e prefix=&dollar;LFS/usr install
mv &dollar;LFS/usr/bin/tar &dollar;LFS/bin
</verb>
</p> <sect2>
Installing Textutils
<p>
<itemize>
<item>
Unpack the textutils archive
<item>
Install the package by running:
</itemize>
<p>
<verb>
./configure --disable-nls
make -e LDFLAGS=-static
make -e prefix=&dollar;LFS/usr install
mv &dollar;LFS/usr/bin/cat &dollar;LFS/bin
</verb>
</p> <sect2>
Installing Util-linux
<p>
<itemize>
<item>
Unpack the util-linux archive
<item>
Install the package by running:
</itemize>
<p>
<verb>
./configure
cd lib;make
cd ../mount;make -e LDFLAGS=-static
cp mount umount &dollar;LFS/bin
cp swapon &dollar;LFS/sbin
</verb>
</p> <sect1>
Installing basic systsem software
<p>
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 this
aspect, I, however, choose to give the full instructions for each and every
package. This is simply to avoid any possible confusion and errors. Before
you continue with this document you have to restart your system and boot into
the LFS system. But before you do that, you need to determine which partition
is used as your swap partition. This information can usually be found in the
/etc/fstab file. Check this file for a line similar to this one: <em>/dev/hda6
none swap sw 0 0</em>
</p>
<p>
The 4th field in a line must contain 'sw'. That line represents a swap
partition. All you need to remember is it's designation (which is /dev/hda6
in my case but this will probably be different on your system). When you have
determined which partition is the swap partition, you can reboot your computer
now and continue from here.
</p>
<sect2>
Remounting partition and activating swap
<p>
Before the software can be installed we need to remount the partition in
read-write mode. Also, we need to activate the swap partition so that we won't
risk running out of memory during large compilation processes (such as compiling
gcc):
</p>
<p>
<verb>
mount -o remount,rw / /
/sbin/swapon &lt;swap device&gt;
</verb>
</p> <sect2>
Installing GCC
<p>
<itemize>
<item>
Unpack the GCC archive and install it by running:
</itemize>
<p>
<verb>
mkdir &dollar;LFS/usr/src/gcc-build;cd &dollar;LFS/usr/src/gcc-build
../gcc-2.95.2/configure --with-gxx-include-dir=/usr/include/g++ &bsol;
--enable-shared --enable-languages=c,c++
make bootstrap; make install
</verb>
</p> <sect2>
Installing Bison
<p>
<itemize>
<item>
Unpack the bison archive and install it by running:
</itemize>
<p>
<verb>
./configure --datadir=/usr/share/bison
make; make install
</verb>
</p> <sect2>
Installing Mawk
<p>
<itemize>
<item>
Unpack the mawk archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
cd /usr/bin; ln -s mawk awk
</verb>
</p> <sect2>
Installing Findutils
<p>
<itemize>
<item>
Unpack the findutils archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <p>
This package is known to cause compilation problems. If you're having trouble
compiling this package as well, you can download a fixed package from <htmlurl url="http://www.linuxfromscratch.org/download/findutils-4.1-fixed.tar.gz" name="http://www.linuxfromscratch.org/download/findutils-4.1-fixed.tar.gz">
</p>
<sect2>
Installing Termcap
<p>
<itemize>
<item>
Unpack the Termcap archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing Ncurses
<p>
<itemize>
<item>
Unpack the ncurses archive and install it by running:
</itemize>
<p>
<verb>
./configure --with-shared
make; make install
</verb>
</p> <sect2>
Installing Less
<p>
<itemize>
<item>
Unpack the Less archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
mv /usr/bin/less /bin
</verb>
</p> <sect2>
Installing Perl
<p>
<itemize>
<item>
Unpack the Perl archive and install it by running:
</itemize>
<p>
<verb>
./Configure
make; make install
</verb>
</p> <p>
Note that we skip the 'make test' step. This is because at this moment
the system isn't ready yet for running the perl test. At this time we'll trust
that perl compiled fine.
</p>
<sect2>
Installing M4
<p>
<itemize>
<item>
Unpack the M4 archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing Texinfo
<p>
<itemize>
<item>
Unpack the Texinfo archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing Autoconf
<p>
<itemize>
<item>
Unpack the Autoconf archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing Automake
<p>
<itemize>
<item>
Unpack the Automake archive and install it by running:
</itemize>
<p>
<verb>
./configure
make install
</verb>
</p> <sect2>
Installing Bash
<p>
<itemize>
<item>
Unpack the Bash archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
mv /usr/bin/bash /bin
</verb>
</p> <sect2>
Installing Flex
<p>
<itemize>
<item>
Unpack the Flex archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing Binutils
<p>
<itemize>
<item>
Unpack the Binutils archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing Bzip2
<p>
<itemize>
<item>
Unpack the Bzip2 archive and install it by running:
</itemize>
<p>
<verb>
make; make install
cd /usr/bin; mv bunzip2 bzip2 /bin
</verb>
</p> <sect2>
Installing Diffutils
<p>
<itemize>
<item>
Unpack the Diffutils archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing E2fsprogs
<p>
<itemize>
<item>
Unpack the E2fsprogs archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
mv /usr/sbin/mklost+found /sbin
</verb>
</p> <sect2>
Installing File
<p>
<itemize>
<item>
Unpack the File archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing Fileutils
<p>
<itemize>
<item>
Unpack the Fileutils archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
cd /usr/bin
mv chgrp chmod chown cp dd df ln ls mkdir mknod mv rm rmdir sync /bin
</verb>
</p> <sect2>
Installing Grep
<p>
<itemize>
<item>
Unpack the Grep archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing Groff
<p>
<itemize>
<item>
Unpack the Groff archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing Gzip
<p>
<itemize>
<item>
Unpack the Gzip archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
cd /usr/bin; mv z* gunzip gzip /bin
</verb>
</p> <sect2>
Installing Ld.so
<p>
<itemize>
<item>
Unpack the Ld.so archive and install it by running:
</itemize>
<p>
<verb>
cd util; make ldd ldconfig
cp ldd /bin; cp ldconfig /sbin
rm /usr/bin/ldd
</verb>
</p> <sect2>
Installing Libtool
<p>
<itemize>
<item>
Unpack the Libtool archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing Linux86
<p>
<itemize>
<item>
Unpack the Linux86 archive and install it by running:
</itemize>
<p>
<verb>
cd as
make; make install
cd ../ld
make ld86; make install
</verb>
</p> <sect2>
Installing Lilo
<p>
<itemize>
<item>
Unpack the Lilo archive and install it by running:
</itemize>
<p>
<verb>
make; make install
</verb>
</p> <sect2>
Installing Make
<p>
<itemize>
<item>
Unpack the Make archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Instaling Sh-Utils
<p>
<itemize>
<item>
Unpack the Sh-utils archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
cd /usr/bin
mv date echo false pwd stty su true uname hostname /bin
</verb>
</p> <sect2>
Installing Shadow Password Suite
<p>
<itemize>
<item>
Unpack the Shadow archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
cd etc
cp limits login.access login.defs.linux shells suauth /etc
mv /etc/login.defs.linux /etc/login.defs
cd /usr/sbin
mv chpasswd dpasswd groupadd groupdel groupmod logoutd mkpasswd &bsol;
newusers useradd userdel usermod grpck pwck vipw grpconv grpunconv &bsol;
pwconv pwunconv /sbin
</verb>
</p> <sect2>
Installing Man
<p>
<itemize>
<item>
Unpack the Man archive and install it by running:
</itemize>
<p>
<verb>
./configure -default
make all; make install
</verb>
</p> <sect2>
Installing Modutils
<p>
<itemize>
<item>
Unpack the Modutils archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing Procinfo
<p>
<itemize>
<item>
Unpack the Procinfo archive and install it by running:
</itemize>
<p>
<verb>
make; make install
</verb>
</p> <sect2>
Installing Procps
<p>
<itemize>
<item>
Unpack the Procps archive and install it by running:
</itemize>
<p>
<verb>
gcc -O3 -Wall -Wno-unused -c watch.c
make; make -e XSCPT="" install
mv /usr/bin/kill /bin
</verb>
</p> <sect2>
Installing Psmisc
<p>
<itemize>
<item>
Unpack the Psmisc archive and install it by running:
</itemize>
<p>
<verb>
make; make install
</verb>
</p> <sect2>
Installing Sed
<p>
<itemize>
<item>
Unpack the Sed archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
mv /usr/bin/sed /bin
</verb>
</p> <sect2>
Installing start-stop-daemon
<p>
<itemize>
<item>
Unpack the start-stop-daemon archive and install it by running:
</itemize>
<p>
<verb>
make start-stop-daemon
cp start-stop-daemon /sbin
cp start-stop-daemon.8 /usr/share/man/man8
</verb>
</p> <sect2>
Installing Sysklogd
<p>
<itemize>
<item>
Unpack the Sysklogd archive and install it by running:
</itemize>
<p>
<verb>
make; make install
</verb>
</p> <sect2>
Installing Sysvinit
<p>
<itemize>
<item>
Unpack the Sysvinit archive and install it by running:
</itemize>
<p>
<verb>
cd src
make; make install
</verb>
</p> <sect2>
Install Tar
<p>
<itemize>
<item>
Unpack the Tar archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
mv /usr/bin/tar /bin
</verb>
</p> <sect2>
Installing Textutils
<p>
<itemize>
<item>
Unpack the Textutils archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
mv /usr/bin/cat /bin
</verb>
</p> <sect2>
Installing Vim
<p>
<itemize>
<item>
Unpack the Vim-rt and Vim-src archives and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing Util-linux
<p>
<itemize>
<item>
Unpack the Util-linux package
<item>
Edit the MCONFIG file, find and modify the following variables as follows:
</itemize>
<p>
<verb>
HAVE_PASSWD=yes
HAVE_SLN=yes
HAVE_TSORT=yes
</verb>
<p>
<itemize>
<item>
Install the package by running:
</itemize>
<p>
<verb>
groupadd -g 5 tty
./configure
make; make install
</verb>
</p> <sect1>
Removing old NSS Library files
<p>
If you have copied the NSS Library files from your normal Linux system
to the LFS system (because your normal system runs glibc-2.0) it's time to
remove them now by running:
</p>
<p>
<verb>
rm /lib/libnss*.so.1 /lib/libnss*2.0*
</verb>
</p> <sect1>
Configuring the software
<p>
Now that all software is installed, all that we need to do to get a few
programs running properly is to create their configuration files.
</p>
<sect2>
Configuring Glib
<p>
We need to create the /etc/nsswitch.conf file. Although glibc should provide
defaults when this file is missing or corrupt, it's defaults don't work work
well with networking which will be dealt with in a later chapter. Also, our
timezone needs to be setup.
</p>
<p>
<itemize>
<item>
Create a new file /etc/nsswitch.conf containing:
</itemize>
<p>
<verb>
&num; Begin /etc/nsswitch.conf
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: db files
&num; End /etc/nsswitch.conf
</verb>
<p>
<itemize>
<item>
Run the tzselect script and answer the questions regarding your timezone
<item>
When you're done, the program will give you the file location you need.
<item>
Create the localtime symlink by running: ln -s /usr/share/zoneinfo/&lt;tzselect's
output&gt; /etc/localtime
</itemize>
</p> <p>
tzselect's output can be something like "EST5EDT" or "Canada/Eastern". The
symlink you would create with that information would be ln -s /usr/share/zoneinfo/EST5EDT
/etc/localtime or ln -s /usr/share/zoneinfo/Canada/Eastern /etc/localtime
</p>
<sect2>
Configuring LILO
<p>
We're not going to create lilo's configuration file from scratch, but we'll
use the file from your normal Linux system. This file is different on every
machine and thus I can't create it here. Since you would want to have the same
options regarding lilo as you have when you're using your normal Linux system
you would create the file exactly as it is on the normal system.
</p>
<p>
<itemize>
<item>
Create the /mnt/original directory
<item>
Mount your normal Linux system on this mount point by running mount /dev/xxx
/mnt/original (replace /dev/xxx with your normal partition's designation).
<item>
Copy the lilo configuration file and kernel images that lilo uses by running:
</itemize>
<p>
<verb>
cp /mnt/original/etc/lilo.conf /etc
cp /mnt/original/boot/* /boot
</verb>
</p> <p>
If your normal Linux system does not have (all of) it's kernel images in
/mnt/original/boot, then check your /etc/lilo.conf file for the location of
those files and copy those as well to the location where /etc/lilo.conf expects
them to be. Or you can copy them to /boot regardless and modify the /etc/lilo.conf
file so it contains the new paths for the images as you have them on the LFS
system. Either way works fine, it's up to you how you want to do it.
</p>
<sect2>
Configuring Sysklogd
<p>
<itemize>
<item>
Create the /var/log directory by running: mkdir /var/log
<item>
Create the /etc/syslog.conf file containing the following:
</itemize>
<p>
<verb>
&num; Begin /etc/syslog.conf
auth,authpriv.* -/var/log/auth.log
*.*;auth,authpriv.none -/var/log/sys.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
*.emerg *
&num; End /etc/syslog.conf
</verb>
</p> <sect2>
Configuring Shadow Password Suite
<p>
This package contains the utilities to modify user's passwords, add new
users/groups, delete users/groups and more. I'm not going to explain to you
what 'password shadowing' means. You can read all about that in the doc/HOWTO
file. There's one thing you should keep in mind, if you decide to use shadow
support, that programs that need to verify passwords (examples are xdm, ftp
daemons, pop3d, etc) need to be 'shadow-compliant', eg. they need to be able
to work with shadowed passwords.
</p>
<p>
If you decide you don't want to use shadowed passwords (after you're read
the doc/HOWTO document), you still use this archive since the utilities in
this archive are also used on system which have shadowed passwords disabled.
You can read all about this in the HOWTO. Also note that you can switch between
shadow and non-shadow at any point you want.
</p>
<p>
Now is a very good moment to read section &num;5 of the doc/HOWTO file.
You can read how you can test if shadowing works and if not, how to disable
it. If it doesn't work and you haven't tested it, you'll end up with an unusable
system after you logout of all your consoles, since you won't be able to login
anymore. You can easily fix this by passing the init=/sbin/sulogin parameter
to the kernel, unpack the util-linux archive, go to the login-utils directory,
build the login program and replace the /bin/login by the one in the util-linux
package. Things are never hopelessly messed up (at least not under Linux),
but you can avoid a hassle by testing properly and reading manuals ;)
</p>
<sect2>
Configuring Sysvinit
<p>
After you have made the following modification to the /etc/inittab file,
you will be able to logon to it as you are used to (using the agetty and login
programs). Sulogin won't be used anymore for normal logins.
</p>
<p>
<itemize>
<item>
Edit the /etc/inittab file and modify it so it contains the following:
</itemize>
<p>
<verb>
&num; Begin /etc/inittab
id:2:initdefault:
si::sysinit:/etc/init.d/rcS
su:S:wait:/sbin/sulogin
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
ft:6:respawn:/sbin/sulogin
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
1:2345:respawn:/sbin/agetty /dev/tty1 9600
2:2345:respawn:/sbin/agetty /dev/tty2 9600
3:2345:respawn:/sbin/agetty /dev/tty3 9600
4:2345:respawn:/sbin/agetty /dev/tty4 9600
5:2345:respawn:/sbin/agetty /dev/tty5 9600
6:2345:respawn:/sbin/agetty /dev/tty6 9600
&num; End /etc/inittab
</verb>
</p> <sect2>
Creating /var/run/utmp file
<p>
Programs like login, shutdown and others want to write to the /var/run/utmp
file. This file contains information about who is currently logged in. It also
contains information on when the computer was last shutdown.
</p>
<p>
<itemize>
<item>
Create the /var/run/utmp file by running: touch /var/run/utmp
<item>
Give it the proper file permissions by running: chmod 644 /var/run/utmp
</itemize>
</p> <sect>
Creating system boot scripts
<p>
These bootscripts are started at system boot time. The scripts are responsible
for mounting the root file system in read-write mode, activating swap, setting
up some system settings and starting the various daemons that our system needs.
</p>
<sect1>
Preparing the directories and master files
<p>
You need the Sysvinit package again for this section.
</p>
<p>
<itemize>
<item>
Create the necessary directories by running:
</itemize>
<p>
<verb>
cd /etc
mkdir rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d init.d rcS.d
</verb>
<p>
<itemize>
<item>
Go to the unpacked Sysvinit source directory
<item>
Copy the <tt>Debian/etc/init.d/rc</tt> file to: <tt>/etc/init.d</tt>
<item>
Go to the /etc/init.d directory
<item>
Create a new file <tt>rcS</tt> containing the following:
</itemize>
<p>
<verb>
&num;!/bin/sh
&num; Begin /etc/init.d/rcS
runlevel=S
prevlevel=N
umask 022
export runlevel prevlevel
trap ":" INT QUIT TSTP
for i in /etc/rcS.d/S??*
do
&lsqb; ! -f "&dollar;i" &rsqb; &amp;&amp; continue;
&dollar;i start
done
&num; End /etc/init.d/rcS
</verb>
</p> <sect1>
Creating the reboot script
<p>
<itemize>
<item>
Create a new file<tt> reboot</tt> containing the following:
</itemize>
<p>
<verb>
&num;!/bin/sh
&num; Begin /etc/init.d/reboot
echo -n "System reboot in progress..."
/sbin/reboot -d -f -i
&num; End /etc/init.d/reboot
</verb>
</p> <sect1>
Creating the halt script
<p>
<itemize>
<item>
Create a new file <tt>halt</tt> containing the following:
</itemize>
<p>
<verb>
&num;!/bin/sh
&num; Begin /etc/init.d/halt
/sbin/halt -d -f -i -p
&num; End /etc/init.d/halt
</verb>
</p> <sect1>
Creating the mountfs script
<p>
<itemize>
<item>
Create a new file <tt>mountfs</tt> containing the following:
</itemize>
<p>
<verb>
&num;!/bin/sh
&num; Begin /etc/init.d/mountfs
check_status()
&lcub;
if &lsqb; &dollar;? = 0 &rsqb;
then
echo "OK"
else
echo "FAILED"
fi
&rcub;
echo -n "Remounting root file system in read-write mode..."
/bin/mount -n -o remount,rw /
check_status
&gt; /etc/mtab
/bin/mount -f -o remount,rw /
echo -n "Mounting proc file system..."
/bin/mount proc
check_status
&num; End /etc/init.d/mountfs
</verb>
</p> <sect1>
Creating the umountfs script
<p>
<itemize>
<item>
Create a new file <tt>umountfs</tt> containing the following:
</itemize>
<p>
<verb>
&num;!/bin/sh
&num; Begin /etc/init.d/umountfs
check_status()
&lcub;
if &lsqb; &dollar;? = 0 &rsqb;
then
echo "OK"
else
echo "FAILED"
fi
&rcub;
echo "Deactivating swap..."
/bin/swapoff -av
check_status
echo -n "Unmounting file systems..."
/bin/umount -a -r
check_status
&num; End /etc/init.d/umountfs
</verb>
</p> <sect1>
Creating the sendsignals script
<p>
<itemize>
<item>
Create a new file <tt>sendsignals</tt> containing the following:
</itemize>
<p>
<verb>
&num;!/bin/sh
&num; Begin /etc/init.d/sendsignals
check_status()
&lcub;
if &lsqb; &dollar;? = 0 &rsqb;
then
echo "OK"
else
echo "FAILED"
fi
&rcub;
echo -n "Sending all processes the TERM signal..."
/sbin/killall5 -15
check_status
echo -n "Sending all processes the KILL signal..."
/sbin/killall5 -9
check_status
</verb>
</p> <sect1>
Creating the checkroot bootscript
<p>
<itemize>
<item>
Create a file <tt>/etc/init.d/checkroot</tt> containing the following:
</itemize>
<p>
<verb>
&num;!/bin/sh
&num; Begin /etc/init.d/checkroot
echo "Activating swap..."
/sbin/swapon -av
if &lsqb; -f /fastboot &rsqb;
then
echo "Fast boot, no file system check"
else
/bin/mount -n -o remount,ro /
if &lsqb; &dollar;? = 0 &rsqb;
then
if &lsqb; -f /forcecheck &rsqb;
then
force="-f"
else
force=""
fi
echo "Checking root file system..."
/sbin/fsck &dollar;force -a /
if &lsqb; &dollar;? -gt 1 &rsqb;
then
echo
echo "fsck failed. Please repair your file system manually by"
echo "running fsck without the -a option"
echo "Please note that the file system is currently mounted in"
echo "read-only mode."
echo
echo "I will start sulogin now. CTRL+D will reboot your system."
/sbin/sulogin
/reboot -f
fi
else
echo "Cannot check root file system because it is not mounted in"
echo "read-only mode."
fi
fi
&num; End /etc/init.d/checkroot
</verb>
</p> <sect1>
Creating the Sysklogd bootscript
<p>
<itemize>
<item>
Create a new file <tt>/etc/init.d/sysklogd</tt> containing the following:
</itemize>
<p>
<verb>
&num;!/bin/sh
&num; Begin /etc/init.d/sysklogd
check_status()
&lcub;
if &lsqb; &dollar;? = 0 &rsqb;
then
echo "OK"
else
echo "FAILED"
fi
&rcub;
case "&dollar;1" in
start)
echo -n "Starting system log daemon..."
start-stop-daemon -S -q -o -x /usr/sbin/syslogd -- -m 0
check_status
echo -n "Starting kernel log daemon..."
start-stop-daemon -S -q -o -x /usr/sbin/klogd
check_status
;;
stop)
echo -n "Stopping kernel log daemon..."
start-stop-daemon -K -q -o -p /var/run/klogd.pid
check_status
echo -n "Stopping system log daemon..."
start-stop-daemon -K -q -o -p /var/run/syslogd.pid
check_status
;;
reload)
echo -n "Reloading system load daemon configuration file..."
start-stop-daemon -K -q -o -s 1 -p /var/run/syslogd.pid
check_status
;;
restart)
echo -n "Stopping kernel log daemon..."
start-stop-daemon -K -q -o -p /var/run/klogd.pid
check_status
echo -n "Stopping system log daemon..."
start-stop-daemon -K -q -o -p /var/run/syslogd.pid
check_status
sleep 1
echo -n "Starting system log daemon..."
start-stop-daemon -S -q -o -x /usr/sbin/syslogd -- -m 0
check_status
echo -n "Starting kernel log daemon..."
start-stop-daemon -S -q -o -x /usr/sbin/klogd
check_status
;;
*)
echo "Usage: &dollar;0 &lcub;start|stop|reload|restart&rcub;"
exit 1
;;
esac
&num; End /etc/init.d/sysklogd
</verb>
</p> <sect1>
Setting up symlinks and permissions
<p>
<itemize>
<item>
Set the proper file permissions and symlinks by running<tt>:</tt>
</itemize>
<p>
<verb>
chmod 755 rcS reboot halt mountfs umountfs sendsignals checkroot sysklogd
cd ../rc0.d
ln -s ../init.d/sysklogd K90sysklogd
ln -s ../init.d/sendsignals S80sendsignals
ln -s ../init.d/umountfs S90umountfs
ln -s ../init.d/halt S99halt
cd ../rc6.d
ln -s ../init.d/sysklogd K90sysklogd
ln -s ../init.d/sendsignals S80sendsignals
ln -s ../init.d/umountfs S90umountfs
ln -s ../init.d/reboot S99reboot
cd ../rcS.d
ln -s ../init.d/checkroot S05checkroot
ln -s ../init.d/mountfs S10mountfs
cd /etc/rc2.d
ln -s ../init.d/sysklogd S03sysklogd
</verb>
</p> <sect1>
Creating the /etc/fstab file
<p>
<itemize>
<item>
Create a file <tt>/etc/fstab</tt> containing the following:
</itemize>
<p>
<verb>
/dev/&lt;LFS-partition designation&gt; / ext2 defaults 0 1
/dev/&lt;swap-partition designation&gt; none swap sw 0 0
proc /proc proc defaults 0 0
</verb>
</p> <sect>
Setting up basic networking
<sect1>
Installing Netkit-base
<p>
<itemize>
<item>
Unpack the Netkit-base archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
cd etc.sample; cp services protocols /etc
mv /usr/bin/ping /bin
</verb>
</p> <sect1>
Installing Net-tools
<p>
<itemize>
<item>
Unpack the Net-tools archive and install it by running:
</itemize>
<p>
<verb>
make; make install
mv /usr/bin/netstat /bin
cd /usr/sbin; mv ifconfig route /sbin
</verb>
</p> <sect2>
Creating the /etc/init.d/localnet bootscript
<p>
<itemize>
<item>
Create a new file <tt>/etc/init.d/localnet</tt> containing the following:
</itemize>
<p>
<verb>
&num;!/bin/sh
&num; Begin /etc/init.d/localnet
check_status()
&lcub;
if &lsqb; &dollar;? = 0 &rsqb;
then
echo "OK"
else
echo "FAILED"
fi
&rcub;
echo -n "Setting up loopback device..."
/sbin/ifconfig lo 127.0.0.1
check_status
echo -n "Setting up hostname..."
/bin/hostname --file /etc/hostname
check_status
&num; End /etc/init.d/localnet
</verb>
</p> <sect2>
Setting up permissions and symlink
<p>
<itemize>
<item>
Set the proper permissions by running <tt>chmod 755 /etc/init.d/localnet
</tt>
<item>
Create the proper symlinks by running <tt>cd /etc/rcS.d; ln -s ../init.d/localnet
S03localnet</tt>
</itemize>
</p> <sect2>
Creating the /etc/hostname file
<p>
Create a new file <tt>/etc/hostname</tt> and put the hostname in it. This is not
the FQDN (Fully Qualified Domain Name). This is the name you wish to call your
computer in a network.
</p>
<sect2>
Creating the /etc/hosts file
<p>
If you want to configure a network card, you have to decide on the IP-address,
FQDN and possible aliases for use in the /etc/hosts file. An example is:
</p>
<p>
<verb>
&lt;myip&gt; myhost.mydomain.org aliases
</verb>
</p> <p>
Make sure the IP-address is in the private network IP-address range. Valid
ranges are:
</p>
<p>
<verb>
Class Networks
A 10.0.0.0
B 172.16.0.0 through 172.31.0.0
C 192.168.0.0 through 192.168.255.0
</verb>
</p> <p>
A valid IP address could be 192.168.1.1. A valid FQDN for this IP could
be me.linuxfromscratch.org
</p>
<p>
If you're not going to use a network card, you still need to come up with
a FQDN. This is necessary for programs like Sendmail to operate correctly (in
fact; Sendmail won't run when it can't determine the FQDN).
</p>
<p>
Here's the <tt>/etc/hosts</tt> file if you don't configure a network card:
</p>
<p>
<verb>
&num; Begin /etc/hosts (no network card version)
127.0.0.1 me.lfs.org &lt;contents of /etc/hostname&gt; localhost
&num; End /etc/hosts (no network card version)
</verb>
</p> <p>
Here's the <tt>/etc/hosts</tt> file if you do configure a network card:
</p>
<p>
<verb>
&num; Begin /etc/hosts (network card version)
127.0.0.1 localhost
192.168.1.1 me.lfs.org &lt;contents of /etc/hostname&gt;
&num; End /etc/hosts (network card version)
</verb>
</p> <p>
Of course, change the 192.168.1.1 and me.lfs.org to your own liking (or
requirements if you are assigned an IP-address by a network/system administrator
and you plan on connecting this machine to that network).
</p>
<sect2>
Creating the /etc/init.d/ethnet file
<p>
This sub section only applies if you are going to configure a network card.
If not, skip this sub section and read on.
</p>
<p>
Create a new file <tt>/etc/init.d/ethnet</tt> containing the following:
</p>
<p>
<verb>
&num;!/bin/sh
&num; Begin /etc/init.d/ethnet
check_status()
&lcub;
if &lsqb; &dollar;? = 0 &rsqb;
then
echo "OK"
else
echo "FAILED"
fi
&rcub;
/sbin/ifconfig eth0 &lt;ipaddress&gt;
check_status
&num; End /etc/init.d/ethnet
</verb>
</p> <sect2>
Setting up permissions and symlink for /etc/init.d/ethnet
<p>
<itemize>
<item>
Set the proper permissions by running <tt>chmod 755 ethnet</tt>
<item>
Create the proper symlinks by running <tt>cd ../rc2.d; ln -s ../init.d/ethnet
S10ethnet</tt>
</itemize>
</p> <sect2>
Testing the network setup
<p>
<itemize>
<item>
Start the just created localnet script by running <tt>/etc/init.d/localnet
</tt>
<item>
Start the just created ethnet script if you have one by running <tt>/etc/init.d/ethnet
</tt>
<item>
Test if /etc/hosts is properly setup by running:
</itemize>
<p>
<verb>
ping &lt;your FQDN&gt;
ping &lt;what you choose for hostname&gt;
ping localhost
ping 127.0.0.1
ping 192.168.1.1 (only when you configured your network card)
</verb>
</p> <p>
All these five ping command's should work without failures. If so, the
basic network is working.
</p>
<sect1>
Testing the system
<p>
Now that all software has been installed, bootscripts have been written
and the local network is setup, it's time for you to reboot your computer and
test these new scripts to verify that they actually work. You first want to
execute them manually from the /etc/init.d directory so you can fix the most
obvious problems (typos, wrong paths and such). When those scripts seem to
work just fine manually they should also work during a system start or shutdown.
There's only one way to test that. Shutdown your system with shutdown -r now
and reboot into LFS. After the reboot you will have a normal login prompt like
you have on your normal Linux system (unless you use XDM or some sort of other
Display Manger (like KDM - KDE's version of XDM).
</p>
<p>
At this point your basic LFS system is ready for use. Everything else that
follows now is optional, so you can skip packages at your own discretion. But
do keep in mind that if you skip packages (especially libraries) you can break
dependencies of other packages. For example, when the Lynx browser is installed,
the zlib library is installed as well. You can decide to skip the zlib library,
but this library isn't used by Lynx alone. Other packages require this library
too. The same may apply to other libraries and programs.
</p>
<sect>
Installing Network Daemons
<sect1>
Setting up SMTP
<sect2>
Creating groups and user
<p>
Create the groups needed by Sendmail by running:
</p>
<p>
<verb>
groupadd -g 1 bin
groupadd -g 2 kmem
groupadd -g 3 mail
useradd -u 1 -g bin -d /bin -s /bin/sh bin
</verb>
</p> <sect2>
Creating directory
<p>
Outgoing mail processed by Sendmail is put in the /var/spool/mqueue directory.
Incoming mail is forwarded to Procmail by Sendmail so we need to have an incoming
mail directory as well which is /var/mail. We'll create these directories and
give them the proper permissions:
</p>
<p>
<verb>
mkdir /var/spool
mkdir /var/mail
cd /var/spool; ln -s ../mail mail
chmod 700 /var/spool/mqueue
chmod 775 /var/mail
chgrp mail /var/mail
chmod 1777 /tmp
</verb>
</p> <sect2>
Installing Sendmail
<p>
<itemize>
<item>
Unpack the Sendmail archive and install it by running:
</itemize>
<p>
<verb>
cd src
./Build; ./Build install
</verb>
</p> <sect2>
Configuring Sendmail
<p>
Configuring Sendmail isn't as easily said as done. There are a lot of things
you need to consider while configuring Sendmail and I can't take everything
into account. That's why at this time we'll create a very basic and standard
setup. If you want to tweak Sendmail to your own liking, go right ahead, but
this is not the right article. You could always use your existing /etc/sendmail.cf
(or /etc/mail/sendmail.cf) file if you need to use certain features.
</p>
<p>
<itemize>
<item>
Go to the cf directory
<item>
Create a new file <tt>cf/lfs.mc</tt> containing the following:
</itemize>
<p>
<verb>
OSTYPE(LFS)
FEATURE(nouucp)
define(`LOCAL_MAILER_PATH', /usr/bin/procmail)
MAILER(local)
MAILER(smtp)
</verb>
<p>
<itemize>
<item>
Create an empty file <tt>ostype/LFS.m4</tt> by running <tt>touch ostype/LFS.m4</tt>
<item>
Compile the lfs.mc file by running <tt>m4 m4/cf.m4 cf/lfs.mc &gt; cf/lfs.cf
</tt>
<item>
Copy the cf/lfs.cf to <tt>/etc/sendmail.cf</tt>
<item>
Create an empty /etc/aliases file by running <tt>touch /etc/aliases</tt>
<item>
Initialize this (empty) alias database by running <tt>sendmail -v -bi</tt>
</itemize>
</p> <sect2>
Installing Procmail
<p>
<itemize>
<item>
Unpack the Procmail archive and install it by running:
</itemize>
<p>
<verb>
make; make install; make install-suid
</verb>
</p> <sect2>
Creating /etc/init.d/sendmail bootscript
<p>
<itemize>
<item>
Create a new file <tt>/etc/init.d/sendmail</tt> containing the following:
</itemize>
<p>
<verb>
&num;!/bin/sh
&num; Begin /etc/init.d/sendmail
check_status()
&lcub;
if &lsqb; &dollar;? = 0 &rsqb;
then
echo "OK"
else
echo "FAILED"
fi
&rcub;
case "&dollar;1" in
start)
echo -n "Starting Sendmail..."
start-stop-daemon -S -q -o -x /usr/sbin/sendmail -- -bd
check_status
;;
stop)
echo -n "Stopping Sendmail..."
start-stop-daemon -K -q -o -p /var/run/sendmail.pid
check_status
;;
reload)
echo -n "Reloading Sendmail configuration file..."
start-stop-daemon -K -q -s 1 -p /var/run/sendmail.pid
check_status
;;
restart)
echo -n "Stopping Sendmail..."
start-stop-daemon -K -q -o -p /var/run/sendmail.pid
check_status
sleep 1
echo -n "Starting Sendmail..."
start-stop-daemon -S -q -o -x /usr/sbin/sendmail -- -bd
check_status
;;
*)
echo "Usage: &dollar;0 &lcub;start|stop|reload|restart&rcub;"
exit 1
;;
esac
&num; End /etc/init.d/sendmail
</verb>
</p> <sect2>
Setting up permissions and symlinks
<p>
<itemize>
<item>
Set the proper permissions by running <tt>chmod 755 /etc/init.d/sendmail
</tt>
<item>
Create the proper symlinks by running:
</itemize>
<p>
<verb>
cd /etc/init.d/rc2.d; ln -s ../init.d/sendmail S20sendmail
cd ../rc0.d; ln -s ../init.d/sendmail K20sendmail
cd ../rc6.d; ln -s ../init.d/sendmail K20sendmail
</verb>
</p> <sect1>
Setting up FTP
<sect2>
Creating groups and users
<p>
<itemize>
<item>
Create the necessary groups by running:
</itemize>
<p>
<verb>
groupadd -g 65534 nogroup
groupadd -g 4 ftp
</verb>
<p>
<itemize>
<item>
Create the necessary users by running:
</itemize>
<p>
<verb>
useradd -u 65534 -g nogroup -d /home nobody
useradd -u 4 -g ftp -s /bin/sh -m ftp
</verb>
</p> <sect2>
Installing Proftpd
<p>
<itemize>
<item>
Unpack the Proftpd archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Creating the /etc/init.d/proftpd bootscript
<p>
<itemize>
<item>
Create a new file <tt>/etc/init.d/proftpd</tt> containing the following:
</itemize>
<p>
<verb>
&num;!/bin/sh
&num; Begin /etc/init.d/proftpd
check_status()
&lcub;
if &lsqb; &dollar;? = 0 &rsqb;
then
echo &quot;OK&quot;
else
echo &quot;FAILED&quot;
fi
&rcub;
case &quot;&dollar;1&quot; in
start)
echo -n &quot;Starting Pro FTP daemon...&quot;
start-stop-daemon -S -q -o -x /usr/sbin/proftpd
check_status
;;
stop)
echo -n &quot;Stopping Pro FTP daemon...&quot;
start-stop-daemon -K -q -o -x /usr/sbin/proftpd
check_status
;;
restart)
echo -n &quot;Stopping Pro FTP daemon...&quot;
start-stop-daemon -K -q -o -x /usr/sbin/proftpd
check_status
sleep 1
echo -n &quot;Starting Pro FTP daemon...&quot;
start-stop-daemon -S -q -o -x /usr/sbin/proftpd
check_status
;;
*)
echo &quot;Usage: &dollar;0 &lcub;start|stop|restart&rcub;&quot;
;;
esac
&num; End /etc/init.d/proftpd
</verb>
</p> <sect2>
Setting up permissions and symlinks
<p>
<itemize>
<item>
Set the proper permissions by running <tt>chmod 755 /etc/init.d/proftpd
</tt>
<item>
Create the necessary symlinks by running:
</itemize>
<p>
<verb>
cd /etc/rc2.d; ln -s ../init.d/proftpd S40proftpd
cd ../rc0.d; ln -s ../init.d/proftpd K40proftpd
cd ../rc6.d; ln -s ../init.d/proftpd K40proftpd
</verb>
</p> <sect1>
Setting up HTTP
<sect2>
Installing Apache
<p>
<itemize>
<item>
Unpack the Apache archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Configuring Apache
<p>
There's not much that needs to be configured. The only thing we need to
do is to add the /usr/apache/man path to /usr/share/misc/man.conf
</p>
<p>
<itemize>
<item>
Edit the /usr/share/misc/man.conf file
<item>
Add this line underneath the other lines that start with MANPATH: <em>MANPATH
/usr/apache/man</em>
</itemize>
</p> <sect2>
Creating /etc/init.d/apache bootscript
<p>
<itemize>
<item>
Create a new file <tt>/etc/init.d/apache</tt> containing the following:
</itemize>
<p>
<verb>
&num;!/bin/sh
&num; Begin /etc/init.d/apache
case &quot;&dollar;1&quot; in
start)
echo -n &quot;Starting Apache HTTP daemon...&quot;
/usr/apache/bin/apachectl start
;;
stop)
echo -n &quot;Stopping Apache HTTP daemon...&quot;
/usr/apache/bin/apachectl stop
;;
restart)
echo -n &quot;Restarting Apache HTTP daemon...&quot;
/usr/apache/bin/apachectl restart
;;
force-restart)
echo -n &quot;Stopping Apache HTTP daemon...&quot;
/usr/apache/bin/apachectl stop
sleep 1
echo -n &quot;Starting Apache HTTP daemon...&quot;
/usr/apache/bin/apachectl start
;;
*)
echo &quot;Usage: &dollar;0 &lcub;start|stop|restart|force-restart&rcub;&quot;
;;
esac
&num; End /etc/init.d/apache
</verb>
</p> <sect2>
Setting up permissions and symlinks
<p>
<itemize>
<item>
Set the proper permissions by running <tt>chmod 755 /etc/init.d/apache
</tt>
<item>
Create the necessary symlinks by running:
</itemize>
<p>
<verb>
cd /etc/rc2.d; ln -s ../init.d/apache S50apache
cd ../rc0.d; ln -s ../init.d/apache K50apache
cd ../rc6.d; ln -s ../init.d/apache K50apache
</verb>
</p> <sect1>
Setting up Telnet
<sect2>
Installing telnet daemon + client
<p>
<itemize>
<item>
Unpack the Netkit-telnet archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Creating the /etc/inetd.conf configuration file
<p>
<itemize>
<item>
Create a new file <tt>/etc/inetd.conf</tt> containing the following:
</itemize>
<p>
<verb>
&num; Begin /etc/inetd.conf
telnet stream tcp nowait root /usr/sbin/in.telnetd
&num; End /etc/inetd.conf
</verb>
</p> <sect2>
Creating the /etc/init.d/inetd bootscript
<p>
<itemize>
<item>
Create a new file <tt>/etc/init.d/inetd</tt> containing the following:
</itemize>
<p>
<verb>
&num;!/bin/sh
&num; Begin /etc/init.d/inetd
check_status()
&lcub;
if &lsqb; &dollar;? = 0 &rsqb;
then
echo &quot;OK&quot;
else
echo &quot;FAILED&quot;
fi
&rcub;
case &quot;&dollar;1&quot; in
start)
echo -n &quot;Starting Internet Server daemon...&quot;
start-stop-daemon -S -q -o -x /usr/sbin/inetd
check_status
;;
stop)
echo -n &quot;Stopping Internet Server daemon...&quot;
start-stop-daemon -K -q -o -p /var/run/inetd.pid
check_status
;;
reload)
echo -n &quot;Reloading Internet Server configuration file...&quot;
start-stop-daemon -K -q -s 1 -p /var/run/inetd.pid
check_status
;;
restart)
echo -n &quot;Stopping Internet Server daemon...&quot;
start-stop-daemon -K -q -o -p /var/run/inetd.pid
check_status
sleep 1
echo -n &quot;Starting Internet Server daemon...&quot;
start-stop-daemon -S -q -o -x /usr/sbin/inetd
check_status
;;
*)
echo &quot;Usage: &dollar;0 &lcub;start|stop|reload|restart&rcub;&quot;
;;
esac
&num; End /etc/init.d/inetd
</verb>
</p> <sect2>
Setting up permissions and symlinks
<p>
<itemize>
<item>
Set the proper permissions by running <tt>chmod 755 /etc/init.d/inetd</tt>
<item>
Create the necessary symlinks by running
</itemize>
<p>
<verb>
cd /etc/rc2.d; ln -s ../init.d/inetd S30inetd
cd ../rc0.d; ln -s ../init.d/inetd K30inetd
cd ../rc6.d; ln -s ../init.d/inetd K30 inetd
</verb>
</p> <sect1>
Setting up PPP
<sect2>
Configuring the Kernel
<p>
Before you can logon to the Internet, the kernel must be ppp-aware. You
can accomplish this by compiling ppp-support directly into the kernel, or compiling
the ppp drivers are modules which you load when you need them. Whatever you
prefer, do it now by re-configuring the kernel if necessary. If your LFS kernel
is already ppp-aware than you don't have to re-configure the kernel.
</p>
<sect2>
Creating group
<p>
<itemize>
<item>
Create the daemon group by running <tt>groupadd -g7 daemon</tt>
</itemize>
</p> <sect2>
Installing PPP
<p>
<itemize>
<item>
Unpack the PPP archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Creating /etc/resolv.conf
<p>
<itemize>
<item>
Create a new file <tt>/etc/resolv.conf</tt> containing the following:
</itemize>
<p>
<verb>
&num; Begin /etc/resolv.conf
nameserver &lt;IP address of your ISP's primary DNS server&gt;
nameserver &lt;IP address of your ISP's secundary DNS server&gt;
&num; End /etc/resolv.conf
</verb>
</p> <sect2>
Creating /etc/ppp/peers/provider
<p>
<itemize>
<item>
Create the <tt>/etc/ppp/peers</tt> directory
<item>
Create a new file <tt>/etc/ppp/peers/provider</tt> containing the following:
</itemize>
<p>
<verb>
&num; Begin /etc/ppp/peers/provider
noauth
connect "/usr/sbin/chat -v -f /etc/chatscripts/provider"
/dev/ttyS1
115200
defaultroute
noipdefault
&num; End /etc/ppp/peers/provider
</verb>
</p> <sect2>
Creating /etc/chatscripts/provider
<p>
<itemize>
<item>
Create the <tt>/etc/chatscripts</tt> directory
<item>
Create a new file <tt>/etc/chatscripts/provider</tt> containing the following:
</itemize>
<p>
<verb>
&num; Begin /etc/chatscripts/provider
ABORT BUSY
ABORT "NO CARRIER"
ABORT VOICE
ABORT "NO DIALTONE"
ABORT "NO ANSWER"
"" ATZ
OK ATDT &lt;ISP's phonenumber&gt;
TIMEOUT 35
CONNECT ''
TIMEOUT 10
ogin: &bsol;q&lt;username&gt;
TIMEOUT 10
assword: &bsol;q&lt;mysecretpassword&gt;
&num; End /etc/chatscripts/provider
</verb>
</p> <sect2>
Note on password authentication
<p>
As you see from the sample scripts (these are the actual scripts I use
when I'm not using X) above I logon to my ISP using this chatscripts in stead
of authenticating via pap or chap. Though my ISP supports pap, I choose to
do it this slightly different way which has it's disadvantages and advantages.
In my case the advantages outweigh the disadvantages. This way I have more
control over my logon procedure and I can see closer what is happening when.
</p>
<p>
For example most times when I connect I have a window running <tt>tail -f /var/log/syslog</tt>
so I can keep an eye on when (with my provider it's mostly 'if') things like
the username and password are sent.
</p>
<sect>
Installing Network Clients
<sect1>
Installing Email clients
<sect2>
Installing Mailx
<p>
<itemize>
<item>
Unpack the Mailx archive and install it by running
</itemize>
<p>
<verb>
make; make install
</verb>
</p> <sect2>
Installing Mutt
<p>
My favorite email client is Mutt, so that's why we're installing this one.
Feel free to skip the installation of Mutt and install your own favorite client.
After all, this is going to be your system. Not mine.
</p>
<p>
If your favorite client is an X Window client (such as Netscape Mail) then
you'll have to sit tight a little while till we've installed X.
</p>
<p>
<itemize>
<item>
Unpack the Mutt archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing Fetchmail
<p>
<itemize>
<item>
Unpack the Fetchmail archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Testing the email system
<p>
It's time to test the email system now.
</p>
<p>
<itemize>
<item>
Start Sendmail by running <tt>/usr/sbin/sendmail -bd</tt> (you need to start sendmail
using the full path. If you don't, you can't let sendmail reload the sendmail.cf
by running kill -1 &lt;sendmail pid&gt;).
<item>
Send yourself an email by running <tt>echo &quot;this is an email test&quot;
| mail -s test root</tt>
<item>
Start the <tt>mail</tt> program and you should see your email there.
<item>
Create a new user by running <tt>useradd -m testuser; passwd testuser</tt>
<item>
Send an email to testuser by running <tt>echo &quot;test mail to testuser&quot;
| mail -s test testuser </tt>
<item>
Login as testuser, try to obtain that email (using the mail program) and
send an email to root in the same way as you send an email to testuser.
</itemize>
</p> <p>
If this all worked just fine, you have a working email system for local
email. It's not necessarily ready for Internet yet. You can remove the testuser
by running userdel -r testuser
</p>
<sect1>
Installing FTP client
<sect2>
Installing Netkit-ftp
<p>
<itemize>
<item>
Unpack the Netkit-ftp archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Testing FTP system
<p>
<itemize>
<item>
Start the Pro ftp daemon by running <tt>/etc/init.d/proftpd start</tt>
<item>
Start a ftp session to localhost by running <tt>ftp localhost</tt>
<item>
Login as user anonymous and logout again.
</itemize>
</p> <sect1>
Installing HTTP client
<sect2>
Installing Zlib
<p>
Zlib is a compression library, used by programs like PKware's zip and unzip
utilities. Lynx can use this library to compress certain files.
</p>
<p>
<itemize>
<item>
Unpack the Zlib archive and install it by running:
</itemize>
<p>
<verb>
./configure --shared
make; make install
</verb>
</p> <sect2>
Installing Lynx
<p>
<itemize>
<item>
Unpack the Lynx archive and install it by running:
</itemize>
<p>
<verb>
./configure --libdir=/etc --with-zlib
make; make install
make install-help; make install-doc
</verb>
</p> <sect2>
Testing HTTP system
<p>
<itemize>
<item>
Start the Apache http daemon by running <tt>/etc/init.d/apache start</tt>
<item>
Start a http session to localhost by running <tt>lynx http://localhost
</tt>
<item>
Exit lynx.
</itemize>
</p> <sect1>
Installing Telnet client
<p>
The Telnet client has already been installed when we installed the Telnet
daemon in the previous chapter.
</p>
<sect2>
Testing Telnet system
<p>
<itemize>
<item>
Start the Internet Server daemon (and with it telnetd) by running <tt>/etc/init.d/inetd
start</tt>
<item>
Start a telnet session to localhost by running <tt>telnet localhost</tt>
<item>
Login and logout again.
</itemize>
</p> <sect1>
Installing PPP clients
<sect2>
Creating the connect script
<p>
<itemize>
<item>
Create a new file <tt>/usr/bin/pon</tt> file containing the following:
</itemize>
<p>
<verb>
&num;!/bin/sh
&num; Begin /usr/bin/pon
/usr/sbin/pppd call provider
&num; End /usr/bin/pon
</verb>
</p> <sect2>
Creating the disconnect script
<p>
<itemize>
<item>
Create a new file <tt>/usr/bin/poff</tt> file containing the following:
</itemize>
<p>
<verb>
&num;!/bin/sh
&num; Begin /usr/bin/poff
set -- `cat /var/run/ppp*.pid`
case &dollar;&num; in
0)
kill -15 `ps axw|grep "pppd call &lsqb;&lsqb;allnum:&rsqb;&rsqb;+"|grep -v grep|awk '&lcub;print &dollar;1&rcub;'`
exit 0
;;
1)
kill -15 &dollar;1
exit 0
;;
esac
&num; End /usr/bin/poff
</verb>
</p> <sect2>
Testing PPP system
<p>
<itemize>
<item>
Connect to the Internet by running <tt>pon</tt>
<item>
Try to connect to a site like http://www.linuxfromscratch.org
<item>
Disconnect from the Internet by running <tt>poff</tt>
</itemize>
</p> <sect>
Installing X Window System
<sect1>
Installing X
<p>
<itemize>
<item>
Unpack the X archive and install it by running:
</itemize>
<p>
<verb>
make World
make install; make install.man
</verb>
</p> <p>
During the compilation process you will encounter a few errors about the
"makedepend" script not being able to find the stddef.h stdarg.h and float.h
header files. The script just isn't as smart as the compiler is apparently,
since the compilation itself does work fine without compilation errors. Though,
creating a few temporary symlinks won't solve the problem; they only will cause
more problems.
</p>
<p>
So you just ignore the many makedepend errors you most likely will be getting.
Also errors similar to "pointer targets in passing arg x of somefunction differ
in signedness". You can rewrite those files if you feel like it. I won't do
it.
</p>
<sect1>
Creating /etc/ld.so.conf
<p>
Create a new file <tt>/etc/ld.so.conf</tt> containing the following:
</p>
<p>
<verb>
&num; Begin /etc/ld.so.conf
/lib
/usr/lib
/usr/X11R6/lib
&num; End /etc/ld.so.conf
</verb>
<p>
<itemize>
<item>
Update the dynamic loader cache by running <tt>ldconfig</tt>
</itemize>
</p> <sect1>
Creating the /usr/include/X11 symlink
<p>
<itemize>
<item>
In order for the pre-processor to find the X11/*.h files (which you encounter
in &num;include statements in source code) create the following symlink: <tt>ln
-s /usr/X11R6/include/X11 /usr/include/X11</tt>
</itemize>
</p> <sect1>
Creating the /usr/X11 symlink
<p>
Often software copies files to /usr/X11 so it doesn't have to know which
release of X you are using. This symlink hasn't been created by the X installation,
so we have to create it by ourselves.
</p>
<p>
<itemize>
<item>
Create the /usr/X11 symlink by running <tt>ln -s /usr/X11R6 /usr/X11</tt>
</itemize>
</p> <sect1>
Adding /usr/X11/bin to the &dollar;PATH environment variable
<p>
There are a few ways to add the /usr/X11/bin path to the &dollar;PATH environment
variable. One way of doing so is the following:
</p>
<p>
<itemize>
<item>
Create a new file <tt>/root/.bashrc</tt> with it's contents as follows: <em>export PATH=&dollar;PATH:/usr/X11/bin
</em>
</itemize>
</p> <p>
You need to login again for this change to become effective. Or you can
update the path by running <tt>export PATH=&dollar;PATH:/usr/X11/bin manually
</tt>
</p>
<sect1>
Configuring X
<p>
<itemize>
<item>
Configure the X server by running <tt>xf86config</tt>
</itemize>
</p> <p>
If the XF86Config file created by xf86config doesn't suffice, then you
better copy the already existing XF86Config from your normal Linux system to
/etc. Cases wherein you need to make special changes to the file which aren't
supported by the xf86config program force you to do this. You can always modify
the created XF86Config file by hand. This can be very time consuming, especially
if you don't quite remember what needs to be changed.
</p>
<sect1>
Testing X
<p>
Now that X is properly configured it's time for our first test run.
</p>
<p>
<itemize>
<item>
Start the X server by running <tt>startx</tt>
</itemize>
</p> <p>
The X server should start and display 3 xterm's on your screen. If this
is true in your case, X is running fine.
</p>
<sect1>
Installing Window Maker
<p>
I choose to install Window Maker as the Window Manager. This is because
I've used WindowMaker for quite a while now and I'm very satisfied with it.
As usual, you don't have to do what I'm doing; install whatever you want. As
you might know, you can install several Window Managers simultaneously and
choose which one to start by specifying it in the &dollar;HOME/.xinitrc (or
&dollar;HOME/.xsession in case you decide to use xdm) file.
</p>
<sect1>
Preparing the system for the Window Maker installation
<sect2>
Installing libPropList
<p>
<itemize>
<item>
Unpack the libPropList archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing libXpm
<p>
<itemize>
<item>
Unpack the libXpm archive and install it by running:
</itemize>
<p>
<verb>
xmkmf; make Makefiles; make includes; make depend
cd lib; make; make install
cd ..; make; make install
</verb>
</p> <p>
This slightly different installation is necessary due to a bug in one of
the Makefiles. It depends on files in the lib directory which aren't installed
yet and it's not searching for them in the lib directory, so we have to install
those files first before compiling the actual package.
</p>
<sect2>
Installing libpng
<p>
<itemize>
<item>
Unpack the libpng archive and install it by running:
</itemize>
<p>
<verb>
make -f scripts/makefile.lnx; make -f scripts/makefile.lnx install
</verb>
</p> <sect2>
Installing libtiff
<p>
<itemize>
<item>
Unpack the libtiff archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing libjpeg
<p>
<itemize>
<item>
Unpack the libjpeg archive and install it by running:
</itemize>
<p>
<verb>
./configure --enable-shared --enable-static
make; make install
</verb>
</p> <sect2>
Installing libungif
<p>
<itemize>
<item>
Unpack the libungif archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect2>
Installing WindowMaker
<p>
<itemize>
<item>
Unpack the WindowMaker archive and install it by running:
</itemize>
<p>
<verb>
./configure
make; make install
</verb>
</p> <sect1>
Updating dynamic loader cache
<p>
<itemize>
<item>
Update the dynamic loader cache by running: <tt>ldconfig</tt>
</itemize>
</p> <sect1>
Configuring WindowMaker
<p>
Every user who wishes to use WindowMaker has to run the wmaker.inst script
before he or she can use it. This script will copy the necessary files into
the user's home directory and modify the &dollar;HOME/.xinitrc file (or create
it if it's not there yet).
</p>
<p>
<itemize>
<item>
Setup WindowMaker for yourself by running <tt>wmaker.inst</tt>
</itemize>
</p> <sect1>
Testing WindowMaker
<p>
<itemize>
<item>
Start the X server and see if the WindowMaker Window Manager starts properly
by running <tt>startx</tt>
</itemize>
</p> <sect>
Resources
<p>
A list of books, HOWTOs and other documents you might find useful to download
or buy follows. This list is just a small list to start with. We hope to be
able to expand this list in time as we come across more useful documents or
books.
</p>
<sect1>
Books
<p>
<itemize>
<item>
Sendmail published by O'Reilly. ISBN: 1-56592-222-0
<item>
Linux Network Administrator's Guide published by O'Reilly. ISBN: 1-56592-087-2
<item>
Running Linux published by O'Reilly. ISBN: 1-56592-151-8
</itemize>
</p> <sect1>
HOWTOs
<p>
<itemize>
<item>
ISP-Hookup-HOWTO at <htmlurl url="http://www.linuxdoc.org" name="http://ww.linuxdoc.org">
<item>
Linux Network Administrator's Guide online at <htmlurl url="http://www.linuxdoc.org" name="http://www.linuxdoc.org">
</itemize>
</p> <sect1>
Other
<p>
<itemize>
<item>
The various manual and info pages that come with packages
</itemize>
</p> <sect>
The End
<p>
You have reached the end of the Linux From Scratch HOWTO. I hope this experience
helped you getting to know Linux better. If you have anything that you think
needs to be mentioned in here (be it a bug fix, extra software which has been
forgotten but which you consider important) let us know. Together with your
help and suggestions this HOWTO can be improved significantly.
</p>
<sect>
Copyright &amp; Licensing Information
<p>
Copyright (C) 1999 by Gerard Beekmans. This document may be distributed
only subject to the terms and conditions set forth in the LDP License at <htmlurl url="http://www.linuxdoc.org/COPYRIGHT.html" name="http://www.linuxdoc.org/COPYRIGHT.html">.
</p>
<p>
It is not necessary to display the license notice, as described in the
LDP License, when only a small part of this document (the HOWTO) is quoted
for informational or similar purposes. However, I do require you to display
with the quotation(s) a line similar to the following line: "Quoted from the
LFS-HOWTO at <htmlurl url="http://huizen.dds.nl/~glb/" name="http://huizen.dds.nl/~glb/">
</p>
</article>