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
|
---|
37 | <filename>Makefile</filename>s and C code, but if in doubt, start from a
|
---|
38 | clean tree.</para>
|
---|
39 |
|
---|
40 | <sect2>
|
---|
41 | <title>Building Software as an Unprivileged (non-root) User</title>
|
---|
42 |
|
---|
43 | <para>The golden rule of Unix System Administration is to use your
|
---|
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>
|
---|
51 |
|
---|
52 | </sect2>
|
---|
53 |
|
---|
54 | <sect2>
|
---|
55 | <title>Unpacking the Software</title>
|
---|
56 |
|
---|
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>
|
---|
60 |
|
---|
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>
|
---|
73 |
|
---|
74 | <para>You can also use a slightly different method:</para>
|
---|
75 |
|
---|
76 | <screen><userinput>bzcat filename.tar.bz2 | tar -xv</userinput></screen>
|
---|
77 |
|
---|
78 | <para>Finally, you sometimes need to be able to unpack patches which are
|
---|
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>
|
---|
85 |
|
---|
86 | <screen><userinput>gunzip -v patchname.gz
|
---|
87 | bunzip2 -v patchname.bz2</userinput></screen>
|
---|
88 |
|
---|
89 | </sect2>
|
---|
90 |
|
---|
91 | <sect2>
|
---|
92 | <title>Verifying File Integrity Using 'md5sum'</title>
|
---|
93 |
|
---|
94 | <para>Generally, to verify that the downloaded file is genuine and complete,
|
---|
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
|
---|
97 | corresponding md5sum file to the same directory (preferably from different
|
---|
98 | on-line locations), and (assuming <filename>file.md5sum</filename> is the
|
---|
99 | md5sum file downloaded) run the following command:</para>
|
---|
100 |
|
---|
101 | <screen><userinput>md5sum -c file.md5sum</userinput></screen>
|
---|
102 |
|
---|
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>
|
---|
112 |
|
---|
113 | </sect2>
|
---|
114 |
|
---|
115 | <sect2>
|
---|
116 | <title>Creating Log Files During Installation</title>
|
---|
117 |
|
---|
118 | <para>For larger packages, it is convenient to create log files instead of
|
---|
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>
|
---|
123 |
|
---|
124 | <screen><userinput>( <replaceable>[command]</replaceable> 2>&1 | tee compile.log && exit $PIPESTATUS )</userinput></screen>
|
---|
125 |
|
---|
126 | <para><option>2>&1</option> redirects error messages to the same
|
---|
127 | location as standard output. The <command>tee</command> command allows
|
---|
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
|
---|
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>
|
---|
133 |
|
---|
134 | </sect2>
|
---|
135 |
|
---|
136 | </sect1>
|
---|