/[gentoo]/xml/htdocs/doc/en/handbook/2006.1/hb-install-stage.xml
Gentoo

Contents of /xml/htdocs/doc/en/handbook/2006.1/hb-install-stage.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download) (as text)
Fri Mar 30 12:01:19 2007 UTC (11 years, 6 months ago) by neysx
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +4 -4 lines
File MIME type: application/xml
#172782 Grammar fix, no content change

1 <?xml version='1.0' encoding='UTF-8'?>
2 <!DOCTYPE sections SYSTEM "/dtd/book.dtd">
3
4 <!-- The content of this document is licensed under the CC-BY-SA license -->
5 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
6
7 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/2006.1/hb-install-stage.xml,v 1.2 2006/10/31 23:18:07 nightmorph Exp $ -->
8
9 <sections>
10
11 <version>7.1</version>
12 <date>2006-10-31</date>
13
14 <section>
15 <title>Installing a Stage Tarball</title>
16 <subsection>
17 <title>Setting the Date/Time Right</title>
18 <body>
19
20 <p>
21 Before you continue you need to check your date/time and update it. A
22 misconfigured clock may lead to strange results in the future!
23 </p>
24
25 <p>
26 To verify the current date/time, run <c>date</c>:
27 </p>
28
29 <pre caption="Verifying the date/time">
30 # <i>date</i>
31 Fri Mar 29 16:21:18 UTC 2005
32 </pre>
33
34 <p>
35 If the date/time displayed is wrong, update it using the <c>date
36 MMDDhhmmYYYY</c> syntax (<b>M</b>onth, <b>D</b>ay, <b>h</b>our, <b>m</b>inute
37 and <b>Y</b>ear). At this stage, you should use UTC time. You will be able to
38 define your timezone later on. For instance, to set the date to March 29th,
39 16:21 in the year 2005:
40 </p>
41
42 <pre caption="Setting the UTC date/time">
43 # <i>date 032916212005</i>
44 </pre>
45
46 </body>
47 </subsection>
48 <subsection>
49 <title>Locating the Stage3 File</title>
50 <body>
51
52 <p>
53 If you have configured networking because you need to download a stage3 file for
54 your architecture, continue with <uri link="#download">Alternative: Using a
55 Stage3 from the Internet</uri>. Otherwise read <uri link="#available">Default:
56 Using a Stage3 from the Installation CD</uri>.
57 </p>
58
59 </body>
60 </subsection>
61 </section>
62 <section id="available">
63 <title>Default: Using a Stage from the Installation CD</title>
64 <subsection>
65 <title>Extracting the Stage Tarball</title>
66 <body>
67
68 <p>
69 The stages on the CD reside in the <path>/mnt/cdrom/stages</path> directory. To
70 see a listing of available stages, use <c>ls</c>:
71 </p>
72
73 <pre caption="List all available stages">
74 # <i>ls /mnt/cdrom/stages</i>
75 </pre>
76
77 <p>
78 If the system replies with an error, you may need to mount the CD-ROM first:
79 </p>
80
81 <pre caption="Mounting the CD-ROM">
82 # <i>ls /mnt/cdrom/stages</i>
83 ls: /mnt/cdrom/stages: No such file or directory
84 # <i>mount /dev/cdroms/cdrom0 /mnt/cdrom</i>
85 # <i>ls /mnt/cdrom/stages</i>
86 </pre>
87
88 <p>
89 Now go into your Gentoo mountpoint (usually <path>/mnt/gentoo</path>):
90 </p>
91
92 <pre caption="Changing directory to /mnt/gentoo">
93 # <i>cd /mnt/gentoo</i>
94 </pre>
95
96 <p>
97 We will now extract the stage tarball of your choice. We will do this with the
98 <c>tar</c> tool. Make sure you use the same options (<c>xvjpf</c>)! The
99 <c>x</c> stands for <e>Extract</e>, the <c>v</c> for <e>Verbose</e> to see what
100 happens during the extraction process (this one is optional), the <c>j</c> for
101 <e>Decompress with bzip2</e>, the <c>p</c> for <e>Preserve permissions</e> and
102 the <c>f</c> to denote that we want to extract a file, not standard input. In
103 the next example, we extract the stage tarball
104 <path>stage3-&lt;subarch&gt;-2006.1.tar.bz2</path>. Be sure to substitute
105 the tarball filename with your stage.
106 </p>
107
108 <pre caption="Extracting the stage tarball">
109 # <i>tar xvjpf /mnt/cdrom/stages/stage3-&lt;subarch&gt;-2006.1.tar.bz2</i>
110 </pre>
111
112 <p>
113 Now that the stage is installed, continue with <uri
114 link="#installing_portage">Installing Portage</uri>.
115 </p>
116
117 </body>
118 </subsection>
119 </section>
120 <section id="download">
121 <title>Alternative: Using a Stage from the Internet</title>
122 <subsection>
123 <title>Downloading the Stage Tarball</title>
124 <body>
125
126 <p>
127 Go to the Gentoo mountpoint at which you mounted your filesystems
128 (most likely <path>/mnt/gentoo</path>):
129 </p>
130
131 <pre caption="Going to the Gentoo mountpoint">
132 # <i>cd /mnt/gentoo</i>
133 </pre>
134
135 <p>
136 Depending on your installation medium, you have a couple of tools available to
137 download a stage. If you have <c>links</c> available, then you can immediately
138 surf to <uri link="/main/en/mirrors.xml">the Gentoo mirrorlist</uri> and
139 choose a mirror close to you.
140 </p>
141
142 <p>
143 If you don't have <c>links</c> available you should have <c>lynx</c> at your
144 disposal. If you need to go through a proxy, export the <c>http_proxy</c> and
145 <c>ftp_proxy</c> variables:
146 </p>
147
148 <pre caption="Setting proxy information for lynx">
149 # <i>export http_proxy="http://proxy.server.com:port"</i>
150 # <i>export ftp_proxy="http://proxy.server.com:port"</i>
151 </pre>
152
153 <p>
154 We will now assume that you have <c>links</c> at your disposal.
155 </p>
156
157 <p>
158 Pick the <path>releases/</path> directory, followed by your architecture (for
159 instance <path>x86/</path>) and the Gentoo version (<path>2006.1/</path>) to
160 finish up with the <path>stages/</path> directory. There you should see all
161 available stage files for your architecture (they might be stored within
162 subdirectories named to the individual subarchitectures). Select one and press
163 <c>D</c> to download. When you're finished, press <c>Q</c> to quit the browser.
164 </p>
165
166 <pre caption="Surfing to the mirror listing with links">
167 # <i>links http://www.gentoo.org/main/en/mirrors.xml</i>
168
169 <comment>(If you need proxy support with links:)</comment>
170 # <i>links -http-proxy proxy.server.com:8080 http://www.gentoo.org/main/en/mirrors.xml</i>
171 </pre>
172
173 <p>
174 Make sure you download a stage3 tarball - installations using a stage1 or stage2
175 tarball are not supported anymore.
176 </p>
177
178 <p>
179 If you want to check the integrity of the downloaded stage tarball, use
180 <c>md5sum</c> and compare the output with the MD5 checksum provided on the
181 mirror. For instance, to check the validity of the x86 stage tarball:
182 </p>
183
184 <pre caption="Example checking integrity of a stage tarball">
185 # <i>md5sum -c stage3-x86-2006.1.tar.bz2.DIGESTS</i>
186 stage3-x86-2006.1.tar.bz2: OK
187 </pre>
188
189 </body>
190 </subsection>
191 <subsection>
192 <title>Unpacking the Stage Tarball</title>
193 <body>
194
195 <p>
196 Now unpack your downloaded stage onto your system. We use <c>tar</c> to proceed
197 as it is the easiest method:
198 </p>
199
200 <pre caption="Unpacking the stage">
201 # <i>tar xvjpf stage3-*.tar.bz2</i>
202 </pre>
203
204 <p>
205 Make sure that you use the same options (<c>xvjpf</c>). The <c>x</c> stands
206 for <e>Extract</e>, the <c>v</c> for <e>Verbose</e> to see what happens during
207 the extraction process (this one is optional), the <c>j</c> for <e>Decompress
208 with bzip2</e>, the <c>p</c> for <e>Preserve permissions</e> and the <c>f</c>
209 to denote that we want to extract a file, not standard input.
210 </p>
211
212 <p>
213 Now that the stage is installed, continue with <uri
214 link="#installing_portage">Installing Portage</uri>.
215 </p>
216
217 </body>
218 </subsection>
219 </section>
220 <section id="installing_portage">
221 <title>Installing Portage</title>
222 <subsection>
223 <title>Unpacking a Portage Snapshot</title>
224 <body>
225
226 <p>
227 You now have to install a Portage snapshot, a collection of files that inform
228 Portage what software titles you can install, which profiles are available, etc.
229 </p>
230
231 </body>
232 </subsection>
233 <subsection id="installing_from_InstallCD">
234 <title>Unpack the Snapshot from the Installation CD</title>
235 <body>
236
237 <p>
238 To install the snapshot, take a look inside <path>/mnt/cdrom/snapshots/</path>
239 to see what snapshot is available:
240 </p>
241
242 <pre caption="Checking the /mnt/cdrom/snapshots content">
243 # <i>ls /mnt/cdrom/snapshots</i>
244 </pre>
245
246 <p>
247 Now extract the snapshot using the following construct. Again, make sure you
248 use the correct options with <c>tar</c>. Also, the <c>-C</c> is with a capital
249 <c>C</c>, not <c>c</c>. In the next example we use
250 <path>portage-&lt;date&gt;.tar.bz2</path> as the snapshot filename. Be sure to
251 substitute with the name of the snapshot that is on your Installation CD.
252 </p>
253
254 <pre caption="Extracting a Portage snapshot">
255 # <i>tar xvjf /mnt/cdrom/snapshots/portage-&lt;date&gt;.tar.bz2 -C /mnt/gentoo/usr</i>
256 </pre>
257
258 </body>
259 </subsection>
260 <subsection id="copysources">
261 <title>Copy Source Code Archives</title>
262 <body>
263
264 <p>
265 You also need to copy over all source code from the Universal Installation CD.
266 </p>
267
268 <pre caption="Copy over source code">
269 # <i>mkdir /mnt/gentoo/usr/portage/distfiles</i>
270 # <i>cp /mnt/cdrom/distfiles/* /mnt/gentoo/usr/portage/distfiles/</i>
271 </pre>
272
273 </body>
274 </subsection>
275 </section>
276 <section id="compile_options">
277 <title>Configuring the Compile Options</title>
278 <subsection>
279 <title>Introduction</title>
280 <body>
281
282 <p>
283 To optimize Gentoo, you can set a couple of variables which impact Portage
284 behaviour. All those variables can be set as environment variables (using
285 <c>export</c>) but that isn't permanent. To keep your settings, Portage provides
286 you with <path>/etc/make.conf</path>, a configuration file for Portage. It is
287 this file we will edit now.
288 </p>
289
290 <note>
291 A commented listing of all possible variables can be found in
292 <path>/mnt/gentoo/etc/make.conf.example</path>. For a successful Gentoo
293 installation you'll only need to set the variables which are mentioned beneath.
294 </note>
295
296 <p>
297 Fire up your favorite editor (in this guide we use <c>nano</c>) so we can alter
298 the optimization variables we will discuss hereafter.
299 </p>
300
301 <pre caption="Opening /etc/make.conf">
302 # <i>nano -w /mnt/gentoo/etc/make.conf</i>
303 </pre>
304
305 <p>
306 As you probably noticed, the <path>make.conf.example</path> file is
307 structured in a generic way: commented lines start with "#", other lines define
308 variables using the <c>VARIABLE="content"</c> syntax. The <path>make.conf</path>
309 file uses the same syntax. Several of those variables are discussed next.
310 </p>
311
312 <warn>
313 Do not make any modifications to the USE variable if you are performing a stage3
314 with GRP installation. You can alter the USE variable after having installed the
315 packages you want. Gremlins are known to attack your system if you ignore this
316 warning!
317 </warn>
318
319 </body>
320 </subsection>
321 <subsection>
322 <title>CHOST</title>
323 <body>
324
325 <p>
326 The <c>CHOST</c> variable declares the target build host for your system. This
327 variable should already be set to the correct value. <brite>Do not edit
328 it</brite> as that might break your system. If the <c>CHOST</c> variable does
329 not look correct to you, you might be using the wrong stage3 tarball.
330 </p>
331
332 </body>
333 </subsection>
334 <subsection>
335 <title>CFLAGS and CXXFLAGS</title>
336 <body>
337
338 <p>
339 The <c>CFLAGS</c> and <c>CXXFLAGS</c> variables define the optimization flags
340 for the <c>gcc</c> C and C++ compiler respectively. Although we define those
341 generally here, you will only have maximum performance if you optimize these
342 flags for each program separately. The reason for this is because every program
343 is different.
344 </p>
345
346 <p>
347 In <path>make.conf</path> you should define the optimization flags you think
348 will make your system the most responsive <e>generally</e>. Don't place
349 experimental settings in this variable; too much optimization can make
350 programs behave bad (crash, or even worse, malfunction).
351 </p>
352
353 <p>
354 We cannot explain all possible optimization options here, but if you want to
355 investigate them all, read the <uri link="http://gcc.gnu.org/onlinedocs/">GNU
356 Online Manual(s)</uri> or the <c>gcc</c> info page (<c>info gcc</c> -- only
357 works on a working Linux system). For common optimizations and architecture
358 specific settings, please read <path>/etc/make.conf.example</path>. This
359 file also contains lots of examples and information; don't forget to read it
360 too.
361 </p>
362
363 <p>
364 As an example, on the x86 architecture, you will want to set the -march= flag
365 as shown below (for an Athlon XP machine):
366 </p>
367
368 <pre caption="The GCC march setting">
369 -march=athlon-xp
370 </pre>
371
372 <p>
373 A second one is the <c>-O</c> flag (that is a capital O, not a zero),
374 which specifies the <c>gcc</c> optimization
375 class flag. Possible classes are <c>s</c> (for size-optimized),
376 <c>0</c> (zero - for no optimizations), <c>1</c>, <c>2</c> or <c>3</c> for more
377 speed-optimization flags (every class has the same flags as the one before, plus
378 some extras). For instance, for a class-2 optimization:
379 </p>
380
381 <pre caption="The GCC O setting">
382 -O2
383 </pre>
384
385 <p>
386 Another popular optimization flag is <c>-pipe</c> (use pipes rather than
387 temporary files for communication between the various stages of compilation).
388 </p>
389
390 <p>
391 Using <c>-fomit-frame-pointer</c> (which doesn't keep the frame pointer in a
392 register for functions that don't need one) might have serious repercussions on
393 the debugging of applications.
394 </p>
395
396 <p>
397 When you define the <c>CFLAGS</c> and <c>CXXFLAGS</c>, you should combine
398 several optimization flags, like in the following example:
399 </p>
400
401 <pre caption="Defining the CFLAGS and CXXFLAGS variable">
402 CFLAGS="-march=athlon-xp -pipe -O2"
403 CXXFLAGS="${CFLAGS}" <comment># Use the same settings for both variables</comment>
404 </pre>
405
406 </body>
407 </subsection>
408 <subsection>
409 <title>MAKEOPTS</title>
410 <body>
411
412 <p>
413 With <c>MAKEOPTS</c> you define how many parallel compilations should occur when
414 you install a package. A good choice is the number of CPUs in your system plus
415 one, but this guideline isn't always perfect.
416 </p>
417
418 <pre caption="MAKEOPTS for a regular, 1-CPU system">
419 MAKEOPTS="-j2"
420 </pre>
421
422 </body>
423 </subsection>
424 <subsection>
425 <title>Ready, Set, Go!</title>
426 <body>
427
428 <p>
429 Update your <path>/mnt/gentoo/etc/make.conf</path> to your own preference and
430 save (<c>nano</c> users would hit <c>Ctrl-X</c>). You are now ready to continue
431 with <uri link="?part=1&amp;chap=6">Chrooting into the Gentoo Base System</uri>.
432 </p>
433
434 </body>
435 </subsection>
436 </section>
437 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20