1 | <sect1 id="intro-important-unpacking">
|
---|
2 | <?dbhtml filename="unpacking.html"?>
|
---|
3 | <title>Notes on downloading, unpacking and compiling software</title>
|
---|
4 |
|
---|
5 | <para>Those people who have built a <acronym>LFS</acronym> system will be aware
|
---|
6 | of the general principles of downloading and unpacking software. We will
|
---|
7 | however repeat some of that information here for those new to building
|
---|
8 | their own software.</para>
|
---|
9 |
|
---|
10 | <para>Each set of installation instructions contains a <acronym>URL</acronym>
|
---|
11 | from which you can download the package. We do however keep a selection of
|
---|
12 | patches available via http. These are referenced as needed in the
|
---|
13 | installation instructions.</para>
|
---|
14 |
|
---|
15 | <para>While you can keep the source <acronym>TAR</acronym> balls anywhere you like, we
|
---|
16 | assume that you have unpacked them and unzipped any required patches
|
---|
17 | into <filename>/usr/src</filename>.</para>
|
---|
18 |
|
---|
19 | <para>We can not emphasize strongly enough that you should start from a
|
---|
20 | <emphasis>clean source tree</emphasis> each time. This means that if
|
---|
21 | you have had an error, it's usually best to delete the source tree and
|
---|
22 | re-unpack it <emphasis>before</emphasis> trying again. This obviously
|
---|
23 | doesn't apply if you're an advanced user used to hacking Makefiles and C
|
---|
24 | code, but if in doubt, start from a clean tree.</para>
|
---|
25 |
|
---|
26 | <sect2>
|
---|
27 | <title>Unpacking the software</title>
|
---|
28 |
|
---|
29 | <para>If a file is tar'ed and gzip'ed, it is unpacked by running one of
|
---|
30 | the following two commands, depending on the filename:</para>
|
---|
31 |
|
---|
32 | <screen><command>tar -xvzf filename.tar.gz
|
---|
33 | tar -xvzf filename.tgz
|
---|
34 | tar -xvzf filename.tar.Z</command></screen>
|
---|
35 |
|
---|
36 | <para>If a file is tar'ed and bzip2'ed, it can usually be unpacked by
|
---|
37 | running:</para>
|
---|
38 |
|
---|
39 | <screen><command>tar -jxvf filename.tar.bz2</command></screen>
|
---|
40 |
|
---|
41 | <para>You can also use a slightly different method:</para>
|
---|
42 |
|
---|
43 | <screen><command>bzcat filename.tar.bz2 | tar -xv</command></screen>
|
---|
44 |
|
---|
45 | <para>Finally, you need to be able to unpack patches which are generally
|
---|
46 | not tar'ed. The best way to do this is to copy the patch file to
|
---|
47 | <filename>/usr/src</filename> and then to run one of the following
|
---|
48 | commands depending on whether the file is .gz or .bz2:</para>
|
---|
49 |
|
---|
50 | <screen><command>gunzip patchname.gz
|
---|
51 | bunzip2 patchname.bz2</command></screen>
|
---|
52 |
|
---|
53 | </sect2>
|
---|
54 |
|
---|
55 | <sect2>
|
---|
56 | <title>Verifying file integrity using md5sum</title>
|
---|
57 |
|
---|
58 | <para>Generally, to verify that the downloaded file is genuine and complete,
|
---|
59 | most package maintainers also distribute md5sums of the files.
|
---|
60 | To verify the md5sum of the downloaded files, download both the file and the
|
---|
61 | corresponding md5sum file to the same directory (preferably from different
|
---|
62 | on-line locations), and (assuming file.md5sum is the md5sum file downloaded)
|
---|
63 | run the following command:</para>
|
---|
64 |
|
---|
65 | <screen><command>md5sum -c file.md5sum</command></screen>
|
---|
66 |
|
---|
67 | <para>If there are any errors, they will be reported.</para>
|
---|
68 |
|
---|
69 | </sect2>
|
---|
70 |
|
---|
71 | <sect2>
|
---|
72 | <title>Creating Log files during installation</title>
|
---|
73 |
|
---|
74 | <para>For larger packages, it is convenient to create log files instead of
|
---|
75 | staring at the screen hoping to catch a particular error or warning. Log files
|
---|
76 | are also useful for debugging and keeping records. The following command
|
---|
77 | allows you to create a installation log. Replace <command> with the
|
---|
78 | command you intend to execute.</para>
|
---|
79 |
|
---|
80 | <screen><command>( <command> 2>&1 | tee compile.log && exit $PIPESTATUS )</command></screen>
|
---|
81 |
|
---|
82 | <para><parameter>2>&1</parameter> redirects error messages
|
---|
83 | to the same location as normal output. The <command>tee</command> command
|
---|
84 | allows viewing of the output while logging the results to a file. The parentheses
|
---|
85 | around the command run the entire command in a subshell and finally the
|
---|
86 | <command>exit $PIPESTATUS</command> ensures the result of the <command>
|
---|
87 | is returned as the result and not the result of the <command>tee</command> command.</para>
|
---|
88 |
|
---|
89 | </sect2>
|
---|
90 |
|
---|
91 | </sect1>
|
---|