/[gentoo]/xml/htdocs/doc/en/gentoo-x86-install.xml
Gentoo

Contents of /xml/htdocs/doc/en/gentoo-x86-install.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.148 - (show annotations) (download) (as text)
Wed Aug 6 22:39:03 2003 UTC (14 years, 3 months ago) by avenj
Branch: MAIN
Changes since 1.147: +2 -2 lines
File MIME type: application/xml
Cosmetic changes to genkernel instructions

1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
3 <guide link="/doc/en/gentoo-x86-install.xml">
4 <title>Gentoo Linux 1.4 Installation Instructions</title>
5 <author title="Chief Architect">
6 <mail link="drobbins@gentoo.org">Daniel Robbins</mail>
7 </author>
8 <author title="Author">Chris Houser</author>
9 <author title="Author">Jerry Alexandratos</author>
10 <author title="Ghost">
11 <mail link="g2boojum@gentoo.org">Grant Goodyear</mail>
12 </author>
13 <author title="Editor">
14 <mail link="zhen@gentoo.org">John P. Davis</mail>
15 </author>
16 <author title="Editor">
17 <mail link="Pierre-Henri.Jondot@wanadoo.fr">Pierre-Henri Jondot</mail>
18 </author>
19 <author title="Editor">
20 <mail link="stocke2@gentoo.org">Eric Stockbridge</mail>
21 </author>
22 <author title="Editor">
23 <mail link="rajiv@gentoo.org">Rajiv Manglani</mail>
24 </author>
25 <author title="Editor">
26 <mail link="seo@gentoo.org">Jungmin Seo</mail>
27 </author>
28 <author title="Editor">
29 <mail link="zhware@gentoo.org">Stoyan Zhekov</mail>
30 </author>
31 <author title="Editor">
32 <mail link="jhhudso@gentoo.org">Jared Hudson</mail>
33 </author>
34 <author title="Editor">
35 <mail link="">Colin Morey</mail>
36 </author>
37 <author title="Editor">
38 <mail link="peesh@gentoo.org">Jorge Paulo</mail>
39 </author>
40 <author title="Editor">
41 <mail link="carl@gentoo.org">Carl Anderson</mail>
42 </author>
43 <author title="Editor, Reviewer">
44 <mail link="swift@gentoo.org">Sven Vermeulen</mail>
45 </author>
46 <author title="Editor">
47 <mail link="avenj@gentoo.org">Jon Portnoy</mail>
48 </author>
49 <author title="Reviewer">
50 <mail link="gerrynjr@gentoo.org">Gerald J. Normandin Jr.</mail>
51 </author>
52 <author title="Reviewer">
53 <mail link="spyderous@gentoo.org">Donnie Berkholz</mail>
54 </author>
55 <abstract>These instructions step you through the process of installing Gentoo
56 Linux 1.4, release version (not _rc versions.) The Gentoo Linux installation process supports various installation
57 approaches, depending upon how much of the system you want to custom-build from
58 scratch.
59 </abstract>
60
61 <license/>
62
63 <version>2.6.4</version>
64 <date>6th of August 2003</date>
65 <chapter>
66 <title>About the Install</title>
67 <section>
68 <body>
69 <p>First, if you are new to this, welcome to Gentoo Linux! Gentoo
70 Linux can be installed in many different ways. Those who are looking
71 for a rapid install can use pre-built packages, while those who want
72 the ultimate in customizability can compile Gentoo Linux entirely
73 from the original source code. The method you choose is up to
74 you.</p>
75
76 <p>One significant change in relation to the official 1.4 release is
77 our new 2-CD installation set, which can be ordered from <uri
78 link="http://store.gentoo.org">The Gentoo Linux Store</uri>, in
79 addition to being available on our mirrors. We currently have 2-CD
80 installation sets for x86 (486 and above), i686 (Pentium Pro,
81 Pentium II, Athlon/Duron and above), Pentium III, Pentium 4, and Athlon XP.
82 To see what 2-CD set is right for you, read the detailed
83 descriptions of each product in the <uri
84 link="http://store.gentoo.org">store</uri>. The store descriptions
85 contain fairly comprehensive CPU compatibility information.</p>
86
87 <p>So, about the 2 CD set -- here's what's on each CD. The first
88 CD ("CD 1") is called "Live CD Installation," and is a bootable CD-ROM,
89 meaning that you can put "CD 1" in your drive and run Gentoo Linux
90 directly from the CD. You can then use this CD-based version of
91 Gentoo to install Gentoo Linux 1.4 to your hard disk. In addition
92 to containing a bootable Gentoo Linux environment, every CD 1
93 contains everything you need to install Gentoo Linux quickly, even
94 without a connection to the Internet. In addition, several
95 pre-compiled packages are also included on CD 1, such as the
96 ever-important XFree86 X server. If you have an ISO CD-ROM image
97 file for CD 1, its name will end in "-cd1.iso".</p>
98
99 <p>In contrast, the second CD ("CD 2") isn't bootable, and contains
100 lots of pre-built packages for your system. Included on this CD are
101 optimized versions of packages such as KDE, GNOME, OpenOffice,
102 Mozilla, Evolution, and others. CD 2 is <i>optional</i> and is
103 intended for those people who are interested in installing Gentoo
104 Linux very quickly. The packages included on CD 2 typically take
105 about 36 hours to compile from source on a typical modern
106 single-processor system. If you have an ISO CD-ROM image file for CD
107 2, its name will end in "-cd2.iso". </p>
108
109 <note>A complete Gentoo Linux 2-CD set contains the Gentoo Reference
110 Platform, which is a complete pre-built Gentoo Linux system including GNOME,
111 KDE, Mozilla, and OpenOffice. The Gentoo Reference Platform ("GRP")
112 was created to allow rapid Gentoo Linux installs
113 packages for those who need this capability. The "compile from
114 source" functionality, which is the cornerstone of Gentoo Linux,
115 will always be a fully-supported installation option as well. The
116 purpose of the GRP is to make Gentoo Linux more convenient for some
117 users, without impacting Gentoo's powerful "compile from source"
118 installation process in any way.</note>
119
120 <p>In addition to our 2-CD set, we also have a very small "basic"
121 Live CD that you can use to boot your system. Once your system has
122 booted, you can configure a connection to the Internet and then
123 install Gentoo over the network. The advantage of this "basic" CD is
124 that it is small, and thus the ISO CD-ROM image file can be
125 downloaded quickly. If you're an advanced user who wants to install
126 the most up-to-date version of Gentoo Linux available, and have a
127 fast network connection, then you may prefer this option. If you
128 have an ISO CD-ROM image file for our "basic" Live CD, its name will
129 end in "-basic.iso".</p>
130
131 <p>To use any Gentoo Linux CD-based installation method, you will
132 need to have a 486+ processor and ideally at least 64 Megabytes of
133 RAM. (Gentoo Linux has been successfully built with 64MB of RAM +
134 64MB of swap space, but the build process is awfully slow under
135 those conditions.)</p>
136
137 <p>Once you boot one of our Live CDs, you have even more options.
138 Gentoo Linux can be installed using one of three &quot;stage&quot;
139 tarball files. The one you choose depends on how much of the system
140 you want to compile yourself. The stage1 tarball is used when you
141 want to bootstrap and build the entire system from scratch. The
142 stage2 tarball is used for building the entire system from a
143 bootstrapped "semi-compiled" state. The stage3 tarball already
144 contains a basic Gentoo Linux system that has been built for
145 you. If you are interested in doing a "GRP" install, then the
146 stage3 tarball should be used.</p>
147
148 <p><b>If you're not doing a GRP install, should you start from a stage1, stage2, or
149 stage3 tarball?</b> Here is some information that should help you
150 make this decision.
151 Starting from a stage1 allows you to have total
152 control over the optimization settings and optional build-time
153 functionality that is initially enabled on your system. This makes
154 stage1 installs good for power users who know what they are doing.
155 It is also a great installation method for those who would like to
156 know more about the inner workings of Gentoo Linux.</p>
157
158 <p>
159 Stage2 installs allow you to skip the bootstrap process, and doing
160 this is fine if you are happy with the optimization settings that we
161 chose for your particular stage2 tarball. And choosing to go with a
162 stage3 allows for the fastest install of Gentoo Linux, but also
163 means that your base system will have the optimization settings that
164 we chose for you (which to be honest, are good settings and were
165 carefully chosen to enhance performance while maintaining
166 stability.) Since major releases of Gentoo Linux have stage3's
167 specifically optimized for various popular processors, starting
168 from a stage3 can offer the best of all worlds -- a fast install
169 and a system that is well-optimized.
170 <b>If you're installing Gentoo Linux for the
171 first time, consider using a stage3 tarball for
172 installation, or a stage3 with GRP.</b></p>
173
174 <note><b>Advanced users:</b> if you use a stage3 install, you should not
175 change the default CHOST setting in make.conf. If you need to make
176 such a change, you should start with a stage1 tarball and build up
177 your system with the desired CHOST setting. The CHOST setting
178 typically looks something like this:
179 <c>i686-pc-linux-gnu</c>.</note>
180
181 <impo>If you encounter a problem with any part of the install and wish to
182 report it as a bug, report it to <uri>http://bugs.gentoo.org</uri>. If the bug
183 needs to be sent upstream to the original software developers (eg the KDE team) the
184 <e>Gentoo Linux developers</e> will take care of that for you.
185 </impo>
186
187 <note>Another note: the installation instructions in the LiveCD may not
188 be as up-to-date as our Web documentation at
189 <uri>http://www.gentoo.org/doc/en/gentoo-x86-install.xml</uri>. Refer to
190 our Web documentation for the most up-to-date
191 installation instructions.
192 </note>
193
194
195
196 <p>Now, let us quickly review the install process. First, we will
197 download, burn CD(s),
198 and boot a LiveCD. After getting a root prompt, we will create partitions, create
199 our filesystems, and extract either a stage1, stage2 or stage3 tarball. If we
200 are using a stage1 or stage2 tarball, we will take the appropriate steps to get
201 our system to stage3. Once our system is at stage3, we can configure it
202 (customize configuration files, install a boot loader, etc), boot it and have a
203 fully-functional Gentoo Linux system. After your basic Gentoo Linux system
204 is running, you can optionally use "CD 2" of our 2-CD set and install any
205 number of pre-built packages such as KDE, GNOME, OpenOffice, Mozilla, or
206 others that you'd like on your system.
207 </p>
208 <p>Depending on what stage of the build
209 process you're starting from, here is what is required for installation: </p>
210 <table>
211 <tr>
212 <th>stage tarball</th>
213 <th>Internet access required</th>
214 <th>Media required</th>
215 <th>steps</th>
216 </tr>
217 <tr>
218 <ti>1</ti>
219 <ti>Yes</ti>
220 <ti>"basic" or "CD 1"</ti>
221 <ti>partition/filesystem setup, emerge sync, bootstrap, emerge system, final config</ti>
222 </tr>
223 <tr>
224 <ti>2</ti>
225 <ti>Yes</ti>
226 <ti>"basic" or "CD 1"</ti>
227 <ti>partition/filesystem setup, emerge sync, emerge system, final config</ti>
228 </tr>
229 <tr>
230 <ti>3</ti>
231 <ti>No if using "CD 1", Yes otherwise</ti>
232 <ti>"basic" or "CD 1"</ti>
233 <ti>partition/filesystem setup, emerge sync (not required if
234 using "CD 1"), final config</ti>
235 </tr>
236 <tr>
237 <ti>3+GRP</ti>
238 <ti>No</ti>
239 <ti>"CD 1", optionally "CD 2"</ti>
240 <ti>partition/filesystem setup, final config, install CD 1
241 pre-built packages (optional), reboot,
242 install extra pre-built packages like KDE and GNOME (if using
243 "CD 2").</ti>
244 </tr>
245 </table>
246 <note>Hardware ATA RAID users should read the section about
247 ATA RAID on the bottom of this document before proceeding.
248 </note>
249 </body>
250 </section>
251 </chapter>
252 <chapter>
253 <title>Booting</title>
254 <section>
255 <body>
256 <warn>Read this whole section before proceeding, especially the
257 available boot options. Ignoring this could lead to wrong
258 keyboard settings, unstarted pcmcia services etc.</warn>
259
260 <p>Start by booting your Live CD of choice. You should see a fancy
261 boot screen with the Gentoo Linux logo on it. At this screen, you
262 can hit Enter to begin the boot process, or boot the LiveCD with
263 custom boot options by specifying a kernel followed by boot options
264 and then hitting Enter. For example <c>gentoo nousb nohotplug</c>.
265 If you are installing Gentoo Linux on a system with more than one
266 processor ("SMP",) then you should type <c>smp</c> instead of
267 <c>gentoo</c> at the prompt. This will allow the LiveCD to see all
268 the processors in your system, not just the first one.</p>
269
270 <p>
271 Consult the following table for a partial list of available kernels and
272 options or press F2 and F3 to view the help screens.</p>
273
274 <table>
275 <tr>
276 <th>Available kernels</th>
277 <th>description</th>
278 </tr>
279
280 <tr><ti>gentoo</ti><ti>standard gentoo kernel (default)</ti></tr>
281 <tr><ti>nofb</ti><ti>framebuffer mode disabled</ti></tr>
282 <tr><ti>smp</ti><ti>loads a smp kernel in noframebuffer mode</ti></tr>
283 <tr><ti>acpi</ti><ti>enables acpi=on + loads acpi modules during init</ti></tr>
284 <tr><ti>memtest</ti><ti>boots the memory testing program</ti></tr>
285
286 </table>
287
288 <p>
289 <table>
290 <tr>
291 <th>Available boot options</th>
292 <th>description</th>
293 </tr>
294
295 <tr><ti>doataraid</ti>
296 <ti>loads ide raid modules from initrd</ti></tr>
297
298 <tr><ti>dofirewire</ti>
299 <ti>modprobes firewire modules in initrd (for firewire cdroms,etc)</ti></tr>
300
301 <tr><ti>dokeymap</ti>
302 <ti>enable keymap selection for non-us keyboard layouts</ti></tr>
303
304 <tr><ti>dopcmcia</ti>
305 <ti>starts pcmcia service</ti></tr>
306
307 <tr><ti>doscsi</ti>
308 <ti>scan for scsi devices (breaks some ethernet cards)</ti></tr>
309
310 <tr><ti>noapm</ti>
311 <ti>disables apm module load</ti></tr>
312
313 <tr><ti>nodetect</ti>
314 <ti>causes hwsetup/kudzu and hotplug not to run</ti></tr>
315
316 <tr><ti>nodhcp</ti>
317 <ti>dhcp does not automatically start if nic detected</ti></tr>
318
319 <tr><ti>nohotplug</ti>
320 <ti>disables loading hotplug service</ti></tr>
321
322 <tr><ti>noraid</ti>
323 <ti>disables loading of evms modules</ti></tr>
324
325 <tr><ti>nousb</ti>
326 <ti>disables usb module load from initrd, disables hotplug</ti></tr>
327
328 <tr><ti>ide=nodma</ti>
329 <ti>Force disabling of dma for malfunctioning ide devices</ti></tr>
330
331 <tr><ti>cdcache</ti>
332 <ti>Cache the entire runtime portion of cd in ram, This uses 40mb of RAM , but allows you to umount /mnt/cdrom and mount another cdrom.</ti></tr>
333
334 </table></p>
335
336
337 <p>Once you hit Enter, you will be greeted with an even fancier boot
338 screen and progress bar.</p>
339 <!--
340 <figure link="/images/install/livecd-1.4-boot.png" caption="The Gentoo
341 Linux Live CD booting" />
342 -->
343
344 <p>Once the boot process completes, you will be automatically logged in
345 to the "Live" Gentoo Linux as
346 &quot;<c>root</c>&quot;, the "super user." You should have a root (&quot;<c>#</c>&quot;) prompt
347 on the current console, and can also switch to other consoles by pressing
348 Alt-F2, Alt-F3 and Alt-F4. Get back to the one you started on by pressing
349 Alt-F1. </p>
350 <!--
351
352 <figure link="/images/install/livecd-1.4-con.png" caption="The Gentoo
353 Linux Live CD console" />
354 -->
355
356 <note><b>Advanced users:</b> When the Live CD boots, the Live CD root password is
357 set to a random string for security purposes. If you plan to start
358 <c>sshd</c> to allow remote logins to your Live CD, you should set the Live
359 CD root password now by typing <c>passwd</c> and following the prompts.
360 Otherwise, you will not know the proper password for logging into the Live
361 CD over the network. </note>
362
363 <p>You've probably also noticed that above your <c>#</c> prompt is a bunch of help text
364 that explains how to do things like configure your Linux networking and telling you where you can find
365 the Gentoo Linux stage tarballs and packages on your CD.
366 </p>
367 </body>
368 </section>
369 </chapter>
370 <chapter>
371 <title>Optional hardware configuration</title>
372 <section>
373 <body>
374 <p>When the Live CD boots, it tries to detect all your hardware
375 devices and loads the appropiate kernel modules to support your
376 hardware. In the vast majority of cases, it does a very good job.
377 However, in some cases, it may not auto-load the kernel modules
378 you need. If the PCI auto-detection missed some of your system's hardware, you
379 will have to load the appropriate kernel modules manually.
380 To view a list of all available network card modules, type <c>ls
381 /lib/modules/`uname -r`/kernel/drivers/net/*</c>. To load a particular module,
382 type:
383 </p>
384 <pre caption="PCI Modules Configuration">
385 # <c>modprobe pcnet32</c>
386 <comment>(replace pcnet32 with your NIC module)</comment>
387 </pre>
388 <p>Likewise, if you want to be able to access any SCSI hardware that wasn't detected
389 during the initial boot autodetection process, you will need to load the appropriate
390 modules from /lib/modules, again using <c>modprobe</c>:
391 </p>
392 <pre caption="Loading SCSI Modules">
393 # <c>modprobe aic7xxx</c>
394 <comment>(replace aic7xxx with your SCSI adapter module)</comment>
395 # <c>modprobe sd_mod</c>
396 <comment>(sd_mod is the module for SCSI disk support)</comment>
397 </pre>
398 <note>
399 Support for SCSI CD-ROMs and disks are built-in in the kernel.
400 </note>
401
402 <note><b>Advanced users:</b> The Gentoo LiveCD should have enabled DMA
403 on your disks so that disk transfers are as fast as possible, but if it did not,
404 <c>hdparm</c> can be used to set DMA on your drives as follows:
405 <pre caption="Setting DMA">
406 <comment>Replace hdX with your disk device.</comment>
407 # hdparm -d 1 /dev/hdX <comment>Enables DMA </comment>
408 # hdparm -d1 -A1 -m16 -u1 -a64 /dev/hdX
409 <comment>(Enables DMA and other safe performance-enhancing options)</comment>
410 # hdparm -X66 /dev/hdX
411 <comment>(Force-enables Ultra-DMA -- dangerous -- may cause some drives to mess up)</comment>
412 </pre>
413 </note>
414
415
416 </body>
417 </section>
418 </chapter>
419 <chapter>
420 <title>Optional Networking configuration</title>
421 <section>
422 <title>Maybe it just works?</title>
423 <body>
424 <p>If your system is plugged into an Ethernet network, it is very
425 likely that your networking configuration has already been
426 set up automatically for you. If so, you should be able to take advantage of the many included
427 network-aware commands on the LiveCD such as <c>ssh</c>, <c>scp</c>, <c>ping</c>, <c>irssi</c>, <c>wget</c> and <c>lynx</c>,
428 among others.</p>
429
430 <p>If networking has been configured for you, the <c>/sbin/ifconfig</c> command should
431 list some internet interfaces besides <c>lo</c>, such as <c>eth0</c>:
432 </p>
433 <pre caption="/sbin/ifconfig for a working network card">
434 eth0 Link encap:Ethernet HWaddr 00:50:BA:8F:61:7A
435 inet addr:192.168.0.2 Bcast:192.168.0.255 Mask:255.255.255.0
436 inet6 addr: fe80::50:ba8f:617a/10 Scope:Link
437 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
438 RX packets:1498792 errors:0 dropped:0 overruns:0 frame:0
439 TX packets:1284980 errors:0 dropped:0 overruns:0 carrier:0
440 collisions:1984 txqueuelen:100
441 RX bytes:485691215 (463.1 Mb) TX bytes:123951388 (118.2 Mb)
442 Interrupt:11
443 </pre>
444 <p>You may want to also try pinging your ISP's DNS server (found in <path>/etc/resolv.conf</path>),
445 and a Web site of choice, just to make sure that your packets are reaching the net, DNS name
446 resolution is working correctly, etc.
447 </p>
448 <pre caption="Further Network Testing">
449 # <c>ping -c 3 www.yahoo.com </c>
450 </pre>
451 <p>Are you able to use your network? If so, you can skip the rest of this section.</p>
452 </body>
453 </section>
454 <section>
455 <title> PPPoE configuration</title>
456 <body>
457 <p>Assuming you need PPPoE to connect to the internet, the LiveCD (any version) has
458 made things easy for you by including <c>rp-pppoe</c>. Use the provided <c>adsl-setup</c>
459 script to configure your connection. You will be prompted for the ethernet
460 device that is connected to your adsl modem, your username and password,
461 the IPs of your DNS servers, and if you need a basic firewall or not. </p>
462 <pre caption="Configuring PPPoE">
463 # <c> adsl-setup </c>
464 # <c> adsl-start </c>
465 </pre>
466 <p>If something goes wrong, double-check that you correctly typed
467 your username and password by looking at <path>/etc/ppp/pap-secrets</path> or
468 <path>/etc/ppp/chap-secrets</path>, and make sure you are using the right ethernet device. </p>
469 </body>
470 </section>
471 <section>
472 <title> Automatic Network Configuration </title>
473 <body>
474 <p>The simplest way to set up networking if it didn't get configured automatically is to run the <c>net-setup</c> script.</p>
475 <pre caption="Net-Setup Script">
476 # <c>net-setup eth0</c>
477 </pre>
478 <p>Of course, if you prefer, you may still set up networking manually. This is covered next.</p>
479 </body>
480 </section>
481 <section>
482 <title>Manual DHCP Configuration</title>
483 <body>
484 <p>Network configuration is simple with DHCP; If your ISP is not using
485 DHCP, skip down to the static configuration section below. </p>
486 <pre caption="Network configuration with DHCP">
487 # <c>dhcpcd eth0</c>
488 </pre>
489 <note>Some ISPs require you to provide a hostname. To do that,
490 add a <c>-h myhostname</c> flag to the dhcpcd command line above.
491 </note>
492 <p>If you receive <i>dhcpConfig</i> warnings, don't panic; the errors
493 are most likely cosmetic. Skip down to Network testing below.</p>
494 </body>
495 </section>
496 <section>
497 <title>Manual Static Configuration</title>
498 <body>
499 <p>We need to setup just enough networking so that we can download
500 sources for the system build, as well as the required localhost interface. The needed information is explained in the next table.</p>
501
502 <table>
503 <tr><th>Information</th><th>Description</th><th>Example value</th></tr>
504 <tr><ti>IP address</ti><ti>The IP address you want to assign to your network card</ti><ti>192.168.1.2</ti></tr>
505 <tr><ti>Broadcast address</ti><ti>The IP address which will broadcast the packets to all the hosts in the network.</ti><ti>192.168.1.255</ti></tr>
506 <tr><ti>Network mask</ti><ti>The mask which is used together with the IP address to see what part of the address is for network-identification and host-identification</ti><ti>255.255.255.0</ti></tr>
507 <tr><ti>Gateway</ti><ti>The IP address of the computer which will forward the packets that are not meant for the local network (most of the time the computer which shares the internet connection)</ti><ti>192.168.1.1</ti></tr>
508 </table>
509
510 <p>Type in the following commands, replacing
511 $IFACE with your network interface (typically <c>eth0</c>), $IPNUM
512 with your IP address, $BCAST with your broadcast address, and $NMASK
513 with your network mask. For the <c>route</c> command, replace
514 $GTWAY with your default gateway.
515 </p>
516 <pre caption="Static IP Network Configuration">
517 # <c>ifconfig $IFACE $IPNUM broadcast $BCAST netmask $NMASK</c>
518 # <c>/sbin/route add -net default gw $GTWAY netmask 0.0.0.0 metric 1 $IFACE</c>
519 </pre>
520 <p>Now it is time to create the <path>/etc/resolv.conf</path>
521 file so that name resolution (finding Web/FTP sites by name, rather
522 than just by IP address) will work. You can use <c>nano -w
523 /etc/resolv.conf</c> to create <path>/etc/resolv.conf</path>.
524 <c>nano</c> is a small and easy-to-use editor.</p>
525 <p>Here is a template to follow for creating your /etc/resolv.conf file: </p>
526 <pre caption="/etc/resolv.conf template">
527 domain mydomain.com
528 nameserver 10.0.0.1
529 nameserver 10.0.0.2
530 </pre>
531 <p>Replace <c>10.0.0.1</c> and <c>10.0.0.2</c> with the IP addresses of your
532 primary and secondary DNS servers respectively.</p>
533 </body>
534 </section>
535 <section>
536 <title>Proxy Configuration</title>
537 <body>
538 <p>If you are behind a proxy, it could be necessary to configure your proxy before
539 you continue. We will export some variables to set up the proxy accordingly.
540 </p>
541 <pre caption="Setting a Proxy">
542 <codenote>If the proxy restricts HTTP traffic:</codenote>
543 # <c>export http_proxy=&quot;machine.company.com:1234&quot; </c>
544 <codenote>If the proxy restricts FTP traffic:</codenote>
545 # <c>export ftp_proxy=&quot;machine.company.com&quot; </c>
546 <codenote>If the proxy restricts RSYNC traffic:</codenote>
547 # <c>export RSYNC_PROXY=&quot;machine.company.com&quot; </c>
548 </pre>
549 </body>
550 </section>
551 <section>
552 <title>Networking is go!</title>
553 <body>
554 <p>Networking should now be configured and usable. You should be able to use the included
555 <c>ssh</c>, <c>scp</c>, <c>lynx</c>, <c>irssi</c> and <c>wget</c> commands to connect to other machines on your LAN or the Internet.</p>
556 </body>
557 </section>
558 </chapter>
559 <chapter>
560 <title>Setting your system's date and time</title>
561 <section>
562 <body>
563 <p>Now you need to set your system's date and time.
564 You can do this using the <c>date</c> command.</p>
565 <pre caption="Setting your system's date">
566 # <c>date</c>
567 Thu Feb 27 09:04:42 CST 2003
568 <comment>(If your date is wrong, set your date with this next command)</comment>
569 # <c>date 022709042003</c>
570 <comment>(date MMDDhhmmCCYY)</comment>
571 </pre>
572 </body>
573 </section>
574 </chapter>
575 <chapter>
576 <title>Filesystems, partitions and block devices</title>
577 <section>
578 <title>Introduction to block devices</title>
579 <body>
580 <p>
581 In this section, we'll take a good look at disk-oriented aspects of Gentoo Linux and Linux in general, including
582 Linux filesystems, partitions and block devices. Then, once you're familiar with the ins and outs of disks and
583 filesystems, you'll be guided through the process of setting up partitions and filesystems for your Gentoo Linux
584 install.
585 </p>
586 <p>
587 To begin, I'll introduce "block devices". The most famous block device is
588 probably the one that represents the first IDE drive in a Linux system:
589 </p>
590 <pre caption="/dev/hda, the block device representing the primary master IDE drive in your system">
591 /dev/hda
592 </pre>
593
594 <p>
595 If your system uses SCSI drives, then your first hard drive will be:
596 </p>
597
598 <pre caption="/dev/sda, the block device representing the first logical SCSI drive in your system">
599 /dev/sda
600 </pre>
601
602 <p>The block devices above represent an <i>abstract</i> interface to the disk.
603 User programs can use these block devices to interact with your disk without
604 worrying about whether your drivers are IDE, SCSI or something else. The
605 program can simply address the storage on the disk as a bunch of contiguous,
606 randomly-accessible 512-byte blocks. </p>
607 </body>
608 </section>
609 <section>
610 <title>Partitions and fdisk</title>
611 <body>
612 <p> Under Linux, we create filesystems by using a special command called
613 <c>mkfs</c> (or <c>mke2fs</c>, <c>mkreiserfs</c>, etc,) specifying a particular
614 block device as a command-line argument. </p>
615
616 <p> However, although it is theoretically possible to use a "whole disk" block
617 device (one that represents the <i>entire</i> disk) like <c>/dev/hda</c> or
618 <c>/dev/sda</c> to house a single filesystem, this is almost never done in
619 practice. Instead, full disk block devices are split up into smaller, more
620 manageable block devices called "partitions". Partitions are created using a
621 tool called <c>fdisk</c>, which is used to create and edit the partition table
622 that's stored on each disk. The partition table defines exactly how to split
623 up the full disk. </p>
624
625 <p> We can take a look at a disk's partition table by running <c>fdisk</c>,
626 specifying a block device that represents a full disk as an argument: </p>
627
628 <note>Alternate interfaces to the disk's partition table include <c>cfdisk</c>,
629 <c>parted</c> and <c>partimage</c>. We recommend <c>fdisk</c> because it's
630 more powerful and well known in the Unix/Linux world.</note>
631
632 <pre caption="Starting up fdisk">
633 # fdisk /dev/hda
634 </pre>
635 <p>
636 or
637 </p>
638 <pre caption="Starting up fdisk to look at the partition table on /dev/sda">
639 # fdisk /dev/sda
640 </pre>
641
642 <impo>
643 <b>Note that you should <i>not</i> save or make any changes to a disk's
644 partition table if any of its partitions contain filesystems that are in use or
645 contain important data. Doing so will generally cause data on the disk to be
646 lost.</b>
647 </impo>
648
649 <p>
650 Once in fdisk, you'll be greeted with a prompt that looks like this:
651 </p>
652
653 <pre caption="The fdisk prompt">
654 Command (m for help):
655 </pre>
656
657
658 <p>
659 Type <c>p</c> to display your disk's current partition configuration:
660 </p>
661
662 <pre caption="An example partition configuration">
663 Command (m for help): p
664
665 Disk /dev/hda: 240 heads, 63 sectors, 2184 cylinders
666 Units = cylinders of 15120 * 512 bytes
667
668 Device Boot Start End Blocks Id System
669 /dev/hda1 1 14 105808+ 83 Linux
670 /dev/hda2 15 49 264600 82 Linux swap
671 /dev/hda3 50 70 158760 83 Linux
672 /dev/hda4 71 2184 15981840 5 Extended
673 /dev/hda5 71 209 1050808+ 83 Linux
674 /dev/hda6 210 348 1050808+ 83 Linux
675 /dev/hda7 349 626 2101648+ 83 Linux
676 /dev/hda8 627 904 2101648+ 83 Linux
677 /dev/hda9 905 2184 9676768+ 83 Linux
678
679 Command (m for help):
680 </pre>
681
682 <p> This particular disk is configured to house seven Linux filesystems (each
683 with a corresponding partition listed as "Linux") as well as a swap partition
684 (listed as "Linux swap"). </p>
685
686 <p>
687 Notice the name of the corresponding partition block
688 devices on the left hand side, starting with <c>/dev/hda1</c> and going up to
689 <c>/dev/hda9</c>. In the early days of the PC, partitioning software only
690 allowed a maximum of four partitions (called "primary" partitions). This was
691 too limiting, so a workaround called an <i>extended partitioning</i> was
692 created. An extended partition is very similar to a primary partition, and
693 counts towards the primary partition limit of four. However, extended
694 partitions can hold any number of so-called <i>logical</i> partitions inside
695 them, providing an effective means of working around the four partition limit.
696 </p>
697
698 <p>
699 All partitions <c>hda5</c> and higher are logical partitions. The numbers 1
700 through 4 are reserved for primary or extended partitions. </p>
701
702 <p> So, In our example, <c>hda1</c> through <c>hda3</c> are primary partitions.
703 <c>hda4</c> is an extended partition that contains logical partitions
704 <c>hda5</c> through <c>hda9</c>. You would never actually
705 <i>use</i> <c>/dev/hda4</c> for storing any filesystems directly -- it simply
706 acts as a container for partitions <c>hda5</c> through <c>hda9</c>. </p>
707
708 <p> Also, notice that each partition has an "Id", also called a "partition
709 type". Whenever you create a new partition, you should ensure that the
710 partition type is set correctly. '83' is the correct partition type for
711 partitions that will be housing Linux filesystems, '82' is the correct
712 partition type for Linux swap partitions and 'fd' is the recommended partition
713 type for Software RAID partitions. You set the partition type using the
714 <c>t</c> option in <c>fdisk</c>. The Linux kernel uses the partition type
715 setting to auto-detect filesystems and swap devices on the disk at boot-time.
716 </p>
717 </body>
718 </section>
719 <section>
720 <title>Using fdisk to set up partitions</title>
721 <body>
722
723 <p>Now that you've had your introduction to the way disk partitioning is
724 done under Linux, it's time to walk you through the process of setting up disk
725 partitions for your Gentoo Linux installation. After we walk you through the
726 process of creating partitions on your disk, your partition configuration will
727 look like this: </p>
728
729 <pre caption="The partition configuration that you will have after following these steps">
730 Disk /dev/hda: 30.0 GB, 30005821440 bytes
731 240 heads, 63 sectors/track, 3876 cylinders
732 Units = cylinders of 15120 * 512 = 7741440 bytes
733
734 Device Boot Start End Blocks Id System
735 /dev/hda1 * 1 14 105808+ 83 Linux
736 /dev/hda2 15 81 506520 82 Linux swap
737 /dev/hda3 82 3876 28690200 83 Linux
738
739 Command (m for help):
740 </pre>
741
742 <p>In our suggested "newbie" partition configuration, we have three partitions.
743 The first one (<c>/dev/hda1</c>) at the beginning of the disk is a small
744 partition called a boot partition. The boot partition's purpose is to hold all
745 the critical data related to booting -- GRUB boot loader information (if you
746 will be using GRUB) as well as your Linux kernel(s). The boot partition gives
747 us a safe place to store everything related to booting Linux. During normal
748 day-to-day Gentoo Linux use, your boot partition should remain <e>unmounted</e>
749 for safety. If you are setting up a SCSI system, your boot partition will
750 likely end up being <c>/dev/sda1</c>.</p>
751
752 <p>It's recommended to have boot partitions (containing everything necessary for
753 the boot loader to work) at the beginning of the disk. While not necessarily
754 required anymore, it is a useful tradition from the days when the lilo boot
755 loader wasn't able to load kernels from filesystems that extended beyond disk
756 cylinder 1024.
757 </p>
758
759 <p>The second partition (<c>/dev/hda2</c>) is used to for swap space. The
760 kernel uses swap space as virtual memory when RAM becomes low. This partition,
761 relatively speaking, isn't very big either, typically somewhere around 512MB.
762 If you're setting up a SCSI system, this partition will likely end up
763 being called <c>/dev/sda2</c>. </p>
764
765 <p>The third partition (<c>/dev/hda3</c>) is quite large and takes up the rest
766 of the disk. This partition is called our "root" partition and will be used to
767 store your main filesystem that houses Gentoo Linux itself. On a SCSI system,
768 this partition would likely end up being <c>/dev/sda3</c>.</p>
769
770
771 <p>Before we partition the disk, here's a quick technical overview of the
772 suggested partition and filesystem configuration to use when installing Gentoo
773 Linux:</p>
774
775 <table>
776 <tr>
777 <th>Partition</th>
778 <th>Size</th>
779 <th>Type</th>
780 <th>example device</th>
781 </tr>
782 <tr>
783 <ti>boot partition, containing kernel(s) and boot information</ti>
784 <ti>32 Megabytes</ti>
785 <ti>ext2/3 highly recommended (easiest); if ReiserFS then mount with <c>-o notail</c>. If you will be using ext3 or ReiserFS, you must add the size of the journal to the partitionsize; in these cases 64 Megabytes is recommended</ti>
786 <ti>/dev/hda1</ti>
787 </tr>
788 <tr>
789 <ti>swap partition (no longer a 128 Megabyte limit, now 2GB)</ti>
790 <ti>Generally, configure a swap area that is between one and two times the size of the physical RAM
791 in your system.</ti>
792 <ti>Linux swap</ti>
793 <ti>/dev/hda2</ti>
794 </tr>
795 <tr>
796 <ti>root partition, containing main filesystem (/usr, /home, etc)</ti>
797 <ti>&gt;=1.5 Gigabytes</ti>
798 <ti>ReiserFS, ext3 recommended; ext2 ok</ti>
799 <ti>/dev/hda3</ti>
800 </tr>
801 </table>
802
803 <p>OK, now to create the partitions as in the example and table above. First,
804 enter fdisk by typing <c>fdisk /dev/hda</c> or <c>fdisk /dev/sda</c>,
805 depending on whether you're using IDE or SCSI. Then, type <c>p</c> to view your
806 current partition configuration. Is there anything on the disk that you need
807 to keep? If so, <b>stop now</b>. If you continue with these directions, <b>all
808 existing data on your disk will be erased.</b></p>
809
810 <impo>Following these instructions below will cause all prior data on your disk
811 to <b>be erased</b>! If there is anything on your drive, please be sure that it
812 is non-critical information that you don't mind losing. Also make sure that you
813 <b>have selected the correct drive</b> so that you don't mistakenly wipe data
814 from the wrong drive.</impo>
815
816 <p>Now, it's time to delete any existing partitions. To do this, type <c>d</c>
817 and hit Enter. You will then be prompted for the partition number you would like
818 to delete. To delete a pre-existing <c>/dev/hda1</c>, you would type:</p>
819
820 <pre caption="Deleting a partition">
821 Command (m for help): d
822 Partition number (1-4): 1
823 </pre>
824
825 <p>The partition has been scheduled for deletion. It will no longer show up if
826 you type <c>p</c>, but it will not be erased until your changes have been
827 saved. If you made a mistake and want to abort without saving your changes,
828 type <c>q</c> immediately and hit enter and your partition will not be
829 deleted.</p>
830 <p>Now, assuming that you do indeed want to wipe out all the partitions on your
831 system, repeatedly type <c>p</c> to print out a partition listing and then type
832 <c>d</c> and the number of the partition to delete it. Eventually, you'll end up
833 with a partition table with nothing in it:</p>
834
835 <pre caption="An empty partition table">
836 Disk /dev/hda: 30.0 GB, 30005821440 bytes
837 240 heads, 63 sectors/track, 3876 cylinders
838 Units = cylinders of 15120 * 512 = 7741440 bytes
839
840 Device Boot Start End Blocks Id System
841
842 Command (m for help):
843 </pre>
844
845 <p>Now that the in-memory partition table is empty, we're ready to create a
846 boot partition. To do this, type <c>n</c> to create a new partition, then
847 <c>p</c> to tell fdisk you want a primary partition. Then type <c>1</c> to
848 create the first primary partition. When prompted for the first cylinder, hit
849 enter. When prompted for the last cylinder, type <c>+32M</c> to create a
850 partition 32MB in size. You can see output from these steps below:</p>
851
852 <note>
853 Journaled filesystems require extra space for their journal. Default settings
854 require about 33 Megabytes of space. Therefore, if you are using a journaled
855 filesystem for <path>/boot</path>, you should type <c>+64M</c> when prompted
856 for the last cylinder.
857 </note>
858
859 <pre caption="Steps to create our boot partition">
860 Command (m for help): n
861 Command action
862 e extended
863 p primary partition (1-4)
864 p
865 Partition number (1-4): 1
866 First cylinder (1-3876, default 1):
867 Using default value 1
868 Last cylinder or +size or +sizeM or +sizeK (1-3876, default 3876): +32M
869 </pre>
870
871 <p>Now, when you type <c>p</c>, you should see the following partition printout:</p>
872
873 <pre caption="Our first partition has been created">
874 Command (m for help): p
875
876 Disk /dev/hda: 30.0 GB, 30005821440 bytes
877 240 heads, 63 sectors/track, 3876 cylinders
878 Units = cylinders of 15120 * 512 = 7741440 bytes
879
880 Device Boot Start End Blocks Id System
881 /dev/hda1 1 14 105808+ 83 Linux
882 </pre>
883
884 <p>Next, let's create the swap partition. To do this, type <c>n</c> to create a
885 new partition, then <c>p</c> to tell fdisk that you want a primary partition. Then
886 type <c>2</c> to create the second primary partition, <c>/dev/hda2</c> in our case.
887 When prompted for the first cylinder, hit enter. When prompted for the last cylinder,
888 type <c>+512M</c> to create a partition 512MB in size. After you've done this, type
889 <c>t</c> to set the partition type, <c>2</c> to select the partition you just
890 created, and then type in <c>82</c> to set the partition
891 type to "Linux Swap". After completing these steps, typing <c>p</c> should display
892 a partition table that looks similar to this:</p>
893
894 <pre caption="Our swap partition has been created">
895 Command (m for help): p
896
897 Disk /dev/hda: 30.0 GB, 30005821440 bytes
898 240 heads, 63 sectors/track, 3876 cylinders
899 Units = cylinders of 15120 * 512 = 7741440 bytes
900
901 Device Boot Start End Blocks Id System
902 /dev/hda1 1 14 105808+ 83 Linux
903 /dev/hda2 15 81 506520 82 Linux swap
904 </pre>
905
906 <p>Finally, let's create the root partition. To do this, type <c>n</c> to
907 create a new partition, then <c>p</c> to tell fdisk that you want a primary
908 partition. Then type <c>3</c> to create the third primary partition,
909 <c>/dev/hda3</c> in our case. When prompted for the first cylinder, hit enter.
910 When prompted for the last cylinder, hit enter to create a partition that takes
911 up the rest of the remaining space on your disk. After completing these steps,
912 typing <c>p</c> should display a partition table that looks similar to
913 this:</p>
914
915 <pre caption="Our root partition has been created">
916 Command (m for help): p
917
918 Disk /dev/hda: 30.0 GB, 30005821440 bytes
919 240 heads, 63 sectors/track, 3876 cylinders
920 Units = cylinders of 15120 * 512 = 7741440 bytes
921
922 Device Boot Start End Blocks Id System
923 /dev/hda1 1 14 105808+ 83 Linux
924 /dev/hda2 15 81 506520 82 Linux swap
925 /dev/hda3 82 3876 28690200 83 Linux
926 </pre>
927
928 <p>
929 Finally, we need to set the "bootable" flag on our boot partition and then write
930 our changes to disk. To tag <c>/dev/hda1</c> as a "bootable" partition, type
931 <c>a</c> at the menu and then type in <c>1</c> for the partition number. If you
932 type <c>p</c> now, you'll now see that <c>/dev/hda1</c> has a <c>*</c> in the "Boot"
933 column. Now, let's write our changes to disk. To do this, type <c>w</c> and hit
934 enter. Your disk partitions are now properly configured for a Gentoo Linux
935 install.
936 </p>
937
938 <note>If <c>fdisk</c> or <c>cfdisk</c> instruct you to do so, please reboot to
939 allow your system to detect the new partition configuration.</note>
940 </body>
941 </section>
942 <section>
943 <title>Creating filesystems</title>
944 <body>
945 <p>Now that the partitions have been created, it's time to set up filesystems on
946 the boot and root partitions so that they can be mounted and used to store data.
947 We will also configure the swap partition to serve as swap storage.
948 </p>
949
950 <p>Gentoo Linux supports a variety of different types of filesystems; each type has
951 its strengths and weaknesses and its own set of performance characteristics. Currently,
952 we support the creation of ext2, ext3, XFS, JFS and ReiserFS filesystems.</p>
953
954 <p>ext2 is the tried and true Linux filesystem but doesn't have metadata
955 journaling, which means that routine ext2 filesystem checks at startup time can
956 be quite time-consuming. There is now quite a selection of newer-generation
957 <i>journaled</i> filesystems that can be checked for consistency very quickly
958 and are thus generally preferred over their non-journaled counterparts.
959 Journaled filesystems prevent long delays when you boot your system and your
960 filesystem happens to be in an <i>inconsistent</i> state.</p>
961
962 <p>ext3 is the journaled version of the ext2 filesystem, providing metadata
963 journaling for fast recovery in addition to other enhanced journaling modes
964 like full data and ordered data journaling. ext3 is a very good and reliable
965 filesystem. It offers generally decent performance under most conditions.
966 Because it does not extensively employ the use of "trees" in its internal
967 design, it doesn't scale very well, meaning that it is not an ideal choice for
968 very large filesystems, or situations where you will be handling very large
969 files or large quantities of files in a single directory. But when used within
970 its design parameters, ext3 is an excellent filesystem.</p>
971
972 <p>ReiserFS is a B*-tree based filesystem that has very good overall
973 performance and greatly outperforms both ext2 and ext3 when dealing with small
974 files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales
975 extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is
976 now rock-solid and highly recommended for use both as a general-purpose
977 filesystem and for extreme cases such as the creation of large filesystems, the
978 use of many small files, very large files, and directories containing tens of
979 thousands of files. ReiserFS is the filesystem we recommend by default for all
980 non-boot partitions.</p>
981
982 <p>XFS is a filesystem with metadata journaling that is fully supported under
983 Gentoo Linux's <path>xfs-sources</path> kernel. It comes with a robust
984 feature-set and is optimized for scalability. We only recommend using this
985 filesystem on Linux systems with high-end SCSI and/or fibre channel storage and
986 a uninterruptible power supply. Because XFS aggressively caches in-transit data
987 in RAM, improperly designed programs (those that don't take proper precautions
988 when writing files to disk, and there are quite a few of them) can lose a good
989 deal of data if the system goes down unexpectedly.</p>
990
991 <p>JFS is IBM's high-performance journaling filesystem. It has recently
992 become production-ready, and there hasn't been a sufficient track record to
993 comment positively nor negatively on its general stability at this
994 point.</p>
995
996 <p>If you're looking for the most rugged journaling filesystem, use ext3. If
997 you're looking for a good general-purpose high-performance filesystem with
998 journaling support, use ReiserFS; both ext3 and ReiserFS are mature,
999 refined and recommended for general use.</p>
1000
1001 <!-- Corner case, confusing
1002 <p>But before creating filesystems, you may want to initialize the
1003 beginning of your partition using <c>dd</c> if you are using a pre-existing partition that has been used before.
1004 This is particularly helpful when you're going to create a new XFS filesystem on a partition that previously contained
1005 a ReiserFS filesystem. Doing this will ensure that your new filesystem
1006 will not be mis-identified by Linux's filesystem auto-detection code.
1007 This can be done as follows:
1008 </p>
1009 <pre caption="Initializing first 1024 bytes of your partition">
1010 # <c>dd if=/dev/zero of=/dev/hda3 bs=1k count=1</c>
1011 <comment>(Replace /dev/hda3 with the partition you wish to &quot;clean.&quot;)</comment>
1012 </pre>
1013 <warn>The command above will destroy all data from <path>/dev/hda3</path>.
1014 Be careful and check twice which partition you specify for zeroing.
1015 If you make a mistake it might result in a loss of data.
1016 </warn>
1017 -->
1018
1019 <p>Based on our example above, we will use the following commands to initialize
1020 all our partitions for use:</p>
1021
1022 <pre caption="Initializing our partitions (example)">
1023 # mke2fs -j /dev/hda1
1024 # mkswap /dev/hda2
1025 # mkreiserfs /dev/hda3
1026 </pre>
1027
1028 <p>We choose ext3 for our <c>/dev/hda1</c> boot partition because it is a
1029 robust journaling filesystem supported by all major boot loaders. We used
1030 <c>mkswap</c> for our <c>/dev/hda2 </c> swap partition -- the choice is obvious
1031 here. And for our main root filesystem on <c>/dev/hda3</c> we choose ReiserFS,
1032 since it is a solid journaling filesystem offering excellent performance. Now,
1033 go ahead and initialize your partitions.</p>
1034
1035 <p>For your reference, here are the various <c>mkfs</c>-like commands available
1036 during the installation process:</p>
1037
1038 <p><c>mkswap</c> is the command that is used to initialize swap partitions:</p>
1039 <pre caption="Initializing Swap">
1040 # <c>mkswap /dev/hda2</c>
1041 </pre>
1042 <p>You can use the <c>mke2fs</c> command to create ext2 filesystems:</p>
1043 <pre caption="Creating an ext2 Filesystem">
1044 # <i>mke2fs /dev/hda1</i>
1045 </pre>
1046 <p>If you would like to use ext3, you can create ext3 filesystems using
1047 <c>mke2fs -j</c>:</p>
1048 <pre caption="Creating an ext3 Filesystem">
1049 # <c>mke2fs -j /dev/hda3</c>
1050 </pre>
1051 <note>You can find out more about using ext3 under Linux 2.4 at
1052 <uri>http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html</uri>.</note>
1053 <p>To create ReiserFS filesystems, use the <c>mkreiserfs</c> command:</p>
1054 <pre caption="Creating a ReiserFS Filesystem">
1055 # <c>mkreiserfs /dev/hda3</c>
1056 </pre>
1057 <p>To create an XFS filesystem, use the <c>mkfs.xfs</c> command:</p>
1058 <pre caption="Creating a XFS Filesystem">
1059 # <c>mkfs.xfs /dev/hda3</c>
1060 </pre>
1061 <note>You may want to add a couple of additional flags to the
1062 <c>mkfs.xfs</c> command: <c>-d agcount=3 -l size=32m</c>.
1063 The <c>-d agcount=3</c> command will lower the number of allocation groups.
1064 XFS will insist on using at least 1 allocation group per 4 GB of your
1065 partition, so, for example, if you have a 20 GB partition you will need
1066 a minimum agcount of 5. The <c>-l size=32m</c> command increases the
1067 journal size to 32 Mb, increasing performance.</note>
1068
1069 <p>To create JFS filesystems, use the <c>mkfs.jfs</c> command:</p>
1070 <pre caption="Creating a JFS Filesystem">
1071 # <c>mkfs.jfs /dev/hda3</c>
1072 </pre>
1073 </body>
1074 </section>
1075 </chapter>
1076 <chapter>
1077 <title>Mount Partitions</title>
1078 <section>
1079 <body>
1080 <p>Now, we will activate our newly-initialized swap volume, since we may need the additional virtual memory that it
1081 provides later:
1082 </p>
1083 <pre caption="Activating Swap">
1084 # <c>swapon /dev/hda2</c>
1085 </pre>
1086
1087 <p>Next, we will create the <path>/mnt/gentoo</path> and <path>/mnt/gentoo/boot</path> mount points,
1088 and we will mount our filesystems to these mount points. Once our boot and root filesystems are
1089 mounted, any files we copy or create inside <path>/mnt/gentoo</path> will be placed on our new filesystems.
1090 Note that if you are setting up Gentoo
1091 Linux with separate <path>/usr</path> or <path>/var</path> filesystems, these would get mounted to
1092 <path>/mnt/gentoo/usr</path> and <path>/mnt/gentoo/var</path> respectively.
1093 </p>
1094
1095 <impo>If your <e>boot</e> partition (the one holding the kernel) is ReiserFS, be sure to mount it
1096 with the <c>-o notail</c> option so GRUB gets properly installed. Make sure
1097 that <c>notail</c> ends up in your new <path>/etc/fstab</path> boot partition entry, too.
1098 We will get to that in a bit. If you are going to use LILO with ReiserFS, then the <c>-o notail</c>
1099 is not needed. It's always safe to specify the <c>-o notail</c> option with ReiserFS if you're
1100 not sure what to do.
1101 </impo>
1102
1103 <pre caption="Creating Mount Points">
1104 # <c>mount /dev/hda3 /mnt/gentoo</c>
1105 # <c>mkdir /mnt/gentoo/boot</c>
1106 # <c>mount /dev/hda1 /mnt/gentoo/boot</c>
1107 </pre>
1108
1109 <impo>If you are having problems mounting your boot partition with ext2, try using
1110 <c>mount /dev/hXX /mnt/gentoo/boot -t ext2 </c> </impo>
1111 </body>
1112 </section>
1113 </chapter>
1114 <chapter>
1115 <title>Stage tarballs and chroot</title>
1116 <section>
1117 <title>Selecting the desired stage tarball</title>
1118 <body>
1119
1120 <p>
1121 Now, you need to decide which one you would like to use as a
1122 basis for the install if you haven't already.
1123 The stages on the Live CD are
1124 in <path>/mnt/cdrom/stages/</path>, and you can type <c>ls
1125 /mnt/cdrom/stages/</c>
1126 to see what's available on your CD.</p>
1127
1128 <p><b>GRP users</b> should use the <path>stage3-xx-yy.tar.bz2</path> tarball.</p>
1129
1130 <p>If you would like to perform an install using a stage tarball that is
1131 <i>not</i> on your CD (which will likely be the case if you're using our
1132 "basic" Live CD), this is still possible, but you'll need to download the
1133 stage you want using the following instructions. If you already have the stage
1134 tarball you want to use (which most users will have), then proceed to the
1135 "Extracting the stage tarball" section.</p>
1136
1137 <pre caption="Downloading Required Stages">
1138 # <c>cd /mnt/gentoo</c>
1139 <comment>Use lynx to get the URL for your tarball:</comment>
1140 # <c>lynx http://gentoo.oregonstate.edu/releases/x86/1.4/</c>
1141 <comment>Use <c>Up</c> and <c>Down</c> arrows keys (or the <c>TAB</c> key) to go to the right directory
1142 Highlight the appropriate stage you want to download
1143 Press <c>d</c> which will initiate the download
1144 Save the file and quit the browser
1145
1146 <b>OR</b> use wget from the command line:</comment>
1147 # <c>wget <comment>insert URL to the required stage tarball here.</comment></c>
1148 </pre>
1149 </body>
1150 </section>
1151 <section>
1152 <title>Extracting the stage tarball</title>
1153 <body>
1154
1155 <p>Now it is time to extract the compressed stage tarball of your choice to
1156 <path>/mnt/gentoo/</path>. Remember, you only need to unpack <b>one</b> stage
1157 tarball, either a stage1, stage2 or stage3. So, if you wanted to perform a
1158 stage3 install of Gentoo, then you would just unpack the stage3 tarball.
1159 Unpack the stage tarball as follows:</p>
1160
1161 <impo>Be sure to use the <c>p</c> option with <c>tar</c>. Forgetting to do this will
1162 cause certain files to have incorrect permissions.</impo>
1163
1164 <pre caption="Unpacking the Stages">
1165 # <c>cd /mnt/gentoo</c>
1166 <comment>Change "stage3" to "stage2" or "stage1" if you want to start from these stages instead.</comment>
1167 <comment>If you downloaded your stage tarball, change the path below to begin with "/mnt/gentoo/"
1168 instead of "/mnt/cdrom/stages/".</comment>
1169 # <c>tar -xvjpf /mnt/cdrom/stages/stage3-*.tar.bz2</c>
1170 </pre>
1171
1172 <p>If you downloaded your stage tarball to <path>/mnt/gentoo</path>, you can now delete it by typing
1173 <c>rm /mnt/gentoo/stage*.tar.bz2</c>.</p>
1174 </body>
1175 </section>
1176 <section>
1177 <title>GRP package/snapshot steps</title>
1178 <body>
1179 <impo>The following instructions are for GRP users only.</impo>
1180 <p><b>GRP Users</b>: There is a Portage snapshot on the Live CD. You will
1181 need to use this snapshot so that you can skip the <c>emerge sync</c> step
1182 later in this document, since <c>emerge sync</c> requires a network
1183 connection. Untar this snapshot as follows:</p>
1184 <pre caption="Using Portage snapshot">
1185 <comment>Replace yyyymmdd with the datestamp in the filename.</comment>
1186 # <c>tar -xvjf /mnt/cdrom/snapshots/portage-yyyymmdd.tar.bz2 -C /mnt/gentoo/usr</c>
1187 </pre>
1188 <p>This will extract a snapshot of the Portage tree to your fresh Gentoo
1189 install. Now you won't need to connect to the Internet and use <c>emerge
1190 sync</c> to download a Portage tree. Now, copy distfiles and packages
1191 from the Live CD into place:</p>
1192
1193 <pre caption="Copying GRP files">
1194 # <c>cp -R /mnt/cdrom/distfiles /mnt/gentoo/usr/portage/distfiles</c>
1195 # <c>cp -a /mnt/cdrom/packages/ /mnt/gentoo/usr/portage/packages/</c>
1196 </pre>
1197
1198 <p>All relevant files are now in place for using GRP. You should now have
1199 everything copied over and unpacked that you'll need to install Gentoo Linux
1200 -- even without a network connection.</p>
1201
1202 </body>
1203 </section>
1204 <section>
1205 <title>Entering the chroot</title>
1206 <body>
1207 <p>
1208 Next, we will <c>chroot</c> over to the new Gentoo Linux build installation to &quot;enter&quot; the new
1209 Gentoo Linux system.
1210 </p>
1211
1212 <note>
1213 You may receive a notice during <c>env-update</c> telling you that
1214 <path>/etc/make.profile/make.defaults</path> isn't available: ignore it. We are
1215 going to issue <c>emerge sync</c> later on in this document, which will resolve
1216 the problem.
1217 </note>
1218
1219 <pre caption="Prepping and entering the chroot environment">
1220 # <c>mount -t proc proc /mnt/gentoo/proc</c>
1221 # <c>cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf</c>
1222 # <c>chroot /mnt/gentoo /bin/bash</c>
1223 # <c>env-update</c>
1224 Regenerating /etc/ld.so.cache...
1225 # <c>source /etc/profile</c>
1226 <comment>(The above points your shell to the new paths and updated binaries).</comment>
1227 </pre>
1228 <p>After you execute these commands, you will be &quot;inside&quot; your new Gentoo Linux environment in <path>/mnt/gentoo</path>.
1229 We can perform the rest of the installation process inside the chroot.
1230 </p>
1231 </body>
1232 </section>
1233 </chapter>
1234 <chapter>
1235 <title>Getting the Current Portage Tree using sync</title>
1236 <section>
1237 <body>
1238
1239 <!-- This is not yet implemented. Uncomment when it is!
1240
1241 <p>In order to maximize the downloadspeed, you should now select rsync- and distfiles mirrors. To simplify this task, we have a tool called <c>mirrorselect</c>. Issue the following two commands:</p>
1242
1243 <pre caption="Selecting a mirror">
1244 <comment>First we have mirrorselect select 5 close mirrors for us.</comment>
1245 # <i>mirrorselect -a -s5</i>
1246 <comment>Now we select an rsync-mirror ourselves:</comment>
1247 # <i>mirrorselect -i -r</i>
1248 </pre>
1249
1250 -->
1251
1252
1253
1254 <impo>If you doing a GRP install you can ignore the following section on
1255 <c>emerge sync</c>.</impo>
1256
1257 <p>Now, you will need to run <c>emerge sync</c>. This command tells Portage
1258 to download the most recent copy of the Gentoo Linux Portage tree from the
1259 Internet. If you extracted a Portage tree snapshot from "CD 1" earlier, you
1260 can safely skip this step. The Portage tree contains all the scripts
1261 (called ebuilds) used to build every package under Gentoo Linux. Currently,
1262 we have ebuild scripts for close to 4000 packages. Once <c>emerge sync</c>
1263 completes, you will have a complete Portage tree in
1264 <path>/usr/portage</path>.</p>
1265
1266 <pre caption="Updating Using sync">
1267 # <c>emerge sync</c>
1268 </pre>
1269
1270 </body>
1271 </section>
1272 </chapter>
1273 <chapter>
1274 <title>Setting Gentoo optimizations (make.conf)</title>
1275 <section>
1276 <body>
1277
1278 <p>Now that you have a working copy of the Portage tree, it is time to
1279 customize the optimization and optional build-time settings to use on your
1280 Gentoo Linux system. Portage will use these settings when compiling any
1281 programs for you. To do this, edit the file <path>/etc/make.conf</path>. In
1282 this file, you should set your <c>USE</c> flags, which specify optional
1283 functionality that you would like to be built into packages if available;
1284 generally, the defaults (an <e>empty</e> or unset <c>USE</c> variable) are
1285 fine. More information on <c>USE</c> flags can be found <uri
1286 link="http://www.gentoo.org/doc/en/use-howto.xml">here</uri>. A complete list
1287 of current USE flags can be found <uri
1288 link="http://www.gentoo.org/dyn/use-index.xml">here</uri>. </p>
1289
1290 <p>If you are starting from a stage1 tarball, You also should set appropriate <c>CHOST</c>, <c>CFLAGS</c> and
1291 <c>CXXFLAGS</c> settings for the kind of system that you are creating
1292 (commented examples can be found further down in the file). If you are using
1293 a stage2 or stage3 tarball, these settings will already be configured
1294 optimally and should not require any modification.</p>
1295
1296 <impo><b>Advanced users:</b> The <c>CFLAGS</c> and <c>CXXFLAGS</c> settings
1297 settings
1298 are used to tell the C and C++ compiler how to optimize the code that
1299 is generated on your system. It is common for users with Athlon XP processors
1300 to specify a "-march=athlon-xp" setting in their CFLAGS and CXXFLAGS settings
1301 so that all packages built will be optimized for the instruction set and
1302 performance characteristics of their CPU, for example. The <path>/etc/make.conf</path>
1303 file contains a general guide for the proper settings of CFLAGS and CXXFLAGS.
1304 </impo>
1305
1306 <!-- needs qa
1307 <note><b>Advanced users:</b>If you are building from a stage1 and don't want
1308 to manually configure CFLAGS and CXXFLAGS, you can use the <c>genflags</c>
1309 utility, which will try to guess accurate flags for your CPU architecture.
1310 Simply type <c>emerge -O genflags</c> and then execute
1311 <c>info2flags</c>. <c>info2flags</c> will suggest CHOST, CFLAGS, and
1312 CXXFLAGS settings, which you can then add to
1313 <path>/etc/make.conf</path>.</note>
1314 -->
1315
1316 <p>If necessary, you can also set proxy information here if you are behind a
1317 firewall. Use the following command to edit <path>/etc/make.conf</path> using <c>nano</c>,
1318 a simple visual editor.
1319 </p>
1320 <pre caption="Setting make.conf Options">
1321 # <c>nano -w /etc/make.conf</c>
1322 </pre>
1323 <note>
1324 <b>Advanced users:</b> People who need to substantially customize the build process should take a look at
1325 the <path>/etc/make.globals</path> file. This file comprises gentoo defaults and
1326 should never be touched. If the defaults do not suffice, then new values should
1327 be put in <path>/etc/make.conf</path>, as entries in <path>make.conf</path>
1328 <comment>override</comment> the entries in <path>make.globals</path>. If you're
1329 interested in customizing USE settings, look in <path>/etc/make.profile/make.defaults</path>.
1330 If you want to turn off any USE settings found here, add an appropriate <c>USE=&quot;-foo&quot;</c>
1331 in <path>/etc/make.conf</path> to turn off any <c>foo</c> USE setting enabled by default
1332 in <path>/etc/make.globals</path> or <path>/etc/make.profile/make.defaults</path>.
1333 </note>
1334 <warn>Make sure not to add '<c>static</c>' to your <c>USE</c> variables until after stage1.</warn>
1335 </body>
1336 </section>
1337 </chapter>
1338 <chapter>
1339 <title>Starting from Stage1</title>
1340 <section>
1341 <body>
1342 <note>If you are not starting from a stage1 tarball, skip this section.</note>
1343 <p>The stage1 tarball is for complete customization and optimization. If you have picked this tarball,
1344 you are most likely looking to have an uber-optimized and up-to-date
1345 system. Have fun! Installing from a stage1 takes a lot of time, but the result
1346 is a system that has been optimized from the ground up for your specific machine and needs.
1347 </p>
1348 <p>Now, it is time to start the &quot;bootstrap&quot; process. This process takes about two hours on
1349 my 1200MHz AMD Athlon system.
1350 During this time, the GNU C library, compiler suite and other key system programs will be built. Start the bootstrap
1351 as follows:</p>
1352 <pre caption="Bootstrapping">
1353 # <c>cd /usr/portage</c>
1354 # <c>scripts/bootstrap.sh</c>
1355 </pre>
1356 <p>The &quot;bootstrap&quot; process will now begin.</p>
1357 <note><c>bootstrap.sh</c> now supports the <c>--fetchonly</c> option. Dial-up users will find this especially handy. It will download all bootstrap related files in one go for later compilation. <c>bootstrap.sh -h</c> for more information.</note>
1358 <note>
1359 Portage by default uses <c>/var/tmp</c> during package building, often
1360 using several hundred megabytes of temporary storage. If you would like to
1361 change where Portage stores these temporary files, set a new PORTAGE_TMPDIR <e>before</e>
1362 starting the bootstrap process, as follows:
1363 </note>
1364 <pre caption="Changing Portage's Storage Path">
1365 # <c>export PORTAGE_TMPDIR=&quot;/otherdir/tmp&quot;</c>
1366 </pre>
1367 <p><c>bootstrap.sh</c> will build <c>binutils</c>, <c>gcc</c>, <c>gettext</c>,
1368 and <c>glibc</c>, rebuilding <c>gettext</c>
1369 after <c>glibc</c>. Needless to say, this process takes a while.
1370 Once this process completes, your system will be equivalent to a &quot;stage2&quot; system,
1371 which means you can now move on to the stage2 instructions.
1372 </p>
1373 </body>
1374 </section>
1375 </chapter>
1376 <chapter>
1377 <title>Starting from Stage2 and continuing Stage1</title>
1378 <section>
1379 <body>
1380
1381 <note>This section is for those continuing a stage1 install or starting at stage2. If
1382 this is not you (ie. you're using a stage3), then skip this section.
1383 </note>
1384
1385 <warn>
1386 If you start from stage2, don't change the CHOST variable in
1387 <path>/etc/make.conf</path>. Doing so results in strange and
1388 broad compilation failures. We are working on fixing this
1389 of course.
1390 </warn>
1391
1392 <p>The stage2 tarball already has the bootstrapping done for you. All that you have
1393 to do is install the rest of the system.
1394 </p>
1395 <note>If you are starting from a pre-built stage2 and want to ensure
1396 that your compiler toolchain is fully up-to-date, add the <c>-u</c>
1397 option to the commands below. If you don't know what this means, it's
1398 safe to skip this suggestion.</note>
1399
1400 <pre caption="Installing the Rest of the System">
1401 # <c>emerge -p system</c>
1402 <comment>(lists the packages to be installed)</comment>
1403 # <c>emerge system</c>
1404 </pre>
1405 <p>It is going to take a while
1406 to finish building the entire base system. Your reward is that it will be
1407 thoroughly optimized for your system. The drawback is that you have to find a
1408 way to keep yourself occupied for some time to come. The author suggests &quot;Star
1409 Wars - Super Bombad Racing&quot; for the PS2.
1410 </p>
1411 <p>
1412 Building is now complete. Go ahead and skip down to the "Setting
1413 your time zone" section.
1414 </p>
1415 </body>
1416 </section>
1417 </chapter>
1418 <chapter>
1419 <title>Starting from Stage3</title>
1420 <section>
1421 <body>
1422 <note>This section is for those <b>starting</b> with stage3, and not for those who have started
1423 with stage1 or stage2 who should skip this section. GRP users should skip ahead to the next section.</note>
1424
1425 <warn>
1426 Remember, if you start from stage3, don't change the CHOST variable in
1427 <path>/etc/make.conf</path>. Doing so can result in compilation failures.
1428 </warn>
1429
1430 <p>The stage3 tarball provides a fully-functional basic Gentoo system,
1431 so no building is required.</p>
1432
1433 <note><b>Advanced users:</b>
1434 However, since the stage3 tarball is pre-built, it may be slightly out-of-date. If this is a concern
1435 for you, you can automatically update your existing stage3 to contain the most up-to-date versions of all system packages
1436 by typing <c>export CONFIG_PROTECT="-* /etc/make.conf" emerge -u
1437 system</c> (this requires a network connection). Note that this could take a long time if your stage3 is very old;
1438 otherwise, this process will generally be quick and will allow you to benefit from the very latest
1439 Gentoo updates and fixes.
1440 In any case, feel free to skip these
1441 steps and proceed to the next section if you like.
1442 </note>
1443
1444 </body>
1445 </section>
1446 </chapter>
1447 <chapter>
1448 <title>Setting your time zone</title>
1449 <section>
1450 <body>
1451 <p>Now you need to set your time zone.</p>
1452 <p>Look for your time zone (or GMT if you are using Greenwich Mean Time)
1453 in <path>/usr/share/zoneinfo</path>. Then, make a symbolic link to
1454 /etc/localtime by typing:</p>
1455 <pre caption="Creating a symbolic link for time zone">
1456 # <c>ln -sf /usr/share/zoneinfo/path/to/timezonefile /etc/localtime</c>
1457 </pre>
1458 </body>
1459 </section>
1460 </chapter>
1461 <chapter>
1462 <title>Modifying /etc/fstab for your machine</title>
1463 <section>
1464 <body>
1465 <impo>
1466 To edit files, remember to use <c>nano -w "filename"</c>.
1467 </impo>
1468 <p>Your Gentoo Linux system is almost ready for use. All we need to do now is configure
1469 a few important system files and install the boot loader.
1470 The first file we need to
1471 configure is <path>/etc/fstab</path>. Remember that you should use
1472 the <c>notail</c> option for your boot partition if you chose to create a ReiserFS filesystem on it.
1473 Remember to specify <c>ext2</c>, <c>ext3</c> or <c>reiserfs</c> filesystem types as appropriate.
1474 </p>
1475 <p>Use something like the <path>/etc/fstab</path> listed below, but of course be sure to replace &quot;BOOT&quot;,
1476 &quot;ROOT&quot; and &quot;SWAP&quot; with the actual block devices you are using (such as <c>hda1</c>, etc.)</p>
1477 <pre caption="Editing fstab">
1478 <comment># /etc/fstab: static file system information.
1479 #
1480 # noatime turns off atimes for increased performance (atimes normally aren't
1481 # needed; notail increases performance of ReiserFS (at the expense of storage
1482 # efficiency). It is safe to drop the noatime options if you want and to
1483 # switch between notail and tail freely.
1484
1485 # &lt;fs&gt; &lt;mount point&gt; &lt;type&gt; &lt;opts&gt; &lt;dump/pass&gt;
1486
1487 # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
1488 </comment>
1489 /dev/BOOT /boot ext2 noauto,noatime 1 2
1490 /dev/ROOT / ext3 noatime 0 1
1491 /dev/SWAP none swap sw 0 0
1492 /dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0
1493 proc /proc proc defaults 0 0
1494 </pre>
1495 <warn>Please notice that <i>/boot</i> is NOT mounted at boot time.
1496 This is to protect the data in <i>/boot</i> from
1497 corruption. If you need to access <i>/boot</i>, please mount it!
1498 </warn>
1499 </body>
1500 </section>
1501 </chapter>
1502 <chapter>
1503 <title>Installing the kernel and system logger</title>
1504 <section>
1505 <title>Kernel selections</title>
1506 <body>
1507
1508 <p>There are two options for installing a kernel. You can either configure your own kernel or use the <c>genkernel</c>
1509 utility to configure and compile your kernel automatically.</p>
1510
1511
1512 <p>Whether configuring a kernel by hand or using <c>genkernel</c>,
1513 you'll need to merge the Linux kernel sources you'd like to use.
1514 Gentoo provides several kernel ebuilds; a list can be found
1515 <uri link="/doc/en/gentoo-kernel.xml">here</uri>. If you are uncertain
1516 which kernel sources to choose, we advise using <c>gentoo-sources</c>.
1517 <!--or <c>vanilla-sources</c>.(2.4.21-vanilla has sound issues)--> If you want XFS support, you should choose
1518 <c>xfs-sources</c> or <c>gs-sources</c>. Gentoo's LiveCD uses
1519 <c>gs-sources</c> and <c>xfs-sources</c>. There is also a
1520 <c>gaming-sources</c> kernel optimized for game-playing
1521 responsiveness that works wonderfully for this purpose when the
1522 "Preemptible kernel" option is enabled.
1523 </p>
1524
1525
1526 <p>Choose a kernel and then merge as follows:</p>
1527 <pre caption="Emerging Kernel Sources">
1528 # <c>emerge -k sys-kernel/gentoo-sources</c>
1529 </pre>
1530
1531 <p>The
1532 <path>/usr/src/linux</path> symbolic link will point to your
1533 newly-installed kernel source tree. Portage uses the
1534 <path>/usr/src/linux</path> symbolic link for a special purpose. Any
1535 ebuilds you install that contain kernel modules will be configured
1536 to work with the kernel source tree pointed to by
1537 <path>/usr/src/linux</path>. <path>/usr/src/linux</path> is created
1538 when you emerge your first kernel source package, but after it
1539 exists, Portage does not modify this symbolic link.</p>
1540 </body>
1541 </section>
1542 <section>
1543 <title>Using genkernel to compile your kernel</title>
1544 <body>
1545
1546 <p>Now that your kernel source tree is installed, it's now time to
1547 compile your kernel. There are two ways to do this. The first way is
1548 to use our new <c>genkernel</c> script to automatically build a kernel
1549 for you. <c>genkernel</c> works by configuring a kernel nearly
1550 identically to the way our LiveCD kernel is configured. This means
1551 that when you use <c>genkernel</c> to build your kernel, your system
1552 will generally detect all your hardware at boot-time, just like our Live
1553 CD does. Because genkernel doesn't require any manual kernel
1554 configuration, it is an ideal solution for those users who may not
1555 be comfortable compiling their own kernels.</p>
1556
1557 <p>Now, let's see how to use genkernel. First, emerge the genkernel
1558 ebuild:</p>
1559
1560 <pre caption="Emerging genkernel">
1561 # <c>emerge -k genkernel</c>
1562 </pre>
1563
1564 <p>Now, compile your kernel sources by running <c>genkernel</c>:</p>
1565
1566 <note><b>Advanced users:</b> you can type <c>genkernel --config</c> instead,
1567 which will cause genkernel to allow you to tweak the default kernel configuration before
1568 building begins.</note>
1569
1570
1571 <pre caption="Running genkernel">
1572 <comment>If you're using genkernel 1.2 (included in the 1.4-20030803 x86/i686 GRP set), use the following:</comment>
1573 # <c>genkernel gentoo-sources</c>
1574 <comment>If you're using genkernel 1.4 or newer, there's no need to specify a kernel:</comment>
1575 # <c>genkernel</c>
1576 Gentoo Linux genkernel, version 1.4
1577 Copyright 2003 Gentoo Technologies, Inc., Bob Johnson, Daniel Robbins
1578 Distributed under the GNU General Public License version 2
1579
1580 Settings:
1581 compile optimization: 1 processor(s)
1582 source tree: /usr/src/linux-2.4.20-gaming-r3
1583 config: gentoo (customized)
1584 config loc: /etc/kernels/config-2.4.20-gaming-r3
1585 initrd config: (default) /etc/kernels/settings
1586
1587 * Running "make oldconfig"... [ ok ]
1588 * Logging to /var/log/genkernel.log... [ ok ]
1589 * Starting 2.4.20-gaming-r3 build... [ ok ]
1590 * Running "make dep"... [ ok ]
1591 * Running "make bzImage"... [ ok ]
1592 * Running "make modules"... [ ok ]
1593 * Running "make modules_install"... [ ok ]
1594 * Moving bzImage to /boot/kernel-2.4.20-gaming-r3... [ ok ]
1595 * Building busybox... [ ok ]
1596 * Creating initrd... [ ok ]
1597
1598 * Build completed successfully!
1599
1600 * Please specify /boot/kernel-2.4.20-gaming-r3 and /boot/initrd-2.4.20-gaming-r3
1601 * when customizing your boot loader configuration files.
1602
1603 #
1604 </pre>
1605
1606 <p>Once <c>genkernel</c> completes, a kernel, full set of modules and <i>initial root disk</i> (initrd) will
1607 be created. We will use the kernel and initrd when configuring a boot loader later in this document. The
1608 initrd will be started immediately after booting to perform hardware autodetection (just like on the Live CD)
1609 before your "real" system starts up.</p>
1610
1611 <p>Now, let's perform one more step to get our system to be more like the Live CD -- let's emerge hotplug.
1612 While the initrd autodetects hardware that is needed to boot your system, hotplug autodetects everything else.
1613 To emerge and enable hotplug, type the following:</p>
1614
1615 <pre caption="Emerging and enabling hotplug">
1616 # <c>emerge -k hotplug</c>
1617 # <c>rc-update add hotplug default</c>
1618 </pre>
1619
1620 <p>Finally, you should emerge ebuilds for any additional hardware that is on your system. Here is a list of
1621 kernel-related ebuilds that you could emerge:</p>
1622
1623 <table>
1624 <tr>
1625 <th>ebuild</th>
1626 <th>purpose</th>
1627 <th>command</th>
1628 </tr>
1629 <tr>
1630 <ti>nvidia-kernel</ti>
1631 <ti>Accelerated NVIDIA graphics for XFree86</ti>
1632 <ti><c>emerge -k nvidia-kernel</c></ti>
1633 </tr>
1634 <tr>
1635 <ti>nforce-net</ti>
1636 <ti>On-board ethernet controller on NVIDIA NForce(2) motherboards</ti>
1637 <ti><c>emerge nforce-net</c></ti>
1638 </tr>
1639 <tr>
1640 <ti>nforce-audio</ti>
1641 <ti>On-board audio on NVIDIA NForce(2) motherboards</ti>
1642 <ti><c>emerge nforce-audio</c></ti>
1643 </tr>
1644 <tr>
1645 <ti>e100</ti>
1646 <ti>Intel e100 Fast Ethernet Adapters</ti>
1647 <ti><c>emerge e100</c></ti>
1648 </tr>
1649 <tr>
1650 <ti>e1000</ti>
1651 <ti>Intel e1000 Gigabit Ethernet Adapters</ti>
1652 <ti><c>emerge e1000</c></ti>
1653 </tr>
1654 <tr>
1655 <ti>emu10k1</ti>
1656 <ti>Creative Sound Blaster Live!/Audigy support</ti>
1657 <ti><c>emerge emu10k1</c></ti>
1658 </tr>
1659 <tr>
1660 <ti>ati-drivers</ti>
1661 <ti>Accelerated ATI Radeon 8500+/FireGL graphics for XFree86</ti>
1662 <ti><c>emerge ati-drivers</c></ti>
1663 </tr>
1664 <tr>
1665 <ti>xfree-drm</ti>
1666 <ti>Accelerated graphics for ATI Radeon up to 9200, Rage128,
1667 Matrox, Voodoo and other cards for XFree86</ti>
1668 <ti><c>VIDEO_CARDS="yourcard" emerge xfree-drm</c></ti>
1669 </tr>
1670 </table>
1671 <p>The nvidia-kernel, ati-drivers and xfree-drm packages will require additional configuration to be enabled.
1672 All other ebuilds listed above should be auto-detected at boot-time by the hotplug package.</p>
1673
1674 <p>Now that you've run and configured your system to use genkernel, you can skip the "manual kernel configuration"
1675 section below.</p>
1676 </body>
1677 </section>
1678 <section>
1679 <title>Manual kernel configuration</title>
1680 <body>
1681
1682 <p>If you opted not to use genkernel to compile your kernel, this section
1683 will guide you through the process of configuring and compiling a kernel by
1684 hand. Please note that <path>/usr/src/linux</path> is a symlink to your
1685 current emerged kernel source package, and is set automatically by Portage at
1686 emerge time. If you have multiple kernel source packages, it is necessary to
1687 set the <path>/usr/src/linux</path> symlink to the correct one before
1688 proceeding. </p>
1689
1690 <warn>
1691 If you are configuring your own kernel, be careful with the <i>grsecurity</i> option. Being too aggressive with your
1692 security settings can cause certain programs (such as X) to not run properly. If in doubt, leave it out.
1693 </warn>
1694
1695 <note>
1696 If you want to use the same configuration as the LiveCD kernel or base
1697 your configuration on it, you should execute
1698 <c>cd /usr/src/linux &amp;&amp; cat /proc/config > .config &amp;&amp; make oldconfig</c>.
1699 If you aren't using <c>xfs-sources</c>, this will ask some questions
1700 about differences between your kernelchoice and <c>xfs-sources</c>.
1701 </note>
1702 <pre caption="Configuring the Linux Kernel">
1703 # <c>cd /usr/src/linux</c>
1704 # <c>make menuconfig</c>
1705 </pre>
1706 <warn>For your kernel to function properly, there are several options that you will
1707 need to ensure are in the kernel proper -- that is, they should <i>be enabled and not
1708 compiled as modules</i>. Be sure to enable &quot;ReiserFS&quot; if you have
1709 any ReiserFS partitions; the same goes for &quot;Ext3&quot;. If you're using XFS, enable the
1710 &quot;SGI XFS filesystem support&quot; option. It's always a good idea to leave ext2
1711 enabled whether you are using it or not. Below are some common options that you will need:</warn>
1712 <pre caption="make menuconfig options">
1713 Code maturity level options ---&gt;
1714 [*] Prompt for development and/or incomplete code/drivers&quot;
1715 <comment>(You need this to enable some of the options below.)</comment>
1716 ...
1717
1718 File systems ---&gt;
1719 &lt;*&gt; Reiserfs support
1720 <comment>(Only needed if you are using reiserfs.)</comment>
1721 ...
1722 &lt;*&gt; Ext3 journalling file system support
1723 <comment>(Only needed if you are using ext3.)</comment>
1724 ...
1725 [*] Virtual memory file system support (former shm fs)
1726 <comment>(Required for Gentoo Linux.)</comment>
1727 ...
1728 &lt;*&gt; JFS filesystem support
1729 <comment>(Only needed if you are using JFS.)</comment>
1730 ...
1731 [*] /proc file system support
1732 <comment>(Required for Gentoo Linux.)</comment>
1733 [*] /dev file system support (EXPERIMENTAL)
1734 [*] Automatically mount at boot
1735 <comment>(Required for Gentoo Linux.)</comment>
1736 [ ] /dev/pts file system for Unix98 PTYs
1737 <comment>(Uncheck this, it is NOT needed.)</comment>
1738 ...
1739 &lt;*&gt; Second extended fs support
1740 <comment>(Only needed if you are using ext2.)</comment>
1741 ...
1742 &lt;*&gt; XFS filesystem support
1743 <comment>(Only needed if you are using XFS.)</comment>
1744 </pre>
1745 <p>If you use PPPoE to connect to Internet, you will need the following
1746 options in the kernel (built-in or as preferably as modules) :
1747 &quot;PPP (point-to-point protocol) support&quot;, &quot;PPP support for async serial ports&quot;,
1748 &quot;PPP support for sync tty ports&quot;. The two compression options won't harm but
1749 are not definitely needed, neither does the &quot;PPP over Ethernet&quot; option,
1750 that might only be used by <i>rp-pppoe</i> when configured to do kernel mode PPPoE.
1751 </p>
1752 <p>If you have an IDE cd burner, then you need to enable SCSI emulation in the
1753 kernel. Turn on &quot;ATA/IDE/MFM/RLL support&quot; ---&gt; &quot;IDE, ATA and ATAPI Block
1754 devices&quot; ---&gt; &quot;SCSI emulation support&quot; (I usually make it a module), then
1755 under &quot;SCSI support&quot; enable &quot;SCSI support&quot;, &quot;SCSI CD-ROM support&quot; and
1756 &quot;SCSI generic support&quot; (again, I usually compile them as modules). If you
1757 also choose to use modules, then <c>echo -e &quot;ide-scsi\nsg\nsr_mod&quot;
1758 &gt;&gt; /etc/modules.autoload</c> to have them automatically added at boot time.
1759 </p>
1760 <p>If you require it, don't forget to include support in the kernel for your ethernet card.</p>
1761 <note>
1762 For those who prefer it,
1763 it is now possible to install Gentoo Linux with a 2.2 kernel.
1764 However, doing this comes at a price:
1765 you will lose many of the nifty features that
1766 are new to the 2.4 series kernels (such as XFS and tmpfs
1767 filesystems, iptables, and more), although the 2.2 kernel sources can be
1768 patched with ReiserFS and devfs support.
1769 Gentoo linux boot scripts require either tmpfs or ramdisk support in the kernel, so
1770 2.2 kernel users need to make sure that ramdisk support is compiled in (ie, not a module).
1771 It is <comment>vital</comment> that a <e>gentoo=notmpfs</e> flag be added to the kernel
1772 line in <path>/boot/grub/grub.conf</path> or to the append line in <path>/etc/lilo.conf</path> for the 2.2 kernel so
1773 that a ramdisk is mounted for the boot scripts instead of tmpfs. If you choose not to use devfs, then
1774 <e>gentoo=notmpfs,nodevfs</e> should be used instead.
1775 </note>
1776
1777 <pre caption = "Compiling and Installing the kernel">
1778 # <c>make dep &amp;&amp; make clean bzImage modules modules_install</c>
1779 # <c>cp /usr/src/linux/arch/i386/boot/bzImage /boot</c>
1780 </pre>
1781 </body>
1782 </section>
1783 <section>
1784 <title>Installing a system logger</title>
1785 <body>
1786 <p>Your new custom kernel (and modules) are now installed. Now you need to choose a system
1787 logger that you would like to install. We offer sysklogd, which is the traditional set
1788 of system logging daemons. We also have msyslog and syslog-ng as well as metalog. Power users seem
1789 to gravitate away from sysklogd (not very good performance) and towards the
1790 newer alternatives.
1791 If in doubt, you may want to try metalog, since it seems to be quite popular.
1792 To merge your logger of choice, type <e>one</e> of the next four
1793 lines. </p>
1794 <pre caption="Emerging System Logger of Choice">
1795 # <c>emerge -k app-admin/sysklogd</c>
1796 # <c>rc-update add sysklogd default</c>
1797 <comment>or</comment>
1798 # <c>emerge -k app-admin/syslog-ng</c>
1799 # <c>rc-update add syslog-ng default</c>
1800 <comment>or</comment>
1801 # <c>emerge -k app-admin/metalog</c>
1802 # <c>rc-update add metalog default</c>
1803 <comment>or</comment>
1804 # <c>emerge -k app-admin/msyslog</c>
1805 # <c>rc-update add msyslog default</c>
1806 </pre>
1807 <impo>
1808 Metalog flushes output to the disk in blocks, so messages aren't immediately recorded into
1809 the system logs. If you are trying to debug a daemon, this performance-enhancing behavior
1810 is less than helpful. When your Gentoo Linux system is up and running, you can send
1811 metalog a USR1 signal to temporarily turn off this message buffering (meaning that
1812 <i>tail -f <path>/var/log/everything/current</path></i> will now work
1813 in real time, as expected),
1814 and a USR2 signal to turn buffering back on
1815 again. If you want to disable buffering permanently, you can change METALOG_OPTS="-B" to METALOG_OPTS="-B -s"
1816 in <path>/etc/conf.d/metalog</path>.
1817 </impo>
1818 <pre caption="Turning metalog buffering on/off">
1819 <codenote>To turn the buffering off:</codenote>
1820 # <c>killall -USR1 metalog</c>
1821 <codenote>To turn the buffering back on:</codenote>
1822 # <c>killall -USR2 metalog</c>
1823 </pre>
1824 <p>Now, you may optionally choose a cron package that you would like to use.
1825 Right now, we offer dcron, fcron and vcron. If you do not know which one to choose,
1826 you might as well grab vcron.
1827 </p>
1828 <pre caption="Choosing a CRON Daemon">
1829 # <c>emerge -k sys-apps/dcron</c>
1830 # <c>rc-update add dcron default</c>
1831 # <c>crontab /etc/crontab</c>
1832 <comment>or</comment>
1833 # <c>emerge -k sys-apps/fcron</c>
1834 # <c>rc-update add fcron default</c>
1835 # <c>crontab /etc/crontab</c>
1836 <comment>or</comment>
1837 # <c>emerge -k sys-apps/vcron</c>
1838 # <c>rc-update add vcron default</c>
1839 <comment>You do not need to run <c>crontab /etc/crontab</c> if using vcron.</comment>
1840 </pre>
1841 <p>For more information on starting programs and daemons at startup, see the
1842 <uri link="/doc/en/rc-scripts.xml">rc-script guide</uri>.
1843 </p>
1844 </body>
1845 </section>
1846 </chapter>
1847 <chapter>
1848 <title>Installing miscellaneous necessary packages</title>
1849 <section>
1850 <body>
1851 <p>If you need rp-pppoe to connect to the net, be aware that at this point
1852 it has not been installed. It would be the good time to do it. </p>
1853 <pre caption="Installing rp-pppoe">
1854 # <c>USE="-X" emerge rp-pppoe</c>
1855 <comment>GRP users should type the following:</comment>
1856 # <c>USE="-X bindist" emerge -K rp-pppoe</c>
1857 </pre>
1858
1859 <note>The <i>USE="-X"</i> prevents pppoe from installing its optional X interface, which is a good thing,
1860 because X and its dependencies would also be emerged. You can always recompile <i>rp-pppoe</i> with
1861 X support later.
1862 </note>
1863 <note> Please note that the rp-pppoe is built but not configured.
1864 You will have to do it again using <c>adsl-setup</c> when you boot into your Gentoo system
1865 for the first time.
1866 </note>
1867 <p>You may need to install some additional packages in the Portage tree
1868 if you are using any optional features like XFS, ReiserFS or LVM. If you're
1869 using XFS, you should emerge the <c>xfsprogs</c> package:
1870 </p>
1871 <pre caption="Emerging Filesystem Tools">
1872 # <c>emerge -k sys-apps/xfsprogs</c>
1873 <comment>If you would like to use ReiserFS, you should emerge the ReiserFS tools: </comment>
1874 # <c>emerge -k sys-apps/reiserfsprogs</c>
1875 <comment>If you would like to use JFS, you should emerge the JFS tools: </comment>
1876 # <c>emerge -k jfsutils</c>
1877 <comment>If you're using LVM, you should emerge the <c>lvm-user</c> package: </comment>
1878 # <c>emerge -k sys-apps/lvm-user</c>
1879 </pre>
1880 <p>If you're a laptop user and wish to use your PCMCIA slots on your first
1881 real reboot, you will want to make sure you install the <i>pcmcia-cs</i> package.
1882 </p>
1883 <pre caption="Emerging PCMCIA-cs">
1884 # <c>emerge -k sys-apps/pcmcia-cs</c>
1885 </pre>
1886 <!-- fix the bug or fix the docs, don't send the user in circles
1887 (drobbins)
1888 <warn>You will have to re-emerge <i>pcmcia-cs</i> after installation to get PCMCIA
1889 to work.
1890 </warn>
1891 -->
1892 </body>
1893 </section>
1894 </chapter>
1895 <chapter>
1896 <title>User Management</title>
1897 <section>
1898 <title>Setting a root password</title>
1899 <body>
1900 <p>Before you forget, set the root password by typing: </p>
1901 <pre caption="Setting the root Password">
1902 # <c>passwd</c>
1903 </pre>
1904 </body>
1905 </section>
1906 <section>
1907 <title>Adding a user for day-to-day use</title>
1908 <body>
1909 <p>Working as root on a Unix/Linux system is <e>dangerous</e> and
1910 should be avoided as much as possible. Therefor it is <e>strongly</e>
1911 recommended to add a user for day-to-day use.</p>
1912 <pre caption = "Adding a user">
1913 # <i>useradd your_user -m -G users,wheel,audio -s /bin/bash</i>
1914 # <i>passwd your_user</i></pre>
1915 <p>Substitute <c>your_user</c> with your username.</p>
1916 <p>Whenever you need to perform some task that only root can handle,
1917 use <c>su -</c> to change your privileges to root-privileges, or take
1918 a look at the <c>sudo</c> package.</p>
1919 </body>
1920 </section>
1921 </chapter>
1922 <chapter>
1923 <title>Setting your Hostname</title>
1924 <section>
1925 <body>
1926 <p>
1927 Edit <path>/etc/hostname</path> so that it contains your hostname
1928 on a single line, i.e. <c>mymachine</c>.
1929 </p>
1930 <pre caption="Configuring Hostname">
1931 # <i>echo mymachine &gt; /etc/hostname</i>
1932 </pre>
1933 <p>
1934 Then edit <path>/etc/dnsdomainname</path> so that it contains your DNS
1935 domainname, i.e. <c>mydomain.com</c>.
1936 </p>
1937 <pre caption="Configuring Domainname">
1938 # <i>echo mydomain.com &gt; /etc/dnsdomainname</i>
1939 </pre>
1940 <p>
1941 If you have a NIS domain, you should set it in
1942 <path>/etc/nisdomainname</path>.
1943 </p>
1944 <pre caption="Configuring NIS Domainname">
1945 # <i>echo nis.mydomain.com &gt; /etc/nisdomainname</i>
1946 </pre>
1947 </body>
1948 </section>
1949 </chapter>
1950 <chapter>
1951 <title>Modifying /etc/hosts</title>
1952 <section>
1953 <body>
1954 <p>This file contains a list of IP addresses and their associated hostnames.
1955 It is used by the system to resolve the IP addresses
1956 of any hostnames that may not be in your nameservers. Here is a template for this file:
1957 </p>
1958 <pre caption="Hosts Template">
1959 127.0.0.1 localhost
1960 <comment># the next line contains your IP for your local LAN, and your associated machine name</comment>
1961 192.168.1.1 mymachine.mydomain.com mymachine
1962 </pre>
1963 <note>If you are on a DHCP network, it might be helpful to add your
1964 machine's actual hostname after <i>localhost</i>. This will help
1965 GNOME and many other programs in name resolution.
1966 </note>
1967 </body>
1968 </section>
1969 </chapter>
1970 <chapter>
1971 <title>Final Network Configuration</title>
1972 <section>
1973 <body>
1974 <p>Add the names of any modules that are necessary for the proper functioning of your system to
1975 <path>/etc/modules.autoload</path> file (you can also add any options you
1976 need to the same line.) When Gentoo Linux boots, these modules will be automatically
1977 loaded. Of particular importance is your ethernet card module, if you happened to compile
1978 it as a module:
1979 </p>
1980 <pre caption="/etc/modules.autoload"><comment>This is assuming that you are using a 3com card.
1981 Check <path>/lib/modules/`uname -r`/kernel/drivers/net</path> for your card. </comment>
1982 3c59x
1983 </pre>
1984 <p>Edit the <path>/etc/conf.d/net</path> script to get your network configured for your
1985 first boot: </p>
1986 <pre caption="Boot time Network Configuration">
1987 # <c>nano -w /etc/conf.d/net</c>
1988 # <c>rc-update add net.eth0 default</c>
1989 </pre>
1990 <p>If you have multiple network cards or tokenring interfaces, you need to create additional <path>net.eth<comment>x</comment></path> or <path>net.tr<comment>x</comment></path>
1991 scripts respectively for each one (<comment>x</comment> = 1, 2, ...): </p>
1992 <pre caption="Multiple Network Interfaces">
1993 # <c>cd /etc/init.d</c>
1994 # <c>cp net.eth0 net.eth<comment>x</comment></c>
1995 # <c>rc-update add net.eth<comment>x</comment> default</c>
1996 </pre>
1997 <p>If you have a PCMCIA card installed, have a quick look into
1998 <path>/etc/init.d/pcmcia</path> to verify that things seem all right for your setup,
1999 then add this line to the top of <path>/etc/init.d/net.ethx</path>:
2000 </p>
2001 <pre caption="PCMCIA depend in /etc/init.d/net.ethx">
2002 depend() {
2003 need pcmcia
2004 }
2005 </pre>
2006 <p>This makes sure that the PCMCIA drivers are autoloaded whenever your network is loaded.
2007 </p>
2008 </body>
2009 </section>
2010 </chapter>
2011 <chapter>
2012 <title>Final steps: Configure Basic Settings (including the international keymap setting)</title>
2013 <section>
2014 <body>
2015 <pre caption="Basic Configuration">
2016 # <c>nano -w /etc/rc.conf</c>
2017 </pre>
2018 <p>Follow the directions in the file to configure the basic settings.
2019 All users will want to make sure that <c>CLOCK</c> is set to his/her
2020 liking. International keyboard users will want to set the <c>KEYMAP</c>
2021 variable (browse <path>/usr/share/keymaps</path> to see the various
2022 possibilities).
2023 </p>
2024 </body>
2025 </section>
2026 </chapter>
2027 <chapter>
2028 <title>Configure a Bootloader</title>
2029 <section>
2030 <title>Notes</title>
2031 <body>
2032 <p> In the spirit of Gentoo, users now have more than one bootloader to choose from.
2033 Using our virtual package system, users are now able to choose between both GRUB and
2034 LILO as their bootloaders.
2035 </p>
2036 <p> Please keep in mind that having both bootloaders installed is not necessary.
2037 In fact, it can be a hindrance, so please only choose one.
2038 </p>
2039 <p>In addition, you will need to configure our bootloader differently depending upon
2040 whether you are using <c>genkernel</c> (with kernel and initrd) or a kernel you
2041 compiled by hand. Be sure to take note of the important differences.</p>
2042
2043 <impo>If you are installing Gentoo Linux on a system with an NVIDIA nForce or nForce2 chipset
2044 with an integrated GeForce graphics card, you should use LILO and avoid GRUB. With on-board
2045 video enabled, the low memory area of your RAM may be used as video RAM. Since GRUB also uses low
2046 memory at boot time, it may experience an "out of memory" condition. So, if you have an nForce
2047 or potentially other board with on-board video, use LILO. Even if you're using off-board video
2048 right now, it would be nice to be able to remove the graphics card and use the on-board video in a
2049 pinch, wouldn't it? :)</impo>
2050 </body>
2051 </section>
2052 <section>
2053 <title>Configuring GRUB</title>
2054 <body>
2055 <p>The most critical part of understanding GRUB is getting comfortable with how GRUB
2056 refers to hard drives and partitions. Your Linux partition <path>/dev/hda1</path> is called
2057 <path>(hd0,0)</path> under GRUB. Notice the parenthesis around the hd0,0 - they are required.
2058 Hard drives count from zero rather than &quot;a&quot;, and partitions start at zero rather than one.
2059 Be aware too that with the hd devices, only hard drives are counted, not atapi-ide devices such as
2060 cdrom players, burners, and that the same construct can be used with scsi drives.
2061 (Normally they get higher numbers than ide drives except when the bios is configured
2062 to boot from scsi devices.) Assuming you have a hard drive on /dev/hda, a cdrom player on /dev/hdb,
2063 a burner on /dev/hdc, a second hard drive on /dev/hdd and no SCSI hard drive,
2064 <path>/dev/hdd7</path> gets translated to <path>(hd1,6)</path>.
2065
2066 It might sound tricky, and tricky it is indeed, but as we will see, GRUB
2067 offers a tab completion mechanism that comes handy for those of you having
2068 a lot of hard drives and partitions and who are a little lost in the
2069 GRUB numbering scheme. Having gotten the feel for that,
2070 it is time to install GRUB.
2071 </p>
2072 <p>The easiest way to install GRUB is to simply type <c>grub</c> at your chrooted shell prompt: </p>
2073 <pre caption="Installing GRUB">
2074 # <c>emerge -k grub</c>
2075 # <c>grub</c>
2076 </pre>
2077 <p>You will be presented with the <c>grub&gt;</c> grub
2078 command-line prompt. Now, you need to type in the
2079 right commands to install the GRUB boot record onto your hard drive. In my example configuration,
2080 I want to install the GRUB boot record on my hard drive's MBR (master boot record), so that
2081 the first thing I see when I turn on the computer is the GRUB prompt. In my case, the commands
2082 I want to type are:
2083 </p>
2084
2085 <pre caption="GRUB on the MBR">
2086 grub&gt; <c>root (hd0,0)</c> <codenote>Your boot partition</codenote>
2087 grub&gt; <c>setup (hd0)</c> <codenote>Where the boot record is installed, here, it is the MBR</codenote>
2088 </pre>
2089
2090 <pre caption="GRUB not on the MBR">
2091 <comment>Alternatively, if you wanted to install the bootloader somewhere other than the MBR</comment>
2092 grub&gt; <c>root (hd0,0)</c> <codenote>Your boot partition</codenote>
2093 grub&gt; <c>setup (hd0,4)</c> <codenote>Where the boot record is installed, here it is /dev/hda5</codenote>
2094 grub&gt; <c>quit</c>
2095 </pre>
2096
2097 <p>Here is how the two commands work. The first <c>root ( )</c> command tells GRUB
2098 the location of your boot partition (in our example, <path>/dev/hda1</path> or
2099 <path>(hd0,0)</path> in GRUB terminology. Then, the second <c>setup ( )
2100 </c> command tells GRUB where to install the
2101 boot record - it will be configured to look for its special files at the <c>root
2102 ( )</c> location that you specified. In my case, I want the boot record on the
2103 MBR of the hard drive, so I simply specify <path>/dev/hda</path> (also known as <path>(hd0)</path>).
2104 If I were using another boot loader and wanted to set up GRUB as a secondary boot-loader, I
2105 could install GRUB to the boot record of a particular partition. In that case,
2106 I would specify a particular partition rather than the entire disk. Once the GRUB
2107 boot record has been successfully installed, you can type <c>quit</c> to quit GRUB.
2108 </p>
2109
2110 <note> The tab completion mechanism of GRUB can be used from within GRUB,
2111 assuming you wrote <c> root (</c> and that you hit the TAB key, you would
2112 be prompted with a list of the available devices (not only hard drives),
2113 hitting the TAB key having written <c> root (hd</c>, GRUB would print the
2114 available hard drives and hitting the TAB key after writing <c> root (hd0,</c>
2115 would make GRUB print the list of partitions on the first hard drive.
2116
2117 Checking the syntax of the GRUB location with completion should really help
2118 to make the right choice.
2119 </note>
2120
2121 <p>
2122 Gentoo Linux is now
2123 installed, but we need to create the <path>/boot/grub/grub.conf</path> file so that
2124 we get a nice GRUB boot menu when the system reboots. Here is how to do it.
2125 </p>
2126 <impo>To ensure backwards compatibility with GRUB, make sure to make a link from
2127 <i>grub.conf</i> to <i>menu.lst</i>. You can do this by doing
2128 <c>ln -s /boot/grub/grub.conf /boot/grub/menu.lst</c>. </impo>
2129 <p>Now, create the grub.conf file (<c>nano -w /boot/grub/grub.conf</c>), and add the following to it:
2130 </p>
2131 <pre caption="grub.conf for GRUB">
2132 default 0
2133 timeout 30
2134 splashimage=(hd0,0)/boot/grub/splash.xpm.gz
2135
2136 <comment>#if you compiled your own kernel, use something like this:</comment>
2137 title=My example Gentoo Linux
2138 root (hd0,0)
2139 kernel (hd0,0)/boot/bzImage root=/dev/hda3
2140
2141 <comment>#if you're using genkernel, use something like this instead:</comment>
2142 title=My example Gentoo Linux (genkernel)
2143 root (hd0,0)
2144 kernel (hd0,0)/boot/kernel-KV root=/dev/hda3
2145 initrd (hd0,0)/boot/initrd-KV
2146
2147 <comment># Below needed only for people who dual-boot</comment>
2148 title=Windows XP
2149 root (hd0,5)
2150 chainloader (hd0,5)+1
2151 </pre>
2152 <note>
2153 (hd0,0) should be written without any spaces inside the parentheses.
2154 </note>
2155 <impo>
2156 If you set up SCSI emulation for an IDE cd burner earlier, then to get it to
2157 actually work you need to add an &quot;hdx=ide-scsi&quot; fragment to the kernel
2158 line in grub.conf (where &quot;hdx&quot; should be the device for your cd burner).
2159 </impo>
2160 <p>After saving this file, Gentoo Linux installation is complete. Selecting the first option will
2161 tell GRUB to boot Gentoo Linux without a fuss. The second part of the grub.conf file is optional,
2162 and shows you how to use GRUB to boot a bootable Windows partition.
2163 </p>
2164 <note>Above, <path>(hd0,0)</path> should point to your &quot;boot&quot; partition
2165 (<path>/dev/hda1</path> in our example config) and <path>/dev/hda3</path> should point to
2166 your root filesystem. <path>(hd0,5)</path> contains the NT boot
2167 loader.
2168 </note>
2169 <note>
2170 The path to the kernel image is relative to the boot partition. If for example you have separated boot partition <path>(hd0,0)</path> and root partition <path>(hd0,1)</path>, all paths in the grub.conf file above will become <path>/bzImage</path>.
2171 </note>
2172 <p>If you need to pass any additional options to the kernel, simply
2173 add them to the end of the <c>kernel</c> command. We're already passing one option
2174 (<c>root=/dev/hda3</c>), but you can pass others as well. In particular, you can
2175 turn off devfs by default (not recommended unless you know what you're doing) by
2176 adding the <c>gentoo=nodevfs</c> option to the <c>kernel</c> command.
2177 </p>
2178 <note>Unlike in earlier versions of Gentoo Linux, you no longer have to add
2179 <c>devfs=mount</c> to the end of the <c>kernel</c> line to enable devfs.
2180 Now devfs is enabled by default.
2181 </note>
2182 </body>
2183 </section>
2184 <section>
2185 <title>Configuring LILO</title>
2186 <body>
2187 <p>While GRUB may be the new alternative for most people, it is not always the best choice.
2188 LILO, the LInuxLOader, is the tried and true workhorse of Linux bootloaders. Here is how to install
2189 LILO if you would like to use it instead of GRUB:
2190 </p>
2191 <p>The first step is to emerge LILO:
2192 </p>
2193 <pre caption="Emerging LILO">
2194 # <c>emerge -k lilo</c>
2195 </pre>
2196 <p>Now it is time to configure LILO. Here is a sample configuration file <path>/etc/lilo.conf</path>
2197 </p>
2198 <pre caption="Example lilo.conf">
2199 boot=/dev/hda
2200 map=/boot/map
2201 install=/boot/boot.b
2202 prompt
2203 timeout=50
2204 lba32
2205 default=linux
2206
2207 #use something like the following 4 lines if you compiled your kernel yourself
2208 image=/boot/bzImage
2209 label=linux
2210 read-only
2211 root=/dev/hda3
2212
2213 #if you used genkernel, use something like this:
2214 image=/boot/kernel-KV
2215 label=gk_linux
2216 root=/dev/hda3
2217 initrd=/boot/initrd-KV
2218 append="root=/dev/ram0 init=/linuxrc"
2219
2220
2221 #For dual booting windows/other OS
2222 other=/dev/hda1
2223 label=dos
2224 </pre>
2225 <ul>
2226 <li><i>boot=/dev/hda</i> tells LILO to install itself on the first hard disk on the first IDE controller. </li>
2227 <li><i>map=/boot/map</i> states the map file. In normal use, this should not be modified. </li>
2228 <li><i>install=/boot/boot.b</i> tells LILO to install the specified file as the new boot sector.
2229 In normal use, this should not be altered. If the install line is missing, LILO will
2230 assume a default of /boot/boot.b as the file to be used. </li>
2231 <li>The existence of <i>prompt</i> tells LILO to display the classic <i>lilo:</i> prompt at bootup.
2232 While it is not recommended that you remove the prompt line, if you do remove it, you can still
2233 get a prompt by holding down the [Shift] key while your machine starts to boot. </li>
2234 <li><i>timeout=50</i> sets the amount of time that LILO will wait for user input before proceeding
2235 with booting the default line entry. This is measured in tenths of a second, with 50 as the default. </li>
2236 <li><i>lba32</i> describes the hard disk geometry to LILO. Another common entry here is linear. You should
2237 not change this line unless you are very aware of what you are doing. Otherwise, you could put
2238 your system in an unbootable state. </li>
2239 <li><i>default=linux</i> refers to the default operating system for LILO to boot from the
2240 options listed below this line. The name linux refers to the label line below in each of the boot options. </li>
2241 <li><i>image=/boot/bzImage</i> specifies the linux kernel to boot with this particular boot option. </li>
2242 <li><i>label=linux</i> names the operating system option in the LILO screen. In this case,
2243 it is also the name referred to by the default line. </li>
2244 <li><i>read-only</i> specifies that the root partition (see the root line below) is read-only and cannot be
2245 altered during the boot process. </li>
2246 <li><i>root=/dev/hda3</i> tells LILO what disk partition to use as the root partition. </li>
2247 </ul>
2248 <p>After you have edited your <i>lilo.conf</i> file, it is time to run LILO to load the information
2249 into the MBR:
2250 </p>
2251 <pre caption="Running LILO">
2252 # <c>/sbin/lilo</c>
2253 </pre>
2254 <p>LILO is configured, and now your machine is ready to boot into Gentoo Linux!
2255 </p>
2256 </body>
2257 </section>
2258 <section>
2259 <title>Using framebuffer</title>
2260 <body>
2261 <p>
2262 People who have selected framebuffer in their kernel should add <c>vga=xxx</c> to their bootloader configuration file. <c>xxx</c> is one of the values in the following table:
2263 </p>
2264 <table>
2265 <tr><ti></ti><th>640x480</th><th>800x600</th><th>1024x768</th><th>1280x1024</th></tr>
2266 <tr><th>8 bpp</th><ti>769</ti><ti>771</ti><ti>773</ti><ti>775</ti></tr>
2267 <tr><th>16 bpp</th><ti>785</ti><ti>788</ti><ti>791</ti><ti>794</ti></tr>
2268 <tr><th>32 bpp</th><ti>786</ti><ti>789</ti><ti>792</ti><ti>795</ti></tr>
2269 </table>
2270 <p>
2271 LILO-users will have to add <c>vga=xxx</c> on top of their configuration
2272 file.
2273 </p>
2274 <p>
2275 GRUB-users will have to append <c>vga=xxx</c> to the <c>kernel
2276 (hd0,0)...</c> line.
2277 </p>
2278 </body>
2279 </section>
2280 </chapter>
2281 <chapter>
2282 <title>Creating Bootdisks</title>
2283 <section>
2284 <title>GRUB Bootdisks</title>
2285 <body>
2286 <impo>
2287 Don't forget to insert a floppy in your floppydrive
2288 before proceeding.
2289 </impo>
2290 <p>It is always a good idea to make a boot disk the first
2291 time you install any Linux distribution. This is a security
2292 blanket, and generally not a bad thing to do. If your hardware doesn't
2293 let you install a working bootloader from the chrooted environment,
2294 you may <e>need</e> to make a GRUB boot disk.
2295 If you are in this camp, make a GRUB boot disk, and when you reboot
2296 the first time you can install GRUB to the MBR. Make your bootdisks
2297 like this:
2298 </p>
2299 <pre caption="Creating a GRUB Bootdisk">
2300 # <c>cd /usr/share/grub/i386-pc/</c>
2301 # <c>cat stage1 stage2 > /dev/fd0</c>
2302 </pre>
2303 <p>Now reboot and load the floppy. At the floppy's <c>grub&gt;</c> prompt, you can now execute the necessary <c>root</c>
2304 and <c>setup</c> commands.</p>
2305 </body>
2306 </section>
2307 <section>
2308 <title>LILO Bootdisks</title>
2309 <body>
2310 <impo>
2311 Don't forget to insert a floppy in your floppydrive
2312 before proceeding.
2313 </impo>
2314
2315 <p>If you are using LILO, it is also a good idea to make a bootdisk:
2316 </p>
2317 <pre caption="Making a Bootdisk">
2318 # <c>dd if=/boot/your_kernel of=/dev/fd0 </c>
2319 <comment>This will only work if your kernel is smaller than 1.4MB</comment>
2320 </pre>
2321 </body>
2322 </section>
2323 </chapter>
2324
2325 <chapter>
2326 <title>Using GRP</title>
2327 <section>
2328 <body>
2329
2330 <p>GRP users can, at this point, install binary packages:</p>
2331
2332 <pre caption="Installing from GRP">
2333 # <c>USE="bindist" emerge -k xfree</c>
2334 <codenote>USE="bindist" must be set while installing GRP packages that use XFree86.</codenote>
2335 </pre>
2336
2337 <p>CD 1 contains enough applications to install a working system with XFree86.
2338 Additionally, CD2 of the 2-CD GRP set contains other applications including KDE, GNOME, Mozilla, and others.
2339 To install these packages, you will need to reboot into your new Gentoo
2340 system first (covered in the "Installation complete!" section near the end of this document.) After you are running your basic Gentoo system from the hard
2341 drive, you can mount the second CD and copy files:</p>
2342
2343 <pre caption="Loading binary packages from CD2">
2344 # <c>mount /dev/cdrom /mnt/cdrom</c>
2345 # <c>cp -a /mnt/cdrom/packages/* /usr/portage/packages/</c>
2346 </pre>
2347
2348 <p>Now various other applications can be installed the same way. For example:</p>
2349
2350 <pre caption="Installing KDE from GRP">
2351 # <c>USE="bindist" emerge -k kde</c>
2352 </pre>
2353
2354 </body>
2355 </section>
2356 </chapter>
2357 <chapter>
2358 <title>Installation Complete!</title>
2359 <section>
2360 <body>
2361 <p>Now, Gentoo Linux is installed. The only remaining step is to update necessary configuration files, exit the chrooted shell,
2362
2363 safely unmount your partitions
2364 and reboot the system:
2365 </p>
2366 <warn>
2367 <c>etc-update</c> can provide you with a list of configuration files
2368 that have newer versions at your disposal. Verify that none of the
2369 configuration files have a big impact (such as <path>/etc/fstab</path>,
2370 <path>/etc/make.conf</path>, <path>/etc/rc.conf</path>, ...). Merge the
2371 files that don't have such a big impact, remove the updates of the
2372 others or view the diff and manually update the configuration file.
2373 </warn>
2374 <pre caption="Rebooting the System">
2375 # <c>etc-update</c>
2376 # <c>exit</c>
2377 <comment>(This exits the chrooted shell; you can also type <c>^D</c>)</comment>
2378 # <c>cd / </c>
2379 # <c>umount /mnt/gentoo/boot</c>
2380 # <c>umount /mnt/gentoo/proc</c>
2381 # <c>umount /mnt/gentoo</c>
2382 # <c>reboot</c>
2383 <comment>(Don't forget to remove the bootable CD)</comment>
2384 </pre>
2385 <note>
2386 After rebooting, it is a good idea to run the <c>update-modules</c> command to create
2387 the <path>/etc/modules.conf</path> file. Instead of modifying this file directly, you should
2388 generally make changes to the files in <path>/etc/modules.d</path>.
2389 </note>
2390 <p>If you have any questions or would like to get involved with Gentoo Linux development,
2391 consider joining our gentoo-user and gentoo-dev mailing lists
2392 (more information on our <uri link="http://www.gentoo.org/main/en/lists.xml">mailing lists</uri> page).
2393 We also have a handy <uri link="http://www.gentoo.org/doc/en/desktop.xml">Desktop configuration guide</uri>
2394 that will
2395 help you to continue configuring your new Gentoo Linux system, and a useful
2396 <uri link="http://www.gentoo.org/doc/en/portage-user.xml">Portage user guide</uri>
2397 to help familiarize you with Portage basics. You can find the rest of the Gentoo Documentation
2398 <uri link="http://www.gentoo.org/main/en/docs.xml">here</uri>. If you have any other questions
2399 involving installation or anything for that matter, please check the Gentoo Linux
2400 <uri link="http://www.gentoo.org/doc/en/faq.xml">FAQ</uri>.
2401 Enjoy and welcome to Gentoo Linux!
2402 </p>
2403 </body>
2404 </section>
2405 </chapter>
2406 <chapter>
2407 <title>Gentoo-Stats</title>
2408 <section>
2409 <body>
2410 <p>The Gentoo Linux usage statistics program was started as an attempt to give the developers
2411 a way to find out about their user base. It collects information about Gentoo Linux usage to help
2412 us in set priorities our development. Installing it is completely optional, and it would be greatly
2413 appreciated if you decide to use it. Compiled statistics can be viewed at <uri>http://stats.gentoo.org/</uri>.
2414 </p>
2415 <p>The gentoo-stats server will assign a unique ID to your system.
2416 This ID is used to make sure that each system is counted only once. The ID will not be used
2417 to individually identify your system, nor will it be matched against an IP address or
2418 other personal information. Every precaution has been taken to assure your privacy in the
2419 development of this system. The following are the things that we are monitoring
2420 right now through our &quot;gentoo-stats&quot; program:
2421 </p>
2422 <ul>
2423 <li>installed packages and their version numbers</li>
2424 <li>CPU information: speed (MHz), vendor name, model name, CPU flags (like &quot;mmx&quot; or &quot;3dnow&quot;)</li>
2425 <li>memory information (total available physical RAM, total available swap space)</li>
2426 <li>PCI cards and network controller chips</li>
2427 <li>the Gentoo Linux profile your machine is using (that is, where the /etc/make.profile link is pointing to).</li>
2428 </ul>
2429 <p>We are aware that disclosure of sensitive information is a threat to most Gentoo Linux users
2430 (just as it is to the developers).
2431 </p>
2432 <ul>
2433 <li>Unless you modify the gentoo-stats program, it will never transmit sensitive
2434 information such as your passwords, configuration data, shoe size...</li>
2435 <li>Transmission of your e-mail addresses is optional and turned off by default.</li>
2436 <li>The IP address your data transmission originates from will never be logged
2437 in such a way that we can identify you. There are no &quot;IP address/system ID&quot; pairs.</li>
2438 </ul>
2439 <p>The installation is easy - just run the following commands:
2440 </p>
2441 <pre caption="Installing gentoo-stats">
2442 # <c>emerge gentoo-stats</c> <codenote>Installs gentoo-stats</codenote>
2443 # <c>gentoo-stats --new</c> <codenote>Obtains a new system ID</codenote>
2444 </pre>
2445 <p>The second command above will request a new system ID and enter it into
2446 <path>/etc/gentoo-stats/gentoo-stats.conf</path> automatically. You can view this file
2447 to see additional configuration options.
2448 </p>
2449 <p>After that, the program should be run on a regular schedule
2450 (gentoo-stats does not have to be run as root). Add this line to your <path>crontab</path>:
2451 </p>
2452 <pre caption="Updating gentoo-stats with cron">
2453 <c>0 0 * * 0,4 /usr/sbin/gentoo-stats --update &gt; /dev/null</c>
2454 </pre>
2455 <p>The <c>gentoo-stats</c> program is a simple perl script which can be
2456 viewed with your favorite pager or editor: <path>/usr/sbin/gentoo-stats</path>. </p>
2457 </body>
2458 </section>
2459 </chapter>
2460 <chapter>
2461 <title>Gentoo On Less-Common Hardware</title>
2462 <section>
2463 <title>Hardware ATA RAID</title>
2464 <body>
2465 <p>
2466 Users who want to install Gentoo on Hardware ATA RAID must pay
2467 attention to the next steps in order for them to succesfully
2468 install Gentoo Linux:
2469 </p>
2470 <ul>
2471 <li>Be sure to start the LiveCD with the <c>doataraid</c>
2472 kerneloption.</li>
2473 <li>If you've forgotten to select <c>doataraid</c> during bootup,
2474 or the modules mysteriously didn't load, load them as needed:
2475 <pre caption = "Loading RAID modules">
2476 # <i>modprobe ataraid</i>
2477 <comment>For Promise Raid Controllers:</comment>
2478 # <i>modprobe pdcraid</i>
2479 <comment>For Highpoint Raid Controllers:</comment>
2480 # <i>modprobe hptraid</i>
2481 </pre>
2482 </li>
2483 <li>Some ATA RAID Controllers require you to reboot after
2484 partitioning; formatting will otherwise fail.</li>
2485 <li>Before chrooting, mount the devicetree into the new
2486 environment:
2487 <pre caption = "Mounting /dev into /mnt/gentoo/dev">
2488 # <i>mount -o bind /dev /mnt/gentoo/dev</i>
2489 </pre>
2490 </li>
2491 <li>During kernel configuration, select the required RAID options:
2492 <pre caption = "RAID in the Linux Kernel Configuration">
2493 <comment>For Highpoint RAID controllers:</comment>
2494 ATA/IDE/MFM/RLL support ---&gt;
2495 [*] HPT36X/37X chipset support
2496 [*] Support for IDE Raid controllers
2497 [*] Highpoint 370 software RAID
2498 <comment>For Promise RAID controllers:</comment>
2499 ATA/IDE/MFM/RLL support ---&gt;
2500 [*] PROMISE PDC202{46|62|65|67} support
2501 <comment>and/or</comment>
2502 [*] PROMISE PDC202{68|69|70|71|75|76|77} support
2503 [*] Support for IDE Raid controllers
2504 [*] Support Promise software RAID (Fasttrak(tm))
2505 </pre></li>
2506 <li>When using GRUB add <c>--stage2=/boot/grub/stage2</c> when
2507 running <c>grub</c> to the <c>setup</c> command:
2508 <pre caption = "Installing GRUB for Hardware RAID systems">
2509 grub&gt; <i>root (hd0,0)</i>
2510 grub&gt; <i>setup --stage2=/boot/grub/stage2 (hd0)</i>
2511 grub&gt; <i>quit</i>
2512 </pre>
2513 Also, in the GRUB configuration be sure to point the <c>root</c>
2514 to the appropriate RAID device:
2515 <pre caption = "grub.conf for RAID">
2516 title=My Gentoo Linux on RAID
2517 root (hd0,0)
2518 kernel (hd0,0)/boot/bzImage root=/dev/ataraid/dXpY
2519 </pre></li>
2520 <li>LILO users should set the <c>root</c> option to the
2521 appropriate RAID device:
2522 <pre caption = "lilo.conf for RAID">
2523 image=/boot/bzImage
2524 label=linux
2525 read-only
2526 root=/dev/ataraid/dXpY
2527 </pre></li>
2528 </ul>
2529 </body>
2530 </section>
2531 </chapter>
2532 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20