[4122007] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[ff769b8c] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
[4122007] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
[f45b1953] | 8 | <sect1 id="intro-important-unpacking">
|
---|
[b92d4b3] | 9 | <?dbhtml filename="unpacking.html"?>
|
---|
[c269038] | 10 |
|
---|
[b92d4b3] | 11 | <sect1info>
|
---|
| 12 | <othername>$LastChangedBy$</othername>
|
---|
| 13 | <date>$Date$</date>
|
---|
| 14 | </sect1info>
|
---|
[f45b1953] | 15 |
|
---|
[b92d4b3] | 16 | <title>Notes on Building Software</title>
|
---|
[f45b1953] | 17 |
|
---|
[3ba3f58] | 18 | <para>Those people who have built an LFS system will be aware
|
---|
[b92d4b3] | 19 | of the general principles of downloading and unpacking software. We will
|
---|
| 20 | however repeat some of that information here for those new to building
|
---|
| 21 | their own software.</para>
|
---|
[f45b1953] | 22 |
|
---|
[3ba3f58] | 23 | <para>Each set of installation instructions contains a URL from which you
|
---|
| 24 | can download the package. We do however keep a selection of patches
|
---|
[cbadf6b] | 25 | available via HTTP. These are referenced as needed in the installation
|
---|
[b92d4b3] | 26 | instructions.</para>
|
---|
[f45b1953] | 27 |
|
---|
[b92d4b3] | 28 | <para>While you can keep the source files anywhere you like, we
|
---|
| 29 | assume that you have unpacked them and unzipped any required patches
|
---|
| 30 | into <filename>/usr/src</filename>.</para>
|
---|
[f45b1953] | 31 |
|
---|
[b92d4b3] | 32 | <para>We can not emphasize strongly enough that you should start from a
|
---|
| 33 | <emphasis>clean source tree</emphasis> each time. This means that if
|
---|
| 34 | you have had an error, it's usually best to delete the source tree and
|
---|
| 35 | re-unpack it <emphasis>before</emphasis> trying again. This obviously
|
---|
[cbadf6b] | 36 | doesn't apply if you're an advanced user used to hacking
|
---|
| 37 | <filename>Makefile</filename>s and C code, but if in doubt, start from a
|
---|
| 38 | clean tree.</para>
|
---|
[f45b1953] | 39 |
|
---|
[ecd7945d] | 40 | <sect2>
|
---|
[a7e0ec7] | 41 | <title>Building Software as an Unprivileged (non-root) User</title>
|
---|
[ecd7945d] | 42 |
|
---|
| 43 | <para>The golden rule of Unix System Administration is to use your
|
---|
[cbadf6b] | 44 | superpowers only when neccessary. Hence, BLFS recommends that you
|
---|
| 45 | build software as an unprivileged user and only become the
|
---|
| 46 | <systemitem class='username'>root</systemitem> user when installing the
|
---|
| 47 | software. This philosophy is followed in all the packages in this book.
|
---|
| 48 | Unless otherwise specified, all instructions should be executed as an
|
---|
| 49 | unprivileged user. The book will advise you on instructions that need
|
---|
| 50 | <systemitem class='username'>root</systemitem> privileges.</para>
|
---|
[ecd7945d] | 51 |
|
---|
| 52 | </sect2>
|
---|
| 53 |
|
---|
[b92d4b3] | 54 | <sect2>
|
---|
| 55 | <title>Unpacking the Software</title>
|
---|
[f45b1953] | 56 |
|
---|
[cbadf6b] | 57 | <para>If a file is in <filename class='extension'>.tar</filename> format
|
---|
| 58 | and compressed, it is unpacked by running one of the following
|
---|
| 59 | commands:</para>
|
---|
[f45b1953] | 60 |
|
---|
[cbadf6b] | 61 | <screen><userinput>tar -xvf filename.tar.gz
|
---|
| 62 | tar -xvf filename.tgz
|
---|
| 63 | tar -xvf filename.tar.Z
|
---|
| 64 | tar -xvf filename.tar.bz2</userinput></screen>
|
---|
| 65 |
|
---|
| 66 | <note>
|
---|
| 67 | <para>You may omit using the <option>v</option> parameter in the commands
|
---|
| 68 | shown above and below if you wish to suppress the verbose listing of all
|
---|
| 69 | the files in the archive as they are extracted. This can help speed up the
|
---|
| 70 | extraction as well as make any errors produced during the extraction
|
---|
| 71 | more obvious to you.</para>
|
---|
| 72 | </note>
|
---|
[b92d4b3] | 73 |
|
---|
| 74 | <para>You can also use a slightly different method:</para>
|
---|
[f45b1953] | 75 |
|
---|
[3ba3f58] | 76 | <screen><userinput>bzcat filename.tar.bz2 | tar -xv</userinput></screen>
|
---|
[f45b1953] | 77 |
|
---|
[b92d4b3] | 78 | <para>Finally, you sometimes need to be able to unpack patches which are
|
---|
[cbadf6b] | 79 | generally not in <filename class='extension'>.tar</filename> format. The
|
---|
| 80 | best way to do this is to copy the patch file to
|
---|
| 81 | <filename class='directory'>/usr/src</filename> and then run one of the
|
---|
| 82 | following commands depending on whether the file is a
|
---|
| 83 | <filename class='extension'>.gz</filename> or
|
---|
| 84 | <filename class='extension'>.bz2</filename> file:</para>
|
---|
[f45b1953] | 85 |
|
---|
[3ba3f58] | 86 | <screen><userinput>gunzip -v patchname.gz
|
---|
| 87 | bunzip2 -v patchname.bz2</userinput></screen>
|
---|
[f45b1953] | 88 |
|
---|
[b92d4b3] | 89 | </sect2>
|
---|
[f45b1953] | 90 |
|
---|
[b92d4b3] | 91 | <sect2>
|
---|
| 92 | <title>Verifying File Integrity Using 'md5sum'</title>
|
---|
[0c603671] | 93 |
|
---|
[b92d4b3] | 94 | <para>Generally, to verify that the downloaded file is genuine and complete,
|
---|
[cbadf6b] | 95 | many package maintainers also distribute md5sums of the files. To verify the
|
---|
| 96 | md5sum of the downloaded files, download both the file and the
|
---|
[b92d4b3] | 97 | corresponding md5sum file to the same directory (preferably from different
|
---|
[cbadf6b] | 98 | on-line locations), and (assuming <filename>file.md5sum</filename> is the
|
---|
| 99 | md5sum file downloaded) run the following command:</para>
|
---|
[0c603671] | 100 |
|
---|
[3ba3f58] | 101 | <screen><userinput>md5sum -c file.md5sum</userinput></screen>
|
---|
[0c603671] | 102 |
|
---|
[cbadf6b] | 103 | <para>If there are any errors, they will be reported. Note that the BLFS
|
---|
| 104 | book includes md5sums for all the source files also. To use the BLFS
|
---|
| 105 | supplied md5sums, you can create a <filename>file.md5sum</filename> (place
|
---|
| 106 | the md5sum data and the exact name of the downloaded file on the same
|
---|
| 107 | line of a file, separated by white space) and run the command shown above.
|
---|
| 108 | Alternately, simply run the command shown below and compare the output
|
---|
| 109 | to the md5sum data shown in the BLFS book.</para>
|
---|
| 110 |
|
---|
| 111 | <screen><userinput>md5sum <replaceable>[name_of_downloaded_file]</replaceable></userinput></screen>
|
---|
[0c603671] | 112 |
|
---|
[b92d4b3] | 113 | </sect2>
|
---|
[0c603671] | 114 |
|
---|
[b92d4b3] | 115 | <sect2>
|
---|
| 116 | <title>Creating Log Files During Installation</title>
|
---|
[0c603671] | 117 |
|
---|
[b92d4b3] | 118 | <para>For larger packages, it is convenient to create log files instead of
|
---|
[cbadf6b] | 119 | staring at the screen hoping to catch a particular error or warning. Log
|
---|
| 120 | files are also useful for debugging and keeping records. The following
|
---|
| 121 | command allows you to create an installation log. Replace
|
---|
| 122 | <replaceable>[command]</replaceable> with the command you intend to execute.</para>
|
---|
[0c603671] | 123 |
|
---|
[cbadf6b] | 124 | <screen><userinput>( <replaceable>[command]</replaceable> 2>&1 | tee compile.log && exit $PIPESTATUS )</userinput></screen>
|
---|
[0c603671] | 125 |
|
---|
[3ba3f58] | 126 | <para><option>2>&1</option> redirects error messages to the same
|
---|
| 127 | location as standard output. The <command>tee</command> command allows
|
---|
[b92d4b3] | 128 | viewing of the output while logging the results to a file. The parentheses
|
---|
| 129 | around the command run the entire command in a subshell and finally the
|
---|
[cbadf6b] | 130 | <command>exit $PIPESTATUS</command> command ensures the result of the
|
---|
| 131 | <replaceable>[command]</replaceable> is returned as the result and not the
|
---|
| 132 | result of the <command>tee</command> command.</para>
|
---|
[0c603671] | 133 |
|
---|
[b92d4b3] | 134 | </sect2>
|
---|
[0c603671] | 135 |
|
---|
[f45b1953] | 136 | </sect1>
|
---|