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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.52 - (show annotations) (download) (as text)
Sat Jul 31 11:36:25 2004 UTC (13 years, 5 months ago) by swift
Branch: MAIN
Changes since 1.51: +11 -1 lines
File MIME type: application/xml
#53272 - Reload environment variables after altering the CHOST variable

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/1.0 -->
6
7 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-stage.xml,v 1.51 2004/07/29 16:27:23 swift Exp $ -->
8
9 <sections>
10 <section>
11 <title>Installing a Stage Tarball</title>
12 <subsection>
13 <title>Setting the Date/Time Right</title>
14 <body>
15
16 <p>
17 Before you continue you need to check your date/time and update it. A
18 misconfigured clock may lead to strange results in the future!
19 </p>
20
21 <p>
22 To verify the current date/time, run <c>date</c>:
23 </p>
24
25 <pre caption="Verifying the date/time">
26 # <i>date</i>
27 Sun Apr 25 16:21:18 CEST 2004
28 </pre>
29
30 <p>
31 If the date/time displayed is wrong, update it using the <c>date
32 MMDDhhmmYYYY</c> syntax (<b>M</b>onth, <b>D</b>ay, <b>h</b>our, <b>m</b>inute
33 and <b>Y</b>ear). For instance, to set the date to April 25th, 16:21 in the
34 year 2004:
35 </p>
36
37 <pre caption="Setting the date/time">
38 # <i>date 042516212004</i>
39 </pre>
40
41 </body>
42 </subsection>
43 <subsection>
44 <title>Making your Choice</title>
45 <body>
46
47 <p>
48 The next step you need to perform is to install the <e>stage</e> tarball of your
49 choice onto your system. You have the option of downloading the required tarball
50 from the Internet or, if you are booted from one of the Gentoo Universal
51 LiveCDs, copy it over from the CD itself.
52 </p>
53
54 <ul>
55 <li><uri link="#doc_chap2">Default: Using a Stage from the Internet</uri></li>
56 <li><uri link="#doc_chap3">Alternative: Using a Stage from the LiveCD</uri></li>
57 </ul>
58
59 </body>
60 </subsection>
61 </section>
62 <section>
63 <title>Default: Using a Stage from the Internet</title>
64 <subsection>
65 <title>Downloading the Stage Tarball</title>
66 <body>
67
68 <p>
69 Go to the Gentoo mountpoint at which you mounted your filesystems
70 (most likely <path>/mnt/gentoo</path>):
71 </p>
72
73 <pre caption="Going to the Gentoo mountpoint">
74 # <i>cd /mnt/gentoo</i>
75 </pre>
76
77 <p>
78 Depending on your installation medium, you have a couple of tools available to
79 download a stage. If you have <c>lynx</c> available, then you can immediately
80 surf to <uri link="/main/en/mirrors.xml">the Gentoo
81 mirrorlist</uri> and choose a mirror close to you. Then pick the
82 <path>releases/</path> directory, followed by your architecture (for instance
83 <path>x86/</path>) and the Gentoo version (<path>2004.2/</path>)
84 to finish up with the <path>stages/</path> directory. There you should see all
85 available stage files for your architecture. Select one and press <c>D</c> to
86 download. When you're finished, press <c>Q</c> to quit the browser.
87 </p>
88
89 <pre caption="Surfing to the mirror listing with lynx">
90 # <i>lynx http://www.gentoo.org/main/en/mirrors.xml</i>
91 </pre>
92
93 <p>
94 If you do not have <c>lynx</c>, you should have <c>links2</c> at your disposal.
95 <c>links2</c> is more powerful than <c>lynx</c>, but has some drawbacks. One of
96 them is that it doesn't listen to the proxy variables we have declared
97 previously. If you need to setup a proxy, use <c>links2 -http-proxy
98 proxy.server.com:8080</c>. From there on, you should follow the same steps as
99 with <c>lynx</c> as they are equivalent.
100 </p>
101
102 <pre caption="Surfing to the mirror listing with links2">
103 <comment>(Without proxy)</comment> # <i>links2 http://www.gentoo.org/main/en/mirrors.xml</i>
104 <comment>(With proxy)</comment> # <i>links2 -http-proxy proxy.server.com:8080 http://www.gentoo.org/main/en/mirrors.xml</i>
105 </pre>
106
107 <p>
108 If you want to check the integrity of the downloaded stage tarball, use
109 <c>md5sum</c> and compare the output with the MD5 checksum provided on the
110 mirror. For instance, to check the validity of the x86 stage tarball:
111 </p>
112
113 <pre caption="Example checking integrity of a stage tarball">
114 # <i>md5sum -c stage1-x86-2004.2.tar.bz2.md5</i>
115 stage1-x86-2004.2.tar.bz2: OK
116 </pre>
117
118 </body>
119 </subsection>
120 <subsection>
121 <title>Unpacking the Stage Tarball</title>
122 <body>
123
124 <p>
125 Now unpack your downloaded stage onto your system. We use GNU's <c>tar</c> to
126 proceed as it is the easiest method:
127 </p>
128
129 <pre caption="Unpacking the stage">
130 # <i>tar -xvjpf stage?-*.tar.bz2</i>
131 </pre>
132
133 <note>
134 You can ignore any "No such file or directory" warnings regarding ./proc. Also,
135 the message "Error exit delayed from previous errors" can be ignored as well.
136 </note>
137
138 <p>
139 Make sure that you use the same options (<c>-xvjpf</c>). The <c>x</c> stands for
140 <e>Extract</e>, the <c>v</c> for <e>Verbose</e> (okay, yes, this is optional),
141 the <c>j</c> for <e>Decompress with bzip2</e>, the <c>p</c> for <e>Preserve
142 permissions</e> and the <c>f</c> to denote that we want to extract a file, not
143 standard input.
144 </p>
145
146 <p>
147 Now that the stage is installed, continue with <uri
148 link="#installing_portage">Installing Portage</uri>.
149 </p>
150
151 </body>
152 </subsection>
153 </section>
154 <section>
155 <title>Alternative: Using a Stage from the LiveCD</title>
156 <subsection>
157 <title>Extracting the Stage Tarball</title>
158 <body>
159
160 <p>
161 The stages on the CD reside in the <path>/mnt/cdrom/stages</path> directory. To
162 see a listing of available stages, use <c>ls</c>:
163 </p>
164
165 <pre caption="List all available stages">
166 # <i>ls /mnt/cdrom/stages</i>
167 </pre>
168
169 <p>
170 If the system replies with an error, you may need to mount the CD-ROM first:
171 </p>
172
173 <pre caption="Mounting the CD-ROM">
174 # <i>ls /mnt/cdrom/stages</i>
175 ls: /mnt/cdrom/stages: No such file or directory
176 # <i>mount /dev/cdroms/cdrom0 /mnt/cdrom</i>
177 # <i>ls /mnt/cdrom/stages</i>
178 </pre>
179
180 <p>
181 Now go into your Gentoo mountpoint (usually <path>/mnt/gentoo</path>):
182 </p>
183
184 <pre caption="Changing directory to /mnt/gentoo">
185 # <i>cd /mnt/gentoo</i>
186 </pre>
187
188 <p>
189 We will now extract the stage tarball of your choice. We will do this with the
190 GNU <c>tar</c> tool. Make sure you use the same options (<c>-xvjpf</c>)! In the
191 next example, we extract the stage tarball
192 <path>stage3-&lt;subarch&gt;-2004.2.tar.bz2</path>.
193 Be sure to substitute the tarball filename with your stage.
194 </p>
195
196 <pre caption="Extracting the stage tarball">
197 # <i>tar -xvjpf /mnt/cdrom/stages/stage3-&lt;subarch&gt;-2004.2.tar.bz2</i>
198 </pre>
199
200 <note>
201 You can ignore any "No such file or directory" warnings regarding ./proc. Also,
202 the message "Error exit delayed from previous errors" can be ignored as well.
203 </note>
204
205 <p>
206 Now that the stage is installed, continue with <uri
207 link="#installing_portage">Installing Portage</uri>.
208 </p>
209
210 </body>
211 </subsection>
212 </section>
213 <section id="installing_portage">
214 <title>Installing Portage</title>
215 <subsection>
216 <title>Network or No Network?</title>
217 <body>
218
219 <p>
220 If you don't have a working network connection, you have to install a portage
221 snapshot provided by one of our LiveCDs. If you want to use prebuilt packages
222 later on to speed up the installation, you <e>must</e> use a portage snapshot
223 from the LiveCD. Other users will download a fully updated Portage tree using
224 <c>emerge</c> later on.
225 </p>
226
227 <p>
228 Continue with the appropriate part:
229 </p>
230
231 <ul>
232 <li>
233 <uri link="#installing_from_LiveCD">Installing a Portage Snapshot and
234 Source Code from LiveCD</uri> (for networkless installations or GRP
235 installations)
236 </li>
237 <li>
238 <uri link="#compile_options">Configuring the Compile Options</uri> (all
239 other installation methods)
240 </li>
241 </ul>
242
243 </body>
244 </subsection>
245 <subsection id="installing_from_LiveCD">
246 <title>Installing a Portage Snapshot and Source Code from LiveCD</title>
247 <body>
248
249 <p>
250 There is a Portage snapshot available on the Universal LiveCDs. Since you are
251 reading this, we can safely assume you are using such a LiveCD. To install this
252 snapshot, take a look inside <path>/mnt/cdrom/snapshots/</path> to see what
253 snapshot we have available:
254 </p>
255
256 <pre caption="Checking the /mnt/cdrom/snapshots content">
257 # <i>ls /mnt/cdrom/snapshots</i>
258 </pre>
259
260 <p>
261 Now extract the snapshot using the following construct. Again,
262 make sure you use the correct options to <c>tar</c>. Also, the <c>-C</c> is with
263 a capital <c>C</c>, not <c>c</c>. In the next example we use
264 <path>portage-20040710.tar.bz2</path> as the snapshot filename. Be sure to
265 substitute with your snapshot.
266 </p>
267
268 <pre caption="Extracting a Portage snapshot">
269 # <i>tar -xvjf /mnt/cdrom/snapshots/portage-20040710.tar.bz2 -C /mnt/gentoo/usr</i>
270 </pre>
271
272 <p>
273 You also need to copy over all source code from the CD:
274 </p>
275
276 <pre caption="Copy over source code">
277 # <i>mkdir /mnt/gentoo/usr/portage/distfiles</i>
278 # <i>cp /mnt/cdrom/distfiles/* /mnt/gentoo/usr/portage/distfiles/</i>
279 </pre>
280
281 <p>
282 Now that your Portage snapshot is installed, continue with <uri
283 link="#compile_options">Configuring the Compile Options</uri>.
284 </p>
285
286 </body>
287 </subsection>
288 </section>
289
290 <section id="compile_options">
291 <title>Configuring the Compile Options</title>
292 <subsection>
293 <title>Introduction</title>
294 <body>
295
296 <p>
297 To optimize Gentoo, you can set a couple of variables which impact Portage
298 behaviour. All those variables can be set as environment variables (using
299 <c>export</c>) but that isn't permanent. To keep your settings, Portage provides
300 you with <path>/etc/make.conf</path>, a configuration file for Portage. It is
301 this file we will edit now.
302 </p>
303
304 <note>
305 A commented listing of all possible variables can be found in
306 <path>/mnt/gentoo/etc/make.conf.example</path>. For a successful Gentoo
307 installation you'll only need to set the variables which are mentioned beneath.
308 </note>
309
310 <p>
311 Fire up your favorite editor (in this guide we use <c>nano</c>) so we can alter
312 the optimization variables we will discuss hereafter.
313 </p>
314
315 <pre caption="Opening /etc/make.conf">
316 # <i>nano -w /mnt/gentoo/etc/make.conf</i>
317 </pre>
318
319 <p>
320 As you probably notice now, the <path>make.conf.example</path> file is
321 structured in a generic way: commented lines start with "#", other lines define
322 variables using the <c>VARIABLE="content"</c> syntax. Several of those
323 variables are discussed next.
324 </p>
325
326 </body>
327 </subsection>
328 <subsection>
329 <title>CHOST</title>
330 <body>
331
332 <warn>
333 Although it might be tempting for non-stage1 users, they should <e>not</e>
334 change the <c>CHOST</c> setting in <path>make.conf</path>. Doing so might render
335 their system unusable. Again: only change this variable if you use a
336 <e>stage1</e> installation.
337 </warn>
338
339 <p>
340 The <c>CHOST</c> variable defines what architecture <c>gcc</c> has to
341 compile programs for. The possibilities are:
342 </p>
343
344 <table>
345 <tr>
346 <th>Architecture</th>
347 <th>Subarchitecture</th>
348 <th>CHOST Setting</th>
349 </tr>
350 <tr>
351 <ti>x86</ti>
352 <ti>i386</ti>
353 <ti>i386-pc-linux-gnu</ti>
354 </tr>
355 <tr>
356 <ti>x86</ti>
357 <ti>i486</ti>
358 <ti>i486-pc-linux-gnu</ti>
359 </tr>
360 <tr>
361 <ti>x86</ti>
362 <ti>i586</ti>
363 <ti>i586-pc-linux-gnu</ti>
364 </tr>
365 <tr>
366 <ti>x86</ti>
367 <ti>i686 and above (incl. athlon)</ti>
368 <ti>i686-pc-linux-gnu</ti>
369 </tr>
370 <tr>
371 <ti>alpha</ti>
372 <ti></ti>
373 <ti>alpha-unknown-linux-gnu</ti>
374 </tr>
375 <tr>
376 <ti>ppc</ti>
377 <ti></ti>
378 <ti>powerpc-unknown-linux-gnu</ti>
379 </tr>
380 <tr>
381 <ti>sparc</ti>
382 <ti></ti>
383 <ti>sparc-unknown-linux-gnu</ti>
384 </tr>
385 <tr>
386 <ti>hppa</ti>
387 <ti>(generic)</ti>
388 <ti>hppa-unknown-linux-gnu</ti>
389 </tr>
390 <tr>
391 <ti>hppa</ti>
392 <ti>pa7000</ti>
393 <ti>hppa1.1-unknown-linux-gnu</ti>
394 </tr>
395 <tr>
396 <ti>hppa</ti>
397 <ti>pa8000 and above</ti>
398 <ti>hppa2.0-unknown-linux-gnu</ti>
399 </tr>
400 <tr>
401 <ti>mips</ti>
402 <ti></ti>
403 <ti>mips-unknown-linux-gnu</ti>
404 </tr>
405 <tr>
406 <ti>amd64</ti>
407 <ti></ti>
408 <ti>x86_64-pc-linux-gnu</ti>
409 </tr>
410 </table>
411
412 <p>
413 If you have altered the CHOST variable you will need to reload the environment
414 variables:
415 </p>
416
417 <pre caption="Reloading the environment variables">
418 # <i>env-update</i>
419 # <i>source /etc/profile</i>
420 </pre>
421
422 </body>
423 </subsection>
424 <subsection>
425 <title>CFLAGS and CXXFLAGS</title>
426 <body>
427
428 <p>
429 The <c>CFLAGS</c> and <c>CXXFLAGS</c> variables define the optimization flags
430 for the <c>gcc</c> C and C++ compiler respectively. Although we define those
431 generally here, you will only have maximum performance if you optimize these
432 flags for each program separately. The reason for this is because every program
433 is different.
434 </p>
435
436 <p>
437 In <path>make.conf</path> you should define the optimization flags you think
438 will make your system the most responsive <e>generally</e>. Don't place
439 experimental settings in this variable; too much optimization can make
440 programs behave bad (crash, or even worse, malfunction).
441 </p>
442
443 <p>
444 We will not explain all possible optimization options. If you want to know
445 them all, read the <uri link="http://gcc.gnu.org/onlinedocs/">GNU
446 Online Manual(s)</uri> or the <c>gcc</c> info page (<c>info gcc</c> -- only
447 works on a working Linux system). The <path>make.conf.example</path> file
448 itself also contains lots of examples and information; don't forget to read it
449 too.
450 </p>
451
452 <p>
453 A first setting is the <c>-march=</c> flag, which specifies the name of the
454 target architecture. Possible options are described in the
455 <path>make.conf.example</path> file (as comments). For instance, for the x86
456 Athlon XP architecture:
457 </p>
458
459 <pre caption="The GCC march setting">
460 <comment># AMD64 users should not use athlon-xp</comment>
461 -march=athlon-xp
462 </pre>
463
464 <p>
465 A second one is the <c>-O</c> flag (that is a capital O, not a zero),
466 which specifies the <c>gcc</c> optimization
467 class flag. Possible classes are <c>s</c> (for size-optimized),
468 <c>0</c> (zero - for no optimizations), <c>1</c>, <c>2</c> or <c>3</c> for more
469 speed-optimization flags (every class has the same flags as the one before, plus
470 some extras). For instance, for a class-2 optimization:
471 </p>
472
473 <pre caption="The GCC O setting">
474 -O2
475 </pre>
476
477 <p>
478 Other popular optimization flags are <c>-pipe</c> (use pipes rather than
479 temporary files for communication between the various stages of compilation) and
480 <c>-fomit-frame-pointer</c> (which doesn't keep the frame pointer in a register
481 for functions that don't need one).
482 </p>
483
484 <p>
485 When you define the <c>CFLAGS</c> and <c>CXXFLAGS</c>, you should combine
486 several optimization flags, like in the following example:
487 </p>
488
489 <pre caption="Defining the CFLAGS and CXXFLAGS variable">
490 CFLAGS="-march=athlon-xp -pipe -O2" <comment># AMD64 users should not use athlon-xp</comment>
491 CXXFLAGS="${CFLAGS}" <comment># Use the same settings for both variables</comment>
492 </pre>
493
494 </body>
495 </subsection>
496 <subsection>
497 <title>MAKEOPTS</title>
498 <body>
499
500 <p>
501 With <c>MAKEOPTS</c> you define how many parallel compilations should occur when
502 you install a package. The suggested number is the number of CPUs in your system
503 plus one.
504 </p>
505
506 <pre caption="MAKEOPTS for a regular, 1-CPU system">
507 MAKEOPTS="-j2"
508 </pre>
509
510 </body>
511 </subsection>
512 <subsection>
513 <title>Ready, Set, Go!</title>
514 <body>
515
516 <p>
517 Update your <path>/mnt/gentoo/etc/make.conf</path> to your own will and save.
518 You are now ready to continue with <uri link="?part=1&amp;chap=6">Installing the
519 Gentoo Base System</uri>.
520 </p>
521
522 </body>
523 </subsection>
524 </section>
525 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20