1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 | ]>
|
---|
7 |
|
---|
8 | <sect1 id="intro-important-unpacking">
|
---|
9 | <?dbhtml filename="unpacking.html"?>
|
---|
10 |
|
---|
11 | <sect1info>
|
---|
12 | <othername>$LastChangedBy$</othername>
|
---|
13 | <date>$Date$</date>
|
---|
14 | </sect1info>
|
---|
15 |
|
---|
16 | <title>Notes on Building Software</title>
|
---|
17 |
|
---|
18 | <para>Those people who have built an LFS system will be aware
|
---|
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>
|
---|
22 |
|
---|
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
|
---|
25 | available via http. These are referenced as needed in the installation
|
---|
26 | instructions.</para>
|
---|
27 |
|
---|
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>
|
---|
31 |
|
---|
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
|
---|
36 | doesn't apply if you're an advanced user used to hacking Makefiles and C
|
---|
37 | code, but if in doubt, start from a clean tree.</para>
|
---|
38 |
|
---|
39 | <sect2>
|
---|
40 | <title>Building Software as an Unprivileged (non-root) User</title>
|
---|
41 |
|
---|
42 | <para>The golden rule of Unix System Administration is to use your
|
---|
43 | superpowers only when neccessary. Hence, BLFS recommends that you
|
---|
44 | build software as an unprivileged user and only "become root"
|
---|
45 | when installing the software. This philosophy is followed in all the
|
---|
46 | packages in this book. Unless otherwise specified, all instructions
|
---|
47 | should be executed as an unprivileged user. The book will advise you
|
---|
48 | on instructions that need root privileges.</para>
|
---|
49 |
|
---|
50 | </sect2>
|
---|
51 |
|
---|
52 | <sect2>
|
---|
53 | <title>Unpacking the Software</title>
|
---|
54 |
|
---|
55 | <para>If a file is tar'ed and compressed, it is unpacked by running one of
|
---|
56 | the following commands:</para>
|
---|
57 |
|
---|
58 | <screen><userinput>tar -xvzf filename.tar.gz
|
---|
59 | tar -xvzf filename.tgz
|
---|
60 | tar -xvzf filename.tar.Z
|
---|
61 | tar -xvjf filename.tar.bz2</userinput></screen>
|
---|
62 |
|
---|
63 | <para>You can also use a slightly different method:</para>
|
---|
64 |
|
---|
65 | <screen><userinput>bzcat filename.tar.bz2 | tar -xv</userinput></screen>
|
---|
66 |
|
---|
67 | <para>Finally, you sometimes need to be able to unpack patches which are
|
---|
68 | generally not tar'ed. The best way to do this is to copy the patch file to
|
---|
69 | <filename>/usr/src</filename> and then to run one of the following commands
|
---|
70 | depending on whether the file is <filename>.gz</filename> or
|
---|
71 | <filename>.bz2</filename>:</para>
|
---|
72 |
|
---|
73 | <screen><userinput>gunzip -v patchname.gz
|
---|
74 | bunzip2 -v patchname.bz2</userinput></screen>
|
---|
75 |
|
---|
76 | </sect2>
|
---|
77 |
|
---|
78 | <sect2>
|
---|
79 | <title>Verifying File Integrity Using 'md5sum'</title>
|
---|
80 |
|
---|
81 | <para>Generally, to verify that the downloaded file is genuine and complete,
|
---|
82 | most package maintainers also distribute md5sums of the files.
|
---|
83 | To verify the md5sum of the downloaded files, download both the file and the
|
---|
84 | corresponding md5sum file to the same directory (preferably from different
|
---|
85 | on-line locations), and (assuming file.md5sum is the md5sum file downloaded)
|
---|
86 | run the following command:</para>
|
---|
87 |
|
---|
88 | <screen><userinput>md5sum -c file.md5sum</userinput></screen>
|
---|
89 |
|
---|
90 | <para>If there are any errors, they will be reported.</para>
|
---|
91 |
|
---|
92 | </sect2>
|
---|
93 |
|
---|
94 | <sect2>
|
---|
95 | <title>Creating Log Files During Installation</title>
|
---|
96 |
|
---|
97 | <para>For larger packages, it is convenient to create log files instead of
|
---|
98 | staring at the screen hoping to catch a particular error or warning. Log files
|
---|
99 | are also useful for debugging and keeping records. The following command
|
---|
100 | allows you to create an installation log. Replace <command> with the
|
---|
101 | command you intend to execute.</para>
|
---|
102 |
|
---|
103 | <screen><userinput>( <command> 2>&1 | tee compile.log && exit $PIPESTATUS )</userinput></screen>
|
---|
104 |
|
---|
105 | <para><option>2>&1</option> redirects error messages to the same
|
---|
106 | location as standard output. The <command>tee</command> command allows
|
---|
107 | viewing of the output while logging the results to a file. The parentheses
|
---|
108 | around the command run the entire command in a subshell and finally the
|
---|
109 | <command>exit $PIPESTATUS</command> ensures the result of the
|
---|
110 | <command> is returned as the result and not the result of the
|
---|
111 | <command>tee</command> command.</para>
|
---|
112 |
|
---|
113 | </sect2>
|
---|
114 |
|
---|
115 | </sect1>
|
---|