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

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.149 - (show annotations) (download) (as text)
Fri Aug 8 09:37:12 2003 UTC (14 years, 11 months ago) by swift
Branch: MAIN
Changes since 1.148: +2378 -1809 lines
File MIME type: application/xml
Major cleanup, but no real content changes:
	- Have <path>'s around all files and devices
	- Always use <i> instead of <c> in <pre>'s
	- Don't use <i> elsewhere
	- User-command or things that users must type in and are
	  not in <pre>'s are in <c>'s
	- Every paragraph explaining what the next <pre> is going to
	  do ends with a colon (:)
	- Replace ",)" with ")," and ".)" with ")." except in some cases
	- ", and" should not be used; it's "and" without ",".

I've also made huge changes in the layout of the sourcecode (no
indentation, wordwrapping except in <ul> and <table> clauses, ...

There are some English word changes or sentence constructs, but they do
not change the content of the document by itself. So translators
shouldn't really worry about this change.

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

  ViewVC Help
Powered by ViewVC 1.1.20