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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.94 - (show annotations) (download) (as text)
Fri Mar 21 08:09:40 2003 UTC (14 years, 7 months ago) by drobbins
Branch: MAIN
Changes since 1.93: +3 -6 lines
File MIME type: application/xml
a fix for ZhEN's /proc mount fix

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_rc3 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">
10 <mail link="">Jerry Alexandratos</mail>
11 </author>
12 <author title="Ghost">
13 <mail link="g2boojum@gentoo.org">Grant Goodyear</mail>
14 </author>
15 <author title="Editor">
16 <mail link="zhen@gentoo.org">John P. Davis</mail>
17 </author>
18 <author title="Editor">
19 <mail link="Pierre-Henri.Jondot@wanadoo.fr">Pierre-Henri Jondot</mail>
20 </author>
21 <author title="Editor">
22 <mail link="stocke2@gentoo.org">Eric Stockbridge</mail>
23 </author>
24 <author title="Editor">
25 <mail link="rajiv@gentoo.org">Rajiv Manglani</mail>
26 </author>
27 <author title="Editor">
28 <mail link="seo@gentoo.org">Jungmin Seo</mail>
29 </author>
30 <author title="Editor">
31 <mail link="zhware@gentoo.org">Stoyan Zhekov</mail>
32 </author>
33 <author title="Editor">
34 <mail link="jhhudso@gentoo.org">Jared Hudson</mail>
35 </author>
36 <author title="Editor">
37 <mail link="">Colin Morey</mail>
38 </author>
39 <abstract>These instructions step you through the process of installing Gentoo
40 Linux 1.4_rc3. The Gentoo Linux installation process supports various installation
41 approaches, depending upon how much of the system you want to custom-build from
42 scratch.
43 </abstract>
44 <version>2.6</version>
45 <date>20 March 2003</date>
46 <chapter>
47 <title>About the Install</title>
48 <section>
49 <body>
50 <p>This new boot CD will boot from nearly any modern IDE CD-ROM drive, as well
51 as many SCSI CD-ROM drives, assuming that your CD-ROM and BIOS both support booting.
52 Included on the CD-ROM is Linux support for IDE (and PCI IDE) (built-in to the
53 kernel) as well as support for all SCSI devices (available as modules.) In
54 addition, we provide modules for literally every kind of network card that
55 Linux supports, as well as tools to allow you to configure your network and
56 establish outbound (as well as inbound) <c>ssh</c> connections and to download
57 files. </p>
58 <p>To install from the build CD, you will need to have a 486+ processor and
59 ideally at least 64 Megabytes of RAM. (Gentoo Linux has been successfully
60 built with 64MB of RAM + 64MB of swap space, but the build process is awfully
61 slow under those conditions.)</p>
62 <p>Gentoo Linux can be installed using one of three &quot;stage&quot; tarball files. The
63 one you choose depends on how much of the system you want to compile yourself.
64 The stage1 tarball is used when you want to bootstrap and build the entire
65 system from scratch. The stage2 tarball is used for building the entire system
66 from a bootstrapped state. The stage3 tarball already contains a basic Gentoo Linux system.</p>
67 <p><b>So, should you choose to start from a stage1, stage2, or stage3 tarball?</b>
68 Starting from a stage1 allows you to have total control over the optimization settings
69 and optional build-time functionality that is initially enabled on your system. This
70 makes stage1 installs good for power users who know what they are doing. Stage2 installs
71 allow you to skip the bootstrap process, and doing this is fine if you are happy with
72 the optimization settings that we chose for your particular stage2 tarball. Choosing to
73 go with a stage3 allows for the fastest install of Gentoo Linux, but also means that
74 your base system will have the optimization settings that we chose for you. Since major
75 releases of Gentoo Linux have stage3's specifically optimized for various popular processors,
76 this may be sufficient for you. <b>If you're installing Gentoo Linux for the first time, consider
77 using a stage3 tarball for installation.</b></p>
78
79
80 <p> So, how does one begin the install process? First, you will want to decide which one of our LiveCD ISO images to grab from
81 <uri>http://www.ibiblio.org/gentoo/releases/1.4_rc3/x86/</uri> .
82 </p>
83 <p> The LiveCDs are full CD images that should be burned to a CDR or CD-RW
84 using CD burning software. Currently, we have two types of LiveCDs. The first
85 carries the &quot;gentoo-basic&quot; label, and is approximately 40MB in size, contains only the stage 1 tarball and lives
86 in the <path>x86/livecd/</path> directory. This LiveCD is of minimal size to
87 allow for a initial quick download and contains a stage1 tarball that can be
88 found in <path>/mnt/cdrom/gentoo/</path> after the CD has booted.</p>
89 <p>The second flavor of LiveCD we currently offer is labeled &quot;gentoo-3stages.&quot;
90 This CD is also found in <path>x86/livecd</path>. It
91 contains stage 1, 2 and 3 tarballs. Using this LiveCD, it will be possible
92 for you to install a fully-functional Gentoo Linux system very quickly.</p>
93 <p><b>What happened to i686, pentium3, athlon, athlon-mp stages, LiveCDs and GRP (Gentoo Reference Platform)?</b>
94 Gentoo 1.4_rc3 is meant to be a minimal release candidate only. 1.4_rc4 will contain all the usual x86 architectures and GRP. If you want to install stages optimized for these other x86 architectures or GRP, use the 1.4_rc2 documentation, which can be found at <uri>http://www.gentoo.org/doc/en/gentoo-x86-1.4_rc2-install.xml</uri>
95 </p>
96 <impo>If you encounter a problem with any part of the install and wish to
97 report it as a bug, report it to <uri>http://bugs.gentoo.org</uri>. If the bug
98 needs to be sent upstream to the original software developers (eg the KDE team) the
99 <e>Gentoo Linux developers</e> will take care of that for you.
100 </impo>
101 <p>Now, let us quickly review the install process. First, we will download, burn
102 and boot a LiveCD. After getting a root prompt, we will create partitions, create
103 our filesystems, and extract either a stage1, stage2 or stage3 tarball. If we
104 are using a stage1 or stage2 tarball, we will take the appropriate steps to get
105 our system to stage3. Once our system is at stage3, we can configure it
106 (customize configuration files, install a boot loader, etc) and boot it and have a
107 fully-functional Gentoo Linux system. Depending on what stage of the build
108 process you're starting from, here is what is required for installation: </p>
109 <table>
110 <tr>
111 <th>stage tarball</th>
112 <th>requirements for installation</th>
113 </tr>
114 <tr>
115 <ti>1</ti>
116 <ti>partition/filesystem setup, emerge sync, bootstrap, emerge system, emerge kernel sources, final configuration</ti>
117 </tr>
118 <tr>
119 <ti>2</ti>
120 <ti>partition/filesystem setup, emerge sync, emerge system, emerge kernel sources, final configuration</ti>
121 </tr>
122 <tr>
123 <ti>3</ti>
124 <ti>partition/filesystem setup, emerge sync, final configuration</ti>
125 </tr>
126 </table>
127 </body>
128 </section>
129 </chapter>
130 <chapter>
131 <title>Booting</title>
132 <section>
133 <body>
134 <p>Start by booting the LiveCD. You should see a fancy boot screen
135 with the Gentoo Linux logo on it. At this screen, you can hit Enter to begin the boot process,
136 or boot the LiveCD with custom boot options by typing <c>gentoo opt1 opt2</c> and then hitting Enter. To see
137 a detailed description of available boot options, press F2 to view the help screen.</p>
138
139 <p> Once you hit Enter, you will be greeted with the standard kernel
140 booting output, kernel and initrd messages, followed by the normal Gentoo
141 Linux boot sequence. You will be automatically logged in as
142 &quot;<c>root</c>&quot; and the root password will be set to a random string
143 for security purposes. You should have a root (&quot;<c>#</c>&quot;) prompt
144 on the current console, and can also switch to other consoles by pressing
145 Alt-F2, Alt-F3 and Alt-F4. Get back to the one you started on by pressing
146 Alt-F1. At this point you should set the root password, type passwd and
147 follow the prompts.
148 </p>
149 <p>You've probably also noticed that above your <c>#</c> prompt is a bunch of help text
150 that explains how to do things like configure your Linux networking and telling you where you can find
151 the Gentoo Linux stage tarballs and packages on your CD.
152 </p>
153 </body>
154 </section>
155 </chapter>
156 <chapter>
157 <title>Load Kernel Modules</title>
158 <section>
159 <body>
160 <p>If the PCI autodetection missed some of your hardware, you
161 will have to load the appropriate kernel modules manually.
162 To view a list of all available network card modules, type <c>ls
163 /lib/modules/*/kernel/drivers/net/*</c>. To load a particular module,
164 type:
165 </p>
166 <pre caption="PCI Modules Configuration">
167 # <c>modprobe pcnet32</c>
168 <comment>(replace pcnet32 with your NIC module)</comment>
169 </pre>
170 <p>Likewise, if you want to be able to access any SCSI hardware that wasn't detected
171 during the initial boot autodetection process, you will need to load the appropriate
172 modules from /lib/modules, again using <c>modprobe</c>:
173 </p>
174 <pre caption="Loading SCSI Modules">
175 # <c>modprobe aic7xxx</c>
176 <comment>(replace aic7xxx with your SCSI adapter module)</comment>
177 # <c>modprobe sd_mod</c>
178 <comment>(sd_mod is the module for SCSI disk support)</comment>
179 </pre>
180 <note>
181 Support for a SCSI CD-ROMs and disks are built-in in the kernel.
182 </note>
183 <p>If you are using hardware RAID, you will need to load the
184 ATA-RAID modules for your RAID controller.
185 </p>
186 <pre caption="Loading RAID Modules">
187 # <c>modprobe ataraid</c>
188 # <c>modprobe pdcraid</c>
189 <comment>(Promise Raid Controller)</comment>
190 # <c>modprobe hptraid</c>
191 <comment>(Highpoint Raid Controller)</comment>
192 </pre>
193 <p>The Gentoo LiveCD should have enabled DMA on your disks, but if it did not,
194 <c>hdparm</c> can be used to set DMA on your drives. </p>
195 <pre caption="Setting DMA">
196 <comment>Replace hdX with your disk device.</comment>
197 # hdparm -d 1 /dev/hdX <comment>Enables DMA </comment>
198 # hdparm -d1 -A1 -m16 -u1 -a64 /dev/hdX
199 <comment>(Enables DMA and other safe performance-enhancing options)</comment>
200 # hdparm -X66 /dev/hdX
201 <comment>(Force-enables Ultra-DMA -- dangerous -- may cause some drives to mess up)</comment>
202 </pre>
203 </body>
204 </section>
205 </chapter>
206 <!-- THIS SECTION SHOULD BE DEPRECATED WITH HOTPLUG ENABLED IN 1.4_rc3 (drobbins)
207 <chapter>
208 <title>Loading PCMCIA Kernel Modules</title>
209 <section>
210 <body>
211 <p>If you have a PCMCIA network card, you will need to perform a few extra steps.
212 </p>
213 <warn>To avoid problems with <c>cardmgr</c>, you <e>must</e> run it <e>before</e> you enter the chroot
214 portion of the install. </warn>
215 <pre caption="Loading PCMCIA Modules">
216 # <i>modprobe pcmcia_core</i>
217 # <i>modprobe i82365</i>
218 # <i>modprobe ds</i>
219 # <i>cardmgr -f</i>
220 </pre>
221 <p>As <c>cardmgr</c> detects which hardware is present, your speaker should emit a
222 few reassuring beeps, and your PCMCIA network card should be active. You can
223 of course insert the PCMCIA card after loading <c>cardmgr</c> too, if that is
224 preferable. (Technically, you need not run
225 <c>cardmgr</c> if you know exactly which module your PCMCIA card requires.
226 But if you don't, loading all PCMCIA modules and see which sticks won't work,
227 as all PCMCIA modules load obligingly and hang around for a PCMCIA card to
228 drop by. <c>cardmgr</c> will also unload the module(s) for any card when you
229 remove it). </p>
230 </body>
231 </section>
232 </chapter>
233 -->
234 <chapter>
235 <title>Configuring Networking</title>
236 <section>
237 <title>Maybe it just works?</title>
238 <body>
239 <p>If you're using a 1.4_rc3 or later LiveCD, it is possible that your networking has already been
240 configured automatically for you. If so, you should be able to take advantage of the many included
241 network-aware commands on the LiveCD such as <c>ssh</c>, <c>scp</c>, <c>ping</c>, <c>irssi</c>, <c>wget</c> and <c>lynx</c>,
242 among others.</p>
243
244 <p>If networking has been configured for you, the <c>/sbin/ifconfig</c> command should
245 list some internet interfaces besides <c>lo</c>, such as <c>eth0</c>:
246 </p>
247 <pre caption="/sbin/ifconfig for a working network card">
248 eth0 Link encap:Ethernet HWaddr 00:50:BA:8F:61:7A
249 inet addr:192.168.0.2 Bcast:192.168.0.255 Mask:255.255.255.0
250 inet6 addr: fe80::50:ba8f:617a/10 Scope:Link
251 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
252 RX packets:1498792 errors:0 dropped:0 overruns:0 frame:0
253 TX packets:1284980 errors:0 dropped:0 overruns:0 carrier:0
254 collisions:1984 txqueuelen:100
255 RX bytes:485691215 (463.1 Mb) TX bytes:123951388 (118.2 Mb)
256 Interrupt:11
257 </pre>
258 <p>You may want to also try pinging your ISP's DNS server (found in <path>/etc/resolv.conf</path>),
259 and a Web site of choice, just to make sure that your packets are reaching the net, DNS name
260 resolution is working correctly, etc.
261 </p>
262 <pre caption="Further Network Testing">
263 # <c>ping -c 3 www.yahoo.com </c>
264 </pre>
265 <p>Are you able to use your network? If so, you can skip the rest of this section.</p>
266 </body>
267 </section>
268 <section>
269 <title> PPPoE configuration</title>
270 <body>
271 <p>Assuming you need PPPoE to connect to the internet, the LiveCD (any version) has
272 made things easy for you by including <c>rp-pppoe</c>. Use the provided <c>adsl-setup</c>
273 script to configure your connection. You will be prompted for the ethernet
274 device that is connected to your adsl modem, your username and password,
275 the IPs of your DNS servers, and if you need a basic firewall or not. </p>
276 <pre caption="Configuring PPPoE">
277 # <c> adsl-setup </c>
278 # <c> adsl-start </c>
279 </pre>
280 <p>If something goes wrong, double-check that you correctly typed
281 your username and password by looking at <path>/etc/ppp/pap-secrets</path> or
282 <path>/etc/ppp/chap-secrets</path>, and make sure you are using the right ethernet device. </p>
283 </body>
284 </section>
285 <section>
286 <title> Automatic Network Configuration </title>
287 <body>
288 <p>The simplest way to set up networking if it didn't get configured automatically is to run the <c>net-setup</c> script.</p>
289 <pre caption="Net-Setup Script">
290 # <c>net-setup eth0</c>
291 </pre>
292 <p>Of course, if you prefer, you may still set up networking manually. This is covered next.</p>
293 </body>
294 </section>
295 <section>
296 <title>Manual DHCP Configuration</title>
297 <body>
298 <p>Network configuration is simple with DHCP; If your ISP is not using
299 DHCP, skip down to the static configuration section below. </p>
300 <pre caption="Network configuration with DHCP">
301 # <c>dhcpcd eth0</c>
302 </pre>
303 <note>Some ISPs require you to provide a hostname. To do that,
304 add a <c>-h myhostname</c> flag to the dhcpcd command line above.
305 </note>
306 <p>If you receive <i>dhcpConfig</i> warnings, don't panic; the errors
307 are most likely cosmetic. Skip down to Network testing below.</p>
308 </body>
309 </section>
310 <section>
311 <title>Manual Static Configuration</title>
312 <body>
313 <p>We need to setup just enough networking so that we can download
314 sources for the system build, as well as the required localhost interface.
315 Type in the following commands, replacing
316 $IFACE with your network interface (typically <c>eth0</c>), $IPNUM
317 with your IP address, $BCAST with your broadcast address, and $NMASK
318 with your network mask. For the <c>route</c> command, replace
319 $GTWAY with your default gateway.
320 </p>
321 <pre caption="Static IP Network Configuration">
322 # <c>ifconfig $IFACE $IPNUM broadcast $BCAST netmask $NMASK</c>
323 # <c>/sbin/route add -net default gw $GTWAY netmask 0.0.0.0 metric 1</c>
324 </pre>
325 <p>Now it is time to create the <path>/etc/resolv.conf</path>
326 file so that name resolution (finding Web/FTP sites by name, rather than just by IP address) will work.</p>
327 <p>Here is a template to follow for creating your /etc/resolv.conf file: </p>
328 <pre caption="/etc/resolv.conf template">
329 domain mydomain.com
330 nameserver 10.0.0.1
331 nameserver 10.0.0.2
332 </pre>
333 <p>Replace <c>10.0.0.1</c> and <c>10.0.0.2</c> with the IP addresses of your
334 primary and secondary DNS servers respectively.</p>
335 </body>
336 </section>
337 <section>
338 <title>Proxy Configuration</title>
339 <body>
340 <p>If you are behind a proxy, it is necessary to configure your proxy before
341 you continue. We will export some variables to set up the proxy accordingly.
342 </p>
343 <pre caption="Setting a Proxy">
344 # <c>export http_proxy=&quot;machine.company.com:1234&quot; </c>
345 # <c>export ftp_proxy=&quot;$http_proxy&quot; </c>
346 # <c>export RSYNC_PROXY=&quot;$http_proxy&quot; </c>
347 </pre>
348 </body>
349 </section>
350 <section>
351 <title>Networking is go!</title>
352 <body>
353 <p>Networking should now be configured and usable. You should be able to use the included
354 <c>ssh</c>, <c>scp</c>, <c>lynx</c>, <c>irssi</c> and <c>wget</c> commands to connect to other machines on your LAN or the Internet.</p>
355 </body>
356 </section>
357 </chapter>
358 <chapter>
359 <title>Setting your system's date and time</title>
360 <section>
361 <body>
362 <p>Now you need to set your system's date and time.
363 You can do this using the <c>date</c> command.</p>
364 <pre caption="Setting your system's date">
365 # <c>date</c>
366 Thu Feb 27 09:04:42 CST 2003
367 <comment>(If your date is wrong, set your date with this next command)</comment>
368 # <c>date 022709042003</c>
369 <comment>(date MMDDhhmmCCYY)</comment>
370 </pre>
371 </body>
372 </section>
373 </chapter>
374 <chapter>
375 <title>Filesystems, partitions and block devices</title>
376 <section>
377 <title>Introduction to block devices</title>
378 <body>
379 <p>
380 In this section, we'll take a good look at disk-oriented aspects of Gentoo Linux and Linux in general, including
381 Linux filesystems, partitions and block devices. Then, once you're familar with the ins and outs of disks and
382 filesystems, you'll be guided through the process of setting up partitions and filesystems for your Gentoo Linux
383 install.
384 </p>
385 <p>
386 To begin, I'll introduce "block devices". The most famous block device is
387 probably the one that represents the first IDE drive in a Linux system:
388 </p>
389 <pre caption="/dev/hda, the block device representing the primary master IDE drive in your system">
390 /dev/hda
391 </pre>
392
393 <p>
394 If your system uses SCSI drives, then your first hard drive will be:
395 </p>
396
397 <pre caption="/dev/sda, the block device representing the first logical SCSI drive in your system">
398 /dev/sda
399 </pre>
400
401 <p>The block devices above represent an <i>abstract</i> interface to the disk.
402 User programs can use these block devices to interact with your disk without
403 worrying about whether your drivers are IDE, SCSI or something else. The
404 program can simply address the storage on the disk as a bunch of contiguous,
405 randomly-accessible 512-byte blocks. </p>
406 </body>
407 </section>
408 <section>
409 <title>Partitions and fdisk</title>
410 <body>
411 <p> Under Linux, we create filesystems by using a special command called
412 <c>mkfs</c> (or <c>mke2fs</c>, <c>mkreiserfs</c>, etc,) specifying a particular
413 block device as a command-line argument. </p>
414
415 <p> However, although it is theoretically possible to use a "whole disk" block
416 device (one that represents the <i>entire</i> disk) like <c>/dev/hda</c> or
417 <c>/dev/sda</c> to house a single filesystem, this is almost never done in
418 practice. Instead, full disk block devices are split up into smaller, more
419 manageable block devices called "partititons". Partitions are created using a
420 tool called <c>fdisk</c>, which is used to create and edit the partition table
421 that's stored on each disk. The partition table defines exactly how to split
422 up the full disk. </p>
423
424 <p> We can take a look at a disk's partition table by running <c>fdisk</c>,
425 specifying a block device that represents a full disk as an argument: </p>
426
427 <note>Alternate interfaces to the disk's partition table include <c>cfdisk</c>,
428 <c>parted</c> and <c>partimage</c></note>
429
430 <pre caption="Starting up fdisk">
431 # fdisk /dev/hda
432 </pre>
433 <p>
434 or
435 </p>
436 <pre caption="Starting up fdisk to look at the partition table on /dev/sda">
437 # fdisk /dev/sda
438 </pre>
439
440 <impo>
441 <b>Note that you should <i>not</i> save or make any changes to a disk's
442 partition table if any of its partitions contain filesystems that are in use or
443 contain important data. Doing so will generally cause data on the disk to be
444 lost.</b>
445 </impo>
446
447 <p>
448 Once in fdisk, you'll be greeted with a prompt that looks like this:
449 </p>
450
451 <pre caption="The fdisk prompt">
452 Command (m for help):
453 </pre>
454
455
456 <p>
457 Type <c>p</c> to display your disk's current partition configuration:
458 </p>
459
460 <pre caption="An example partition configuration">
461 Command (m for help): p
462
463 Disk /dev/hda: 240 heads, 63 sectors, 2184 cylinders
464 Units = cylinders of 15120 * 512 bytes
465
466 Device Boot Start End Blocks Id System
467 /dev/hda1 1 14 105808+ 83 Linux
468 /dev/hda2 15 49 264600 82 Linux swap
469 /dev/hda3 50 70 158760 83 Linux
470 /dev/hda4 71 2184 15981840 5 Extended
471 /dev/hda5 71 209 1050808+ 83 Linux
472 /dev/hda6 210 348 1050808+ 83 Linux
473 /dev/hda7 349 626 2101648+ 83 Linux
474 /dev/hda8 627 904 2101648+ 83 Linux
475 /dev/hda9 905 2184 9676768+ 83 Linux
476
477 Command (m for help):
478 </pre>
479
480 <p> This particular disk is configured to house seven Linux filesystems (each
481 with a corresponding partition listed as "Linux") as well as a swap partition
482 (listed as "Linux swap"). </p>
483
484 <p>
485 Notice the name of the corresponding partition block
486 devices on the left hand side, starting with <c>/dev/hda1</c> and going up to
487 <c>/dev/hda9</c>. In the early days of the PC, partitioning software only
488 allowed a maximum of four partitions (called "primary" partitions). This was
489 too limiting, so a workaround called an <i>extended partitioning</i> was
490 created. An extended partition is very similar to a primary partition, and
491 counts towards the primary partition limit of four. However, extended
492 partitions can hold any number of so-called <i>logical</i> partitions inside
493 them, providing an effective means of working around the four partition limit.
494 </p>
495
496 <p>
497 All partitions <c>hda5</c> and higher are logical partitions. The numbers 1
498 through 4 are reserved for primary or extended partitions. </p>
499
500 <p> So, In our example, <c>hda1</c> through <c>hda3</c> are primary partitions.
501 <c>hda4</c> is an extended partition that contains logical partitions
502 <c>hda5</c> through <c>hda9</c>. You would never actually
503 <i>use</i> <c>/dev/hda4</c> for storing any filesystems directly -- it simply
504 acts as a container for partitions <c>hda5</c> through <c>hda9</c>. </p>
505
506 <p> Also, notice that each partition has an "Id", also called a "partition
507 type". Whenever you create a new partition, you should ensure that the
508 partition type is set correctly. '83' is the correct partition type for
509 partitions that will be housing Linux filesystems, and '82' is the correct
510 partition type for Linux swap partitions. You set the partition type using the
511 <c>t</c> option in <c>fdisk</c>. The Linux kernel uses the partition type
512 setting to auto-detect fileystems and swap devices on the disk at boot-time.
513 </p>
514 </body>
515 </section>
516 <section>
517 <title>Using fdisk to set up partitions</title>
518 <body>
519
520 <p>Now that you've had your introduction to the way disk partitioning is
521 done under Linux, it's time to walk you through the process of setting up disk
522 partitions for your Gentoo Linux installation. After we walk you through the
523 process of creating partitions on your disk, your partition configuration will
524 look like this: </p>
525
526 <pre caption="The partition configuration that you will have after following these steps">
527 Disk /dev/hda: 30.0 GB, 30005821440 bytes
528 240 heads, 63 sectors/track, 3876 cylinders
529 Units = cylinders of 15120 * 512 = 7741440 bytes
530
531 Device Boot Start End Blocks Id System
532 /dev/hda1 * 1 14 105808+ 83 Linux
533 /dev/hda2 15 81 506520 82 Linux swap
534 /dev/hda3 82 3876 28690200 83 Linux
535
536 Command (m for help):
537 </pre>
538
539 <p>In our suggested "newbie" partition configuration, we have three partitions.
540 The first one (<c>/dev/hda1</c>) at the beginning of the disk is a small
541 partition called a boot partition. The boot partition's purpose is to hold all
542 the critical data related to booting -- GRUB boot loader information (if you
543 will be using GRUB) as well as your Linux kernel(s). The boot partition gives
544 us a safe place to store everything related to booting Linux. During normal
545 day-to-day Gentoo Linux use, your boot partition should remain <e>unmounted</e>
546 for safety. If you are setting up a SCSI system, your boot partition will
547 likely end up being <c>/dev/sda1</c>.</p>
548
549 <p>The second partition (<c>/dev/hda2</c>) is used to for swap space. The
550 kernel uses swap space as virtual memory when RAM becomes low. This partition,
551 relatively speaking, isn't very big either, typically somewhere around 512MB.
552 If you're setting up a SCSI system, this partition will likely end up
553 being called <c>/dev/sda2</c>. </p>
554
555 <p>The third partition (<c>/dev/hda3</c>) is quite large and takes up the rest
556 of the disk. This partition is called our "root" partition and will be used to
557 store your main filesystem that houses Gentoo Linux itself. On a SCSI system,
558 this partition would likely end up being <c>/dev/sda3</c>.</p>
559
560
561 <p>Before we partition the disk, here's a quick technical overview of the
562 suggested partition and filesystem configuration to use when installing Gentoo
563 Linux:</p>
564
565 <table>
566 <tr>
567 <th>Partition</th>
568 <th>Size</th>
569 <th>Type</th>
570 <th>example device</th>
571 </tr>
572 <tr>
573 <ti>boot partition, containing kernel(s) and boot information</ti>
574 <ti>100 Megabytes</ti>
575 <ti>ext2/3 highly recommended (easiest); if ReiserFS then mount with <c>-o notail</c></ti>
576 <ti>/dev/hda1</ti>
577 </tr>
578 <tr>
579 <ti>swap partition (no longer a 128 Megabyte limit, now 2GB)</ti>
580 <ti>Generally, configure a swap area that is between one to two times the size of the physical RAM
581 in your system.</ti>
582 <ti>Linux swap</ti>
583 <ti>/dev/hda2</ti>
584 </tr>
585 <tr>
586 <ti>root partition, containing main filesystem (/usr, /home, etc)</ti>
587 <ti>&gt;=1.5 Gigabytes</ti>
588 <ti>ReiserFS, ext3 recommended; ext2 ok</ti>
589 <ti>/dev/hda3</ti>
590 </tr>
591 </table>
592
593 <p>OK, now to create the partitions as in the example and table above. First,
594 enter fdisk by typing <c>fdisk /dev/hda1</c> or <c>fdisk /dev/sda1</c>,
595 depending on whether you're using IDE or SCSI. Then, type <c>p</c> to view your
596 current partition configuration. Is there anything on the disk that you need
597 to keep? If so, <b>stop now</b>. If you continue with these directions, <b>all
598 existing data on your disk will be erased.</b></p>
599
600 <impo>Following these instructions below will cause all prior data on your disk
601 to <b>be erased</b>! If there is anything on your drive, please be sure that it
602 is non-critical information that you don't mind losing. Also make sure that you
603 <b>have selected the correct drive</b> so that you don't mistakenly wipe data
604 from the wrong drive.</impo>
605
606 <p>Now, it's time to delete any existing partitions. To do this, type <c>d</c>
607 and hit Enter. You will then be prompted for the partition number you would like
608 to delete. To delete a pre-existing <c>/dev/hda1</c>, you would type:</p>
609
610 <pre caption="Deleting a partition">
611 Command (m for help): d
612 Partition number (1-4): 1
613 </pre>
614
615 <p>The partition has been scheduled for deletion. It will no longer show up if
616 you type <c>p</c>, but it will not be erased until your changes have been
617 saved. If you made a mistake and want to abort without saving your changes,
618 type <c>q</c> immediately and hit enter and your partition will not be
619 deleted.</p>
620 <!-- NOTE: THis is not sufficient documentation to cover ATA Raid and I just
621 find it confusing, so I'm commenting it out (drobbins)
622 <note>If you are using RAID your partitions will be a little different. You
623 will have the partitions like this: <path>/dev/ataraid/discX/partY</path> X are
624 the arrays you have made, so if you only have made 1 array, then it will be
625 disc0.Y is the partition number as in <path>/dev/hdaY</path> </note>
626 -->
627 <p>Now, assuming that you do indeed want to wipe out all the partitions on your
628 system, repeatedly type <c>p</c> to print out a partition listing and then type
629 <c>d</c> and the number of the partition to delete it. Eventually, you'll end up
630 with a partition table with nothing in it:</p>
631
632 <pre caption="An empty partition table">
633 Disk /dev/hda: 30.0 GB, 30005821440 bytes
634 240 heads, 63 sectors/track, 3876 cylinders
635 Units = cylinders of 15120 * 512 = 7741440 bytes
636
637 Device Boot Start End Blocks Id System
638
639 Command (m for help):
640 </pre>
641
642 <p>Now that the in-memory partition table is empty, we're ready to create a
643 boot partition. To do this, type <c>n</c> to create a new partition, then
644 <c>p</c> to tell fdisk you want a primary partition. Then type <c>1</c> to
645 create the first primary partition. When prompted for the first cylinder, hit
646 enter. When prompted for the last cylinder, type <c>+100M</c> to create a
647 partition 100MB in size. You can see output from these steps below:</p>
648
649 <pre caption="Steps to create our boot partition">
650 Command (m for help): n
651 Command action
652 e extended
653 p primary partition (1-4)
654 p
655 Partition number (1-4): 1
656 First cylinder (1-3876, default 1):
657 Using default value 1
658 Last cylinder or +size or +sizeM or +sizeK (1-3876, default 3876): +100M
659 </pre>
660
661 <p>Now, when you type <c>p</c>, you should see the following partition printout:</p>
662
663 <pre caption="Our first partition has been created">
664 Command (m for help): p
665
666 Disk /dev/hda: 30.0 GB, 30005821440 bytes
667 240 heads, 63 sectors/track, 3876 cylinders
668 Units = cylinders of 15120 * 512 = 7741440 bytes
669
670 Device Boot Start End Blocks Id System
671 /dev/hda1 1 14 105808+ 83 Linux
672 </pre>
673
674 <p>Next, let's create the swap partition. To do this, type <c>n</c> to create a
675 new partition, then <c>p</c> to tell fdisk that you want a primary partition. Then
676 type <c>2</c> to create the second primary partition, <c>/dev/hda2</c> in our case.
677 When prompted for the first cylinder, hit enter. When prompted for the last cylinder,
678 type <c>+512M</c> to create a partition 512MB in size. After you've done this, type
679 <c>t</c> to set the partition type, and then type in <c>82</c> to set the partition
680 type to "Linux Swap". After completing these steps, typing <c>p</c> should display
681 a partition table that looks similar to this:</p>
682
683 <pre caption="Our swap partition has been created">
684 Command (m for help): p
685
686 Disk /dev/hda: 30.0 GB, 30005821440 bytes
687 240 heads, 63 sectors/track, 3876 cylinders
688 Units = cylinders of 15120 * 512 = 7741440 bytes
689
690 Device Boot Start End Blocks Id System
691 /dev/hda1 1 14 105808+ 83 Linux
692 /dev/hda2 15 81 506520 82 Linux swap
693 </pre>
694
695 <p>Finally, let's create the root partition. To do this, type <c>n</c> to
696 create a new partition, then <c>p</c> to tell fdisk that you want a primary
697 partition. Then type <c>2</c> to create the second primary partition,
698 <c>/dev/hda3</c> in our case. When prompted for the first cylinder, hit enter.
699 When prompted for the last cylinder, hit enter to create a partition that takes
700 up the rest of the remaining space on your disk. After completing these steps,
701 typing <c>p</c> should display a partition table that looks similar to
702 this:</p>
703
704 <pre caption="Our root partition has been created">
705 Command (m for help): p
706
707 Disk /dev/hda: 30.0 GB, 30005821440 bytes
708 240 heads, 63 sectors/track, 3876 cylinders
709 Units = cylinders of 15120 * 512 = 7741440 bytes
710
711 Device Boot Start End Blocks Id System
712 /dev/hda1 1 14 105808+ 83 Linux
713 /dev/hda2 15 81 506520 82 Linux swap
714 /dev/hda3 82 3876 28690200 83 Linux
715 </pre>
716
717 <p>
718 Finally, we need to set the "bootable" flag on our boot partition and then write
719 our changes to disk. To tag <c>/dev/hda1</c> as a "bootable" partition, type
720 <c>a</c> at the menu and then type in <c>1</c> for the partition number. If you
721 type <c>p</c> now, you'll now see that <c>/dev/hda1</c> has a <c>*</c> in the "Boot"
722 column. Now, let's write our changes to disk. To do this, type <c>w</c> and hit
723 enter. Your disk partitions are now properly configured for a Gentoo Linux
724 install.
725 </p>
726
727 <note>If <c>fdisk</c> or <c>cfdisk</c> instruct you to do so, please reboot to
728 allow your system to detect the new partition configuration.</note>
729 </body>
730 </section>
731 <section>
732 <title>Creating filesystems</title>
733 <body>
734 <p>Now that the partitions have been created, it's time to set up filesystems on
735 the boot and root partitions so that they can be mounted and used to store data.
736 We will also configure the swap partition to serve as swap storage.
737 </p>
738
739 <p>Gentoo Linux supports a variety of different types of filesystems; each type has
740 its strengths and weaknesses and its own set of performance characteristics. Currently,
741 we support the creation of ext2, ext3, XFS, JFS and ReiserFS filesystems.</p>
742
743 <p>ext2 is the tried and true Linux filesystem but doesn't have metadata
744 journaling, which means that routine ext2 filesystem checks at startup time can
745 be quite time-consuming. There is now quite a selection of newer-generation
746 <i>journaled</i> filesystems that can be checked for consistency very quickly
747 and are thus generally preferred over their non-journaled counterparts.
748 Journaled filesystems prevent long delays when you boot your system and your
749 filesystem happens to be in an <i>inconsistent</i> state.</p>
750
751 <p>ext3 is the journaled version of the ext2 filesystem, providing metadata
752 journaling for fast recovery in addition to other enhanced journaling modes
753 like full data and ordered data journaling. ext3 is a very good and reliable
754 filesystem. It offers generally decent performance under most conditions.
755 Because it does not extensively employ the use of "trees" in its internal
756 design, it doesn't scale very well, meaning that it is not an ideal choice for
757 very large filesystems, or situations where you will be handling very large
758 files or large quantities of files in a single directory. But when used within
759 its design parameters, ext3 is an excellent filesystem.</p>
760
761 <p>ReiserFS is a B*-tree based filesystem that has very good overall
762 performance and greatly outperforms both ext2 and ext3 when dealing with small
763 files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales
764 extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is
765 now rock-solid and highly recommended for use both as a general-purpose
766 filesystem and for extreme cases such as the creation of large filesystems, the
767 use of many small files, very large files, and directories containing tens of
768 thousands of files. ReiserFS is the filesystem we recommend by default for all
769 non-boot partitions.</p>
770
771 <p>XFS is a filesystem with metadata journaling that is fully supported under
772 Gentoo Linux's <path>xfs-sources</path> kernel. It comes with a robust
773 feature-set and is optimized for scalability. We only recommend using this
774 filesystem on Linux systems with high-end SCSI and/or fibre channel storage and
775 a uninterruptible power supply. Because XFS aggressively caches in-transit data
776 in RAM, improperly designed programs (those that don't take proper precautions
777 when writing files to disk, and there are quite a few of them) can lose a good
778 deal of data if the system goes down unexpectedly.</p>
779
780 <p>JFS is IBM's own high performance journaling filesystem. It has recently
781 become production-ready, and there hasn't been a sufficient track record to
782 comment either positively nor negatively on its general stability at this
783 point.</p>
784
785 <p>If you're looking for the most rugged journaling filesystem, use ext3. If
786 you're looking for a good general-purpose high-performance filesystem with
787 journaling support, use ReiserFS; both ext3 and ReiserFS are mature,
788 refined and recommended for general use.</p>
789
790 <!-- Corner case, confusing
791 <p>But before creating filesystems, you may want to initialize the
792 beginning of your partition using <c>dd</c> if you are using a pre-existing partition that has been used before.
793 This is particularly helpful when you're going to create a new XFS filesystem on a partition that previously contained
794 a ReiserFS filesystem. Doing this will ensure that your new filesystem
795 will not be mis-identified by Linux's filesystem auto-detection code.
796 This can be done as follows:
797 </p>
798 <pre caption="Initializing first 1024 bytes of your partition">
799 # <c>dd if=/dev/zero of=/dev/hda3 bs=1k count=1</c>
800 <comment>(Replace /dev/hda3 with the partition you wish to &quot;clean.&quot;)</comment>
801 </pre>
802 <warn>The command above will destroy all data from <path>/dev/hda3</path>.
803 Be careful and check twice which partition you specify for zeroing.
804 If you make a mistake it might result in a loss of data.
805 </warn>
806 -->
807
808 <p>Based on our example above, we will use the following commands to initialize
809 all our partitions for use:</p>
810
811 <pre caption="Initializing our partitions (example)">
812 # mke2fs -j /dev/hda1
813 # mkswap /dev/hda2
814 # mkreiserfs /dev/hda3
815 </pre>
816
817 <p>We choose ext3 for our <c>/dev/hda1</c> boot partition because it is a robust journaling
818 filesystem supported by all major boot loaders. We used <c>mkswap</c> for our <c>/dev/hda2
819 </c> swap partition -- the choice is obvious here. And for our main root filesystem on
820 <c>/dev/hda3</c> we choose ReiserFS, since it is a solid journaling filesystem offering excellent
821 performance. Now, go ahead and initialize your partitions. Here are the various commands
822 available to create various filesystem types:</p>
823
824 <p><c>mkswap</c> is the command that is used to initialize swap partitions:</p>
825 <pre caption="Initializing Swap">
826 # <c>mkswap /dev/hda2</c>
827 </pre>
828 <p>You can use the <c>mke2fs</c> command to create ext2 filesystems:</p>
829 <pre caption="Creating an ext2 Filesystem">
830 # <i>mke2fs /dev/hda1</i>
831 </pre>
832 <p>If you would like to use ext3, you can create ext3 filesystems using
833 <c>mke2fs -j</c>:</p>
834 <pre caption="Creating an ext3 Filesystem">
835 # <c>mke2fs -j /dev/hda3</c>
836 </pre>
837 <note>You can find out more about using ext3 under Linux 2.4 at
838 <uri>http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html</uri>.</note>
839 <p>To create ReiserFS filesystems, use the <c>mkreiserfs</c> command:</p>
840 <pre caption="Creating a ReiserFS Filesystem">
841 # <c>mkreiserfs /dev/hda3</c>
842 </pre>
843 <p>To create an XFS filesystem, use the <c>mkfs.xfs</c> command:</p>
844 <pre caption="Creating a XFS Filesystem">
845 # <c>mkfs.xfs /dev/hda3</c>
846 </pre>
847 <note>You may want to add a couple of additional flags to the
848 <c>mkfs.xfs</c> command: <c>-d agcount=3 -l size=32m</c>.
849 The <c>-d agcount=3</c> command will lower the number of allocation groups.
850 XFS will insist on using at least 1 allocation group per 4 GB of your
851 partition, so, for example, if you have a 20 GB partition you will need
852 a minimum agcount of 5. The <c>-l size=32m</c> command increases the
853 journal size to 32 Mb, increasing performance.</note>
854
855 <p>To create JFS filesystems, use the <c>mkfs.jfs</c> command:</p>
856 <pre caption="Creating a JFS Filesystem">
857 # <c>mkfs.jfs /dev/hda3</c>
858 </pre>
859 </body>
860 </section>
861 </chapter>
862 <chapter>
863 <title>Mount Partitions</title>
864 <section>
865 <body>
866 <p>Now, we will activate our newly-initialized swap volume, since we may need the additional virtual memory that it
867 provides later:
868 </p>
869 <pre caption="Activating Swap">
870 # <c>swapon /dev/hda2</c>
871 </pre>
872
873 <p>Next, we will create the <path>/mnt/gentoo</path> and <path>/mnt/gentoo/boot</path> mount points,
874 and we will mount our filesystems to these mount points. Once our boot and root filesystems are
875 mounted, any files we copy or create inside <path>/mnt/gentoo</path> will be placed on our new filesystems.
876 Note that if you are setting up Gentoo
877 Linux with separate <path>/usr</path> or <path>/var</path> filesystems, these would get mounted to
878 <path>/mnt/gentoo/usr</path> and <path>/mnt/gentoo/var</path> respectively.
879 </p>
880
881 <impo>If your <e>boot</e> partition (the one holding the kernel) is ReiserFS, be sure to mount it
882 with the <c>-o notail</c> option so GRUB gets properly installed. Make sure
883 that <c>notail</c> ends up in your new <path>/etc/fstab</path> boot partition entry, too.
884 We will get to that in a bit.
885 </impo>
886
887 <pre caption="Creating Mount Points">
888 # <c>mkdir /mnt/gentoo</c>
889 # <c>mount /dev/hda3 /mnt/gentoo</c>
890 # <c>mkdir /mnt/gentoo/boot</c>
891 # <c>mount /dev/hda1 /mnt/gentoo/boot</c>
892 </pre>
893
894 <impo>If you are having problems mounting your boot partition with ext2, try using
895 <c>mount /dev/hXX /mnt/gentoo/boot -t ext2 </c> </impo>
896 </body>
897 </section>
898 </chapter>
899 <chapter>
900 <title>Stage tarballs and chroot</title>
901 <section>
902 <title>Selecting the desired stage tarball</title>
903 <body>
904
905 <p>
906 Now, you need to decide which one you would like to use as a
907 basis for the install if you haven't already.</p>
908
909 <p>If you are using the &quot;from scratch, build everything&quot; install
910 method, you will want to use the <path>stage1-x86-1.4_rc3.tar.bz2</path> image.
911 If you're using one of our bigger CDs like the "3stages" ISO, you will also
912 have a choice of a stage2 and stage3 image. These images allow you to save
913 time at the expense of configurability (we've already chosen compiler
914 optimizations and default USE variables for you.) The stages on the CD are
915 accessible at <path>/mnt/cdrom/gentoo</path>, and you can type <c>ls /mnt/cdrom/gentoo</c>
916 to see what's available on your CD.</p>
917
918 <p>If you would like to perform an install using a stage tarball that is
919 <i>not</i> on your CD , this is still possible, but you'll need to download the
920 stage you want using the following instructions. If you already have the stage
921 tarball you want to use (most users), then proceed to the "Extracting the stage
922 tarball" section.</p>
923
924 <pre caption="Downloading Required Stages">
925 # <c>cd /mnt/gentoo</c>
926 <comment>Use lynx to get the URL for your tarball:</comment>
927 # <c>lynx http://www.ibiblio.org/pub/Linux/distributions/gentoo/releases/1.4_rc3/x86/</c>
928 <comment>Use <c>Up</c> and <c>Down</c> arrows keys (or the <c>TAB</c> key) to go to the right directory
929 Highlight the appropriate stage you want to download
930 Press <c>d</c> which will initiate the download
931 Save the file and quit the browser
932
933 <b>OR</b> use wget from the command line:</comment>
934 # <c>wget <comment>insert URL to the required stage tarball here.</comment></c>
935 </pre>
936 </body>
937 </section>
938 <section>
939 <title>Extracting the stage tarball</title>
940 <body>
941
942 <p>Now it is time to extract the compressed stage tarball of your choice to
943 <path>/mnt/gentoo/</path>. Remember, you only need to unpack <b>one</b> stage
944 tarball, either a stage1, stage2 or stage3. So, if you wanted to perform a
945 stage3 install of Gentoo, then you would just unpack the stage3 tarball.
946 Unpack the stage tarball as follows:</p>
947
948 <impo>Be sure to use the <c>p</c> option with <c>tar</c>. Forgetting to do this will
949 cause certain files to have incorrect permissions.</impo>
950
951 <pre caption="Unpacking the Stages">
952 # <c>cd /mnt/gentoo</c>
953 <comment>Change "stage3" to "stage2" or "stage1" if you want to start from these stages instead.</comment>
954 <comment>If you downloaded your stage tarball, change the path below to begin with "/mnt/gentoo/"
955 instead of "/mnt/cdrom/gentoo/".</comment>
956 # <c>tar -xvjpf /mnt/cdrom/gentoo/stage3-*.tar.bz2</c>
957 </pre>
958
959 <p>If you downloaded your stage tarball to <path>/mnt/gentoo</path>, you can now delete it by typing
960 <c>rm /mnt/gentoo/stage*.tar.bz2</c>.</p>
961 </body>
962 </section>
963 <section>
964 <title>Entering the chroot</title>
965 <body>
966 <p>
967 Next, we will <c>chroot</c> over to the new Gentoo Linux build installation to &quot;enter&quot; the new
968 Gentoo Linux system.
969 </p>
970
971 <pre caption="Prepping and entering the chroot environment">
972 # <c>mount -t proc proc /mnt/gentoo/proc</c>
973 # <c>cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf</c>
974 # <c>chroot /mnt/gentoo /bin/bash</c>
975 # <c>env-update</c>
976 Regenerating /etc/ld.so.cache...
977 # <c>source /etc/profile</c>
978 <comment>(The above points your shell to the new paths and updated binaries.)</comment>
979 </pre>
980 <p>After you execute these commands, you will be &quot;inside&quot; your new Gentoo Linux environment in <path>/mnt/gentoo</path>.
981 We can perform the rest of the installation process inside the chroot.
982 </p>
983 </body>
984 </section>
985 </chapter>
986 <chapter>
987 <title>Getting the Current Portage Tree using sync</title>
988 <section>
989 <body>
990
991 <p>Now, you will need to run <c>emerge sync</c>. This command tells Portage to download
992 the most recent copy of the Gentoo Linux Portage tree.
993 The Portage tree
994 contains all the scripts (called ebuilds) used to build every package
995 under Gentoo Linux. Currently, we have ebuild scripts for close to 4000 packages. Once <c>emerge sync</c>
996 completes, you will have a complete Portage tree in <path>/usr/portage</path>.</p>
997
998 <pre caption="Updating Using sync">
999 # <c>emerge sync</c>
1000 </pre>
1001
1002 </body>
1003 </section>
1004 </chapter>
1005 <chapter>
1006 <title>Setting Gentoo optimizations (make.conf)</title>
1007 <section>
1008 <body>
1009
1010 <p>Now that you have a working copy of the Portage tree, it is time to
1011 customize the optimization and optional build-time settings to use on your
1012 Gentoo Linux system. Portage will use these settings when compiling any
1013 programs for you. To do this, edit the file <path>/etc/make.conf</path>. In
1014 this file, you should set your <c>USE</c> flags, which specify optional
1015 functionality that you would like to be built into packages if available;
1016 generally, the defaults (an <e>empty</e> or unset <c>USE</c> variable) are
1017 fine. More information on <c>USE</c> flags can be found <uri
1018 link="http://www.gentoo.org/doc/en/use-howto.xml">here</uri>. A complete list
1019 of current USE flags can be found <uri
1020 link="http://www.gentoo.org/dyn/use-index.xml">here</uri>. </p>
1021
1022 <p>You also should set appropriate <c>CHOST</c>, <c>CFLAGS</c> and
1023 <c>CXXFLAGS</c> settings for the kind of system that you are creating
1024 (commented examples can be found further down in the file.) These settings
1025 will be used to tell the C and C++ compiler how to optimize the code that
1026 is generated on your system. It is common for users with Athlon XP processors
1027 to specify a "-march=athlon-xp" setting in their CFLAGS and CXXFLAGS settings
1028 so that all packages built will be optimized for the instruction set and
1029 performance characteristics of their CPU, for example. The <path>/etc/make.conf</path>
1030 file contains a general guide for the proper settings of CFLAGS and CXXFLAGS.</p>
1031
1032 <p>If necessary, you can also set proxy information here if you are behind a
1033 firewall. Use the following command to edit <path>/etc/make.conf</path> using <c>nano</c>,
1034 a simple visual editor.
1035 </p>
1036 <pre caption="Setting make.conf Options">
1037 # <c>nano -w /etc/make.conf</c>
1038 <comment>(Edit CHOST, CFLAGS, CXXFLAGS and any necessary USE or proxy settings)</comment>
1039 </pre>
1040 <note>
1041 People who need to substantially customize the build process should take a look at
1042 the <path>/etc/make.globals</path> file. This file comprises gentoo defaults and
1043 should never be touched. If the defaults do not suffice, then new values should
1044 be put in <path>/etc/make.conf</path>, as entries in <path>make.conf</path>
1045 <comment>override</comment> the entries in <path>make.globals</path>. If you're
1046 interested in customizing USE settings, look in <path>/etc/make.profile/make.defaults</path>.
1047 If you want to turn off any USE settings found here, add an appropriate <c>USE=&quot;-foo&quot;</c>
1048 in <path>/etc/make.conf</path> to turn off any <c>foo</c> USE setting enabled by default
1049 in <path>/etc/make.globals</path> or <path>/etc/make.profile/make.defaults</path>.
1050 </note>
1051 </body>
1052 </section>
1053 </chapter>
1054 <chapter>
1055 <title>Starting from Stage1</title>
1056 <section>
1057 <body>
1058 <note>If you are not starting from a stage1 tarball, skip this section.</note>
1059 <p>The stage1 tarball is for complete customization and optimization. If you have picked this tarball,
1060 you are most likely looking to have an uber-optimized and up-to-date system. Have fun, because optimization
1061 is what Gentoo Linux is all about! Installing from a stage1 takes a lot of time, but the result
1062 is a system that has been optimized from the ground up for your specific machine and needs.
1063 </p>
1064 <p>Now, it is time to start the &quot;bootstrap&quot; process. This process takes about two hours on
1065 my 1200Mhz AMD Athlon system.
1066 During this time, the GNU C library, compiler suite and other key system programs will be built. Start the bootstrap
1067 as follows:</p>
1068 <pre caption="Bootstrapping">
1069 # <c>cd /usr/portage</c>
1070 # <c>scripts/bootstrap.sh</c>
1071 </pre>
1072 <p>The &quot;bootstrap&quot; process will now begin.
1073 </p>
1074 <note>
1075 Portage by default uses <c>/var/tmp</c> during package building, often
1076 using several hundred megabytes of temporary storage. If you would like to
1077 change where Portage stores these temporary files, set a new PORTAGE_TMPDIR <e>before</e>
1078 starting the bootstrap process, as follows:
1079 </note>
1080 <pre caption="Changing Portage's Storage Path">
1081 # <c>export PORTAGE_TMPDIR=&quot;/otherdir/tmp&quot;</c>
1082 </pre>
1083 <p><c>bootstrap.sh</c> will build <c>binutils</c>, <c>gcc</c>, <c>gettext</c>,
1084 and <c>glibc</c>, rebuilding <c>binutils</c>, <c>gcc</c>, and <c>gettext</c>
1085 after <c>glibc</c>. Needless to say, this process takes a while.
1086 Once this process completes, your system will be equivalent to a &quot;stage2&quot; system,
1087 which means you can now move on to the stage2 instructions.
1088 </p>
1089 </body>
1090 </section>
1091 </chapter>
1092 <chapter>
1093 <title>Starting from Stage2 and continuing Stage1</title>
1094 <section>
1095 <body>
1096
1097 <note>This section is for those continuing a stage1 install or starting at stage2. If
1098 this is not you (ie. you're using a stage3,) then skip this section.
1099 </note>
1100
1101 <p>The stage2 tarball already has the bootstrapping done for you. All that you have
1102 to do is install the rest of the system.
1103 </p>
1104 <pre caption="Installing the Rest of the System">
1105 # <c>emerge -p system</c>
1106 <comment>(lists the packages to be installed)</comment>
1107 # <c>emerge system</c>
1108 </pre>
1109 <p>It is going to take a while
1110 to finish building the entire base system. Your reward is that it will be
1111 thoroughly optimized for your system. The drawback is that you have to find a
1112 way to keep yourself occupied for some time to come. The author suggests &quot;Star
1113 Wars - Super Bombad Racing&quot; for the PS2.
1114 </p>
1115 <p>When this process completes, your system will be the equivalent of a stage3 system. You have
1116 a couple of choices on how to continue
1117 at this point. You can move onto the stage3 instructions and complete those. Doing that will
1118 get your system right up to date with what is in the current Portage tree. This is not necessary,
1119 but it is highly recommended.
1120 </p>
1121 </body>
1122 </section>
1123 </chapter>
1124 <chapter>
1125 <title>Starting from Stage3</title>
1126 <section>
1127 <body>
1128 <note>This section is for those <b>starting</b> with stage3, and not for those who have started
1129 with stage1 or stage2 who should skip this section.</note>
1130 <p>The stage3 tarball provides a fully-functional basic Gentoo system, so no building is required.
1131 However, since the stage3 tarball is pre-built, it may be slightly out-of-date. If this is a concern
1132 for you, you can update your stage3 to contain the most up-to-date versions of all system packages
1133 by performing the following steps. Note that this could take a long time if your stage3 is very old;
1134 otherwise, this process will generally be quick and will allow you to benefit from the very latest
1135 Gentoo updates and fixes.
1136 In any case, feel free to skip these
1137 steps and proceed to the next section if you like.
1138 </p>
1139
1140 <pre caption="Getting up-to-date">
1141 # <c>export CONFIG_PROTECT="-*"</c>
1142 # <c>emerge -up system</c>
1143 <comment>(lists the packages that would be installed)</comment>
1144 # <c>emerge -u system</c>
1145 <comment>(actually merges the packages)</comment>
1146 # <c>unset CONFIG_PROTECT</c>
1147 </pre>
1148 </body>
1149 </section>
1150 </chapter>
1151 <chapter>
1152 <title>Setting your time zone</title>
1153 <section>
1154 <body>
1155 <p>Now you need to set your time zone.</p>
1156 <p>Look for your time zone (or GMT if you are using Greenwich Mean Time)
1157 in <path>/usr/share/zoneinfo</path>. Then, make a symbolic link to
1158 /etc/localtime by typing:</p>
1159 <pre caption="Creating a symbolic link for time zone">
1160 # <c>ln -sf /usr/share/zoneinfo/path/to/timezonefile /etc/localtime</c>
1161 </pre>
1162 </body>
1163 </section>
1164 </chapter>
1165 <chapter>
1166 <title>Installing the kernel and a System Logger</title>
1167 <section>
1168 <body>
1169 <note>
1170 If you haven't done so, please edit <path>/etc/make.conf</path> to your flavor.
1171 </note>
1172 <p>You now need to merge Linux kernel sources. Here are the ones we currently
1173 offer:
1174 </p>
1175 <table>
1176 <tr>
1177 <th>ebuild</th>
1178 <th>description</th>
1179 </tr>
1180 <tr>
1181 <ti>
1182 <path>gentoo-sources</path>
1183 </ti>
1184 <ti>Our own performance and functionality-enhanced kernel does not include XFS support.</ti>
1185 </tr>
1186 <tr>
1187 <ti>
1188 <path>xfs-sources</path>
1189 </ti>
1190 <ti>Highly-compatible kernel with XFS support.</ti>
1191 </tr>
1192 <tr>
1193 <ti>
1194 <path>openmosix-sources</path>
1195 </ti>
1196 <ti>A stock Linux kernel source tree patched with support for the GPL <uri link="http://www.openmosix.com">openMosix</uri> load-balancing/clustering technology</ti>
1197 </tr>
1198 <tr>
1199 <ti>
1200 <path>usermode-sources</path>
1201 </ti>
1202 <ti>A stock Linux kernel source tree patched with support for User-Mode Linux. (&quot;Linux inside Linux&quot; technology)</ti>
1203 </tr>
1204 <tr>
1205 <ti>
1206 <path>vanilla-sources</path>
1207 </ti>
1208 <ti>A stock Linux kernel source tree, just like you would get from kernel.org</ti>
1209 </tr>
1210 </table>
1211 <warn>
1212 If you are configuring your own kernel, be careful with the <i>grsecurity</i> option. Being too aggressive with your
1213 security settings can cause certain programs (such as X) to not run properly. If in doubt, leave it out.
1214 </warn>
1215 <p>Choose a kernel and then merge as follows:</p>
1216 <pre caption="Emerging Kernel Sources">
1217 # <c>emerge sys-kernel/gentoo-sources</c>
1218 </pre>
1219 <p>Once you have a Linux kernel source tree available, it is time to compile your own custom kernel.
1220 </p>
1221 <p>Please note that <path>/usr/src/linux</path> is a symlink to your current emerged kernel source package,
1222 and is set automatically by Portage at emerge time.
1223 If you have multiple kernel source packages, it is necessary to set the <path>/usr/src/linux</path> symlink
1224 to the correct one before proceeding.
1225 </p>
1226 <pre caption="Compiling the Linux Kernel">
1227 # <c>cd /usr/src/linux</c>
1228 # <c>make menuconfig</c>
1229 # <c>make dep &amp;&amp; make clean bzImage modules modules_install</c>
1230 # <c>cp /usr/src/linux/arch/i386/boot/bzImage /boot</c>
1231 </pre>
1232 <warn>For your kernel to function properly, there are several options that you will
1233 need to ensure are in the kernel proper -- that is, they should <i>be enabled and not
1234 compiled as modules</i>. Be sure to enable &quot;ReiserFS&quot; if you have
1235 any ReiserFS partitions; the same goes for &quot;Ext3&quot;. If you're using XFS, enable the
1236 &quot;SGI XFS filesystem support&quot; option. It's always a good idea to leave ext2
1237 enabled whether you are using it or not. Below are some common options that you will need:</warn>
1238 <pre caption="make menuconfig options">
1239 Code maturity level options ---&gt;
1240 [*] Prompt for development and/or incomplete code/drivers&quot;
1241 <comment>(You need this to enable some of the options below.)</comment>
1242 ...
1243
1244 File systems ---&gt;
1245 &lt;*&gt; Reiserfs support
1246 <comment>(Only needed if you are using reiserfs.)</comment>
1247 ...
1248 &lt;*&gt; Ext3 journalling file system support
1249 <comment>(Only needed if you are using ext3.)</comment>
1250 ...
1251 [*] Virtual memory file system support (former shm fs)
1252 <comment>(Required for Gentoo Linux.)</comment>
1253 ...
1254 &lt;*&gt; JFS filesystem support
1255 <comment>(Only needed if you are using JFS.)</comment>
1256 ...
1257 [*] /proc file system support
1258 <comment>(Required for Gentoo Linux.)</comment>
1259 [*] /dev file system support (EXPERIMENTAL)
1260 [*] Automatically mount at boot
1261 <comment>(Required for Gentoo Linux.)</comment>
1262 [ ] /dev/pts file system for Unix98 PTYs
1263 <comment>(Uncheck this, it is NOT needed.)</comment>
1264 ...
1265 &lt;*&gt; Second extended fs support
1266 <comment>(Only needed if you are using ext2.)</comment>
1267 ...
1268 &lt;*&gt; XFS filesystem support
1269 <comment>(Only needed if you are using XFS.)</comment>
1270 </pre>
1271 <p>If you are using hardware RAID you will need to enable a couple more options in the kernel:
1272 For Highpoint RAID controllers select hpt366 chipset support, support for IDE RAID controllers and Highpoint
1273 370 software RAID.For Promise RAID controllers select PROMISE PDC202{46|62|65|67|68|69|70} support,
1274 support for IDE RAID
1275 controllers and Support Promise software RAID (Fasttrak(tm))
1276 </p>
1277 <p>If you use PPPoE to connect to Internet, you will need the following
1278 options in the kernel (built-in or as preferably as modules) :
1279 &quot;PPP (point-to-point protocol) support&quot;, &quot;PPP support for async serial ports&quot;,
1280 &quot;PPP support for sync tty ports&quot;. The two compression options won't harm but
1281 are not definitely needed, neither does the &quot;PPP over Ethernet&quot; option,
1282 that might only be used by <i>rp-pppoe</i> when configured to do kernel mode PPPoE.
1283 </p>
1284 <p>If you have an IDE cd burner, then you need to enable SCSI emulation in the
1285 kernel. Turn on &quot;ATA/IDE/MFM/RLL support&quot; ---&gt; &quot;IDE, ATA and ATAPI Block
1286 devices&quot; ---&gt; &quot;SCSI emulation support&quot; (I usually make it a module), then
1287 under &quot;SCSI support&quot; enable &quot;SCSI support&quot;, &quot;SCSI CD-ROM support&quot; and
1288 &quot;SCSI generic support&quot; (again, I usually compile them as modules). If you
1289 also choose to use modules, then <c>echo -e &quot;ide-scsi\nsg\nsr_mod&quot;
1290 &gt;&gt; /etc/modules.autoload</c> to have them automatically added at boot time.
1291 </p>
1292 <note>
1293 For those who prefer it,
1294 it is now possible to install Gentoo Linux with a 2.2 kernel.
1295 However, doing this comes at a price:
1296 you will lose many of the nifty features that
1297 are new to the 2.4 series kernels (such as XFS and tmpfs
1298 filesystems, iptables, and more), although the 2.2 kernel sources can be
1299 patched with ReiserFS and devfs support.
1300 Gentoo linux boot scripts require either tmpfs or ramdisk support in the kernel, so
1301 2.2 kernel users need to make sure that ramdisk support is compiled in (ie, not a module).
1302 It is <comment>vital</comment> that a <e>gentoo=notmpfs</e> flag be added to the kernel
1303 line in <path>/boot/grub/grub.conf</path> or to the append line in <path>/etc/lilo.conf</path> for the 2.2 kernel so
1304 that a ramdisk is mounted for the boot scripts instead of tmpfs. If you choose not to use devfs, then
1305 <e>gentoo=notmpfs,nodevfs</e> should be used instead.
1306 </note>
1307 <p>Your new custom kernel (and modules) are now installed. Now you need to choose a system
1308 logger that you would like to install. We offer sysklogd, which is the traditional set
1309 of system logging daemons. We also have msyslog and syslog-ng as well as metalog. Power users seem
1310 to gravitate away from sysklogd (not very good performance) and towards the
1311 newer alternatives.
1312 If in doubt, you may want to try metalog, since it seems to be quite popular.
1313 To merge your logger of choice, type <e>one</e> of the next four lines:
1314 </p>
1315 <pre caption="Emerging System Logger of Choice">
1316 # <c>emerge app-admin/sysklogd</c>
1317 # <c>rc-update add sysklogd default</c>
1318 <comment>or</comment>
1319 # <c>emerge app-admin/syslog-ng</c>
1320 # <c>rc-update add syslog-ng default</c>
1321 <comment>or</comment>
1322 # <c>emerge app-admin/metalog</c>
1323 # <c>rc-update add metalog default</c>
1324 <comment>or</comment>
1325 # <c>emerge app-admin/msyslog</c>
1326 # <c>rc-update add msyslog default</c>
1327 </pre>
1328 <warn>
1329 In the case of syslog-ng you need to create
1330 <path>/etc/syslog-ng/syslog-ng.conf</path>.
1331 See <path>/etc/syslog-ng</path>
1332 for a sample configuration file.
1333 </warn>
1334 <impo>
1335 Metalog flushes output to the disk in blocks, so messages aren't immediately recorded into
1336 the system logs. If you are trying to debug a daemon, this performance-enhancing behavior
1337 is less than helpful. When your Gentoo Linux system is up and running, you can send
1338 metalog a USR1 signal to temporarily turn off this message buffering (meaning that
1339 <i>tail -f <path>/var/log/everything/current</path></i> will now work
1340 in real time, as expected),
1341 and a USR2 signal to turn buffering back on
1342 again. If you want to disable buffering permanently, you can change METALOG_OPTS="-B" to METALOG_OPTS="-B -s"
1343 in <path>/etc/conf.d/metalog</path>.
1344 </impo>
1345 <p>Now, you may optionally choose a cron package that you would like to use.
1346 Right now, we offer dcron, fcron and vcron. If you do not know which one to choose,
1347 you might as well grab vcron. They can be installed as follows:
1348 </p>
1349 <pre caption="Choosing a CRON Daemon">
1350 # <c>emerge sys-apps/dcron</c>
1351 # <c>rc-update add dcron default</c>
1352 # <c>crontab /etc/crontab</c>
1353 <comment>or</comment>
1354 # <c>emerge sys-apps/fcron</c>
1355 # <c>rc-update add fcron default</c>
1356 # <c>crontab /etc/crontab</c>
1357 <comment>or</comment>
1358 # <c>emerge sys-apps/vcron</c>
1359 # <c>rc-update add vcron default</c>
1360 <comment>You do not need to run <c>crontab /etc/crontab</c> if using vcron.</comment>
1361 </pre>
1362 <p>For more information on starting programs and daemons at startup, see the
1363 <uri link="/doc/en/rc-scripts.xml">rc-script guide</uri>.
1364 </p>
1365 </body>
1366 </section>
1367 </chapter>
1368 <chapter>
1369 <title>Installing miscellany necessary packages</title>
1370 <section>
1371 <body>
1372 <p>If you need rp-pppoe to connect to the net, be aware that at this point
1373 it has not been installed. It would be the good time to do it. </p>
1374 <pre caption="Installing rp-pppoe">
1375 # <c>USE="-X" emerge rp-pppoe</c>
1376 </pre>
1377
1378 <note>The <i>USE="-X"</i> prevents pppoe from installing its optional X interface, which is a good thing,
1379 because X and its dependencies would also be emerged. You can always recompile <i>rp-pppoe</i> with
1380 X support later.
1381 </note>
1382 <note> Please note that the rp-pppoe is built but not configured.
1383 You will have to do it again using <c>adsl-setup</c> when you boot into your Gentoo system
1384 for the first time.
1385 </note>
1386 <p>You may need to install some additional packages in the Portage tree
1387 if you are using any optional features like XFS, ReiserFS or LVM. If you're
1388 using XFS, you should emerge the <c>xfsprogs</c> package:
1389 </p>
1390 <pre caption="Emerging Filesystem Tools">
1391 # <c>emerge sys-apps/xfsprogs</c>
1392 <comment>If you would like to use ReiserFS, you should emerge the ReiserFS tools: </comment>
1393 # <c>emerge sys-apps/reiserfsprogs</c>
1394 <comment>If you would like to use JFS, you should emerge the JFS tools: </comment>
1395 # <c>emerge jfsutils</c>
1396 <comment>If you're using LVM, you should emerge the <c>lvm-user</c> package: </comment>
1397 # <c>emerge sys-apps/lvm-user</c>
1398 </pre>
1399 <p>If you're a laptop user and wish to use your PCMCIA slots on your first
1400 real reboot, you will want to make sure you install the <i>pcmcia-cs</i> package.
1401 </p>
1402 <pre caption="Emerging PCMCIA-cs">
1403 # <c>emerge sys-apps/pcmcia-cs</c>
1404 </pre>
1405 <warn>You will have to re-emerge <i>pcmcia-cs</i> after installation to get PCMCIA
1406 to work.
1407 </warn>
1408 </body>
1409 </section>
1410 </chapter>
1411 <chapter>
1412 <title>Modifying /etc/fstab for your machine</title>
1413 <section>
1414 <body>
1415 <p>Your Gentoo Linux system is almost ready for use. All we need to do now is configure
1416 a few important system files and install the boot loader.
1417 The first file we need to
1418 configure is <path>/etc/fstab</path>. Remember that you should use
1419 the <c>notail</c> option for your boot partition if you chose to create a ReiserFS filesystem on it.
1420 Remember to specify <c>ext2</c>, <c>ext3</c> or <c>reiserfs</c> filesystem types as appropriate.
1421 </p>
1422 <p>Use something like the <path>/etc/fstab</path> listed below, but of course be sure to replace &quot;BOOT&quot;,
1423 &quot;ROOT&quot; and &quot;SWAP&quot; with the actual block devices you are using (such as <c>hda1</c>, etc.)</p>
1424 <pre caption="Editing fstab">
1425 <comment># /etc/fstab: static file system information.
1426 #
1427 # noatime turns off atimes for increased performance (atimes normally aren't
1428 # needed; notail increases performance of ReiserFS (at the expense of storage
1429 # efficiency). It is safe to drop the noatime options if you want and to
1430 # switch between notail and tail freely.
1431
1432 # &lt;fs&gt; &lt;mount point&gt; &lt;type&gt; &lt;opts&gt; &lt;dump/pass&gt;
1433
1434 # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
1435 </comment>
1436 /dev/BOOT /boot ext2 noauto,noatime 1 2
1437 /dev/ROOT / ext3 noatime 0 1
1438 /dev/SWAP none swap sw 0 0
1439 /dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro 0 0
1440 proc /proc proc defaults 0 0
1441 </pre>
1442 <warn>Please notice that <i>/boot</i> is NOT mounted at boot time.
1443 This is to protect the data in <i>/boot</i> from
1444 corruption. If you need to access <i>/boot</i>, please mount it!
1445 </warn>
1446 </body>
1447 </section>
1448 </chapter>
1449 <chapter>
1450 <title>Setting the Root Password</title>
1451 <section>
1452 <body>
1453 <p>Before you forget, set the root password by typing: </p>
1454 <pre caption="Setting the root Password">
1455 # <c>passwd</c>
1456 </pre>
1457
1458 <p>You will also want to add a non-root user for everyday use. Please consult
1459 the <uri link="http://www.gentoo.org/doc/en/faq.xml">Gentoo FAQ</uri>.
1460 </p>
1461 </body>
1462 </section>
1463 </chapter>
1464 <chapter>
1465 <title>Setting your Hostname</title>
1466 <section>
1467 <body>
1468 <p>Edit this file so that it contains your fully-qualified domain name on a single line,
1469 i.e. <c>mymachine.mydomain.com</c>.
1470 </p>
1471 <pre caption="Configuring Hostname">
1472 # <c>echo mymachine.mydomain.com &gt; /etc/hostname</c>
1473 </pre>
1474 </body>
1475 </section>
1476 </chapter>
1477 <chapter>
1478 <title>Modifying /etc/hosts</title>
1479 <section>
1480 <body>
1481 <p>This file contains a list of ip addresses and their associated hostnames.
1482 It is used by the system to resolve the IP addresses
1483 of any hostnames that may not be in your nameservers. Here is a template for this file:
1484 </p>
1485 <pre caption="Hosts Template">
1486 127.0.0.1 localhost
1487 <comment># the next line contains your IP for your local LAN, and your associated machine name</comment>
1488 192.168.1.1 mymachine.mydomain.com mymachine
1489 </pre>
1490 <note>If you are on a DHCP network, it might be helpful to set <i>localhost</i> to your machine's
1491 actual hostname. This will help GNOME and many other programs in name resolution.
1492 </note>
1493 </body>
1494 </section>
1495 </chapter>
1496 <chapter>
1497 <title>Final Network Configuration</title>
1498 <section>
1499 <body>
1500 <p>Add the names of any modules that are necessary for the proper functioning of your system to
1501 <path>/etc/modules.autoload</path> file (you can also add any options you
1502 need to the same line.) When Gentoo Linux boots, these modules will be automatically
1503 loaded. Of particular importance is your ethernet card module, if you happened to compile
1504 it as a module:
1505 </p>
1506 <pre caption="/etc/modules.autoload"><comment>This is assuming that you are using a 3com card.
1507 Check <path>/lib/modules/`uname -r`/kernel/drivers/net</path> for your card. </comment>
1508 3c59x
1509 </pre>
1510 <p>Edit the <path>/etc/conf.d/net</path> script to get your network configured for your
1511 first boot: </p>
1512 <pre caption="Boot time Network Configuration">
1513 # <c>nano -w /etc/conf.d/net</c>
1514 # <c>rc-update add net.eth0 default</c>
1515 </pre>
1516 <p>If you have multiple network cards you need to create additional <path>net.eth<comment>x</comment></path>
1517 scripts for each one (<comment>x</comment> = 1, 2, ...): </p>
1518 <pre caption="Multiple Network Interfaces">
1519 # <c>cd /etc/init.d</c>
1520 # <c>cp net.eth0 net.eth<comment>x</comment></c>
1521 # <c>rc-update add net.eth<comment>x</comment> default</c>
1522 </pre>
1523 <p>If you have a PCMCIA card installed, have a quick look into
1524 <path>/etc/init.d/pcmcia</path> to verify that things seem all right for your setup,
1525 then add this line to the top of <path>/etc/init.d/net.ethx</path>:
1526 </p>
1527 <pre caption="PCMCIA depend in /etc/init.d/net.ethx">
1528 depend() {
1529 need pcmcia
1530 }
1531 </pre>
1532 <p>This makes sure that the PCMCIA drivers are autoloaded whenever your network is loaded.
1533 </p>
1534 </body>
1535 </section>
1536 </chapter>
1537 <chapter>
1538 <title>Final steps: Configure Basic Settings (including the international keymap setting)</title>
1539 <section>
1540 <body>
1541 <pre caption="Basic Configuration">
1542 # <c>nano -w /etc/rc.conf</c>
1543 </pre>
1544 <p>Follow the directions in the file to configure the basic settings.
1545 All users will want to make sure that <c>CLOCK</c> is set to his/her
1546 liking. International keyboard users will want to set the <c>KEYMAP</c>
1547 variable (browse <path>/usr/share/keymaps</path> to see the various
1548 possibilities).
1549 </p>
1550 </body>
1551 </section>
1552 </chapter>
1553 <chapter>
1554 <title>Configure a Bootloader</title>
1555 <section>
1556 <title>Notes</title>
1557 <body>
1558 <p> In the spirit of Gentoo, users now have more than one bootloader to choose from.
1559 Using our virtual package system, users are now able to choose between both GRUB and
1560 LILO as their bootloaders.
1561 </p>
1562 <p> Please keep in mind that having both bootloaders installed is not necessary.
1563 In fact, it can be a hindrance, so please only choose one.
1564 </p>
1565 <impo>If you are installing Gentoo Linux on a system with an NVIDIA nForce or nForce2 chipset
1566 with an integrated GeForce graphics card, you should use LILO and avoid GRUB. With on-board
1567 video enabled, the low memory area of your RAM may be used as video RAM. Since GRUB also uses low
1568 memory at boot time, it may experience an "out of memory" condition. So, if you have an nForce
1569 or potentially other board with on-board video, use LILO. Even if you're using off-board video
1570 right now, it would be nice to be able to remove the graphics card and use the on-board video in a
1571 pinch, wouldn't it? :)</impo>
1572
1573 </body>
1574 </section>
1575 <section>
1576 <title>Configuring GRUB</title>
1577 <body>
1578 <p>The most critical part of understanding GRUB is getting comfortable with how GRUB
1579 refers to hard drives and partitions. Your Linux partition <path>/dev/hda1</path> is called
1580 <path>(hd0,0)</path> under GRUB. Notice the parenthesis around the hd0,0 - they are required.
1581 Hard drives count from zero rather than &quot;a&quot;, and partitions start at zero rather than one.
1582 Be aware too that with the hd devices, only harddrives are counted, not atapi-ide devices such as
1583 cdrom players, burners, and that the same construct can be used with scsi drives.
1584 (Normally they get higher numbers than ide drives except when the bios is configured
1585 to boot from scsi devices.) Assuming you have a harddrive on /dev/hda, a cdrom player on /dev/hdb,
1586 a burner on /dev/hdc and a second hardrive on /dev/hdd, for example, and no scsi harddrive
1587 <path>/dev/hdd7</path> gets translated to <path>(hd1,6)</path>.
1588
1589 It might sound tricky, and tricky it is indeed, but as we will see, grub
1590 offers a tab completion mechanism that comes handy for those of you having
1591 a lot of harddrives and partitions and who are a little lost in the
1592 grub numbering scheme. Having gotten the feel for that,
1593 it is time to install GRUB.
1594 </p>
1595 <p>The easiest way to install GRUB is to simply type <c>grub</c> at your chrooted shell prompt: </p>
1596 <pre caption="Installing GRUB">
1597 # <c>emerge grub</c>
1598 # <c>grub</c>
1599 </pre>
1600 <impo>If you are using hardware RAID this part will not work at
1601 this time.
1602 Skip to the section on making your <path>grub.conf</path>. After that we will complete the
1603 grub setup for RAID controllers
1604 </impo>
1605 <p>You will be presented with the <c>grub&gt;</c> grub
1606 command-line prompt. Now, you need to type in the
1607 right commands to install the GRUB boot record onto your hard drive. In my example configuration,
1608 I want to install the GRUB boot record on my hard drive's MBR (master boot record), so that
1609 the first thing I see when I turn on the computer is the GRUB prompt. In my case, the commands
1610 I want to type are:
1611 </p>
1612
1613 <pre caption="GRUB on the MBR">
1614 grub&gt; <c>root (hd0,0)</c> <codenote>Your boot partition</codenote>
1615 grub&gt; <c>setup (hd0)</c> <codenote>Where the boot record is installed, here, it is the MBR</codenote>
1616 </pre>
1617
1618 <pre caption="GRUB not on the MBR">
1619 <comment>Alternatively, if you wanted to install the bootloader somewhere other than the MBR</comment>
1620 grub&gt; <c>root (hd0,0)</c> <codenote>Your boot partition</codenote>
1621 grub&gt; <c>setup (hd0,4)</c> <codenote>Where the boot record is installed, here it is /dev/hda5</codenote>
1622 grub&gt; <c>quit</c>
1623 </pre>
1624
1625 <p>Here is how the two commands work. The first <c>root ( )</c> command tells GRUB
1626 the location of your boot partition (in our example, <path>/dev/hda1</path> or
1627 <path>(hd0,0)</path> in GRUB terminology. Then, the second <c>setup ( )
1628 </c> command tells GRUB where to install the
1629 boot record - it will be configured to look for its special files at the <c>root
1630 ( )</c> location that you specified. In my case, I want the boot record on the
1631 MBR of the hard drive, so I simply specify <path>/dev/hda</path> (also known as <path>(hd0)</path>).
1632 If I were using another boot loader and wanted to set up GRUB as a secondary boot-loader, I
1633 could install GRUB to the boot record of a particular partition. In that case,
1634 I would specify a particular partition rather than the entire disk. Once the GRUB
1635 boot record has been successfully installed, you can type <c>quit</c> to quit GRUB.
1636 </p>
1637
1638 <note> The tab completion mechanism of grub can be used from within grub,
1639 assuming you wrote <c> root (</c> and that you hit the TAB key, you would
1640 be prompted with a list of the available devices (not only harddrives),
1641 hitting the TAB key having written <c> root (hd</c>, grub would print the
1642 available harddrives and hitting the TAB key after writing <c> root (hd0,</c>
1643 would make grub print the list of partitions on the first harddrive.
1644
1645 Checking the syntax of the grub location with completion should really help
1646 to make the right choice.
1647 </note>
1648
1649 <p>
1650 Gentoo Linux is now
1651 installed, but we need to create the <path>/boot/grub/grub.conf</path> file so that
1652 we get a nice GRUB boot menu when the system reboots. Here is how to do it.
1653 </p>
1654 <impo>To ensure backwards compatibility with GRUB, make sure to make a link from
1655 <i>grub.conf</i> to <i>menu.lst</i>. You can do this by doing
1656 <c>ln -s /boot/grub/grub.conf /boot/grub/menu.lst </c>. </impo>
1657 <p>Now, create the grub.conf file (<c>nano -w /boot/grub/grub.conf</c>), and add the following to it:
1658 </p>
1659 <pre caption="Grub.conf for GRUB">
1660 default 0
1661 timeout 30
1662 splashimage=(hd0,0)/boot/grub/splash.xpm.gz
1663
1664 title=My example Gentoo Linux
1665 root (hd0,0)
1666 kernel (hd0,0)/boot/bzImage root=/dev/hda3
1667
1668 <comment># Below is for setup using hardware RAID</comment>
1669 title=My Gentoo Linux on RAID
1670 root (hd0,0)
1671 kernel (hd0,0)/boot/bzImage root=/dev/ataraid/dXpY
1672
1673 <comment># Below needed only for people who dual-boot</comment>
1674 title=Windows XP
1675 root (hd0,5)
1676 chainloader (hd0,5)+1
1677 </pre>
1678 <note>
1679 (hd0,0) should be written without any spaces inside the parentheses.
1680 </note>
1681 <impo>
1682 If you set up scsi emulation for an IDE cd burner earlier, then to get it to
1683 actually work you need to add an &quot;hdx=ide-scsi&quot; fragment to the kernel
1684 line in grub.conf (where &quot;hdx&quot; should be the device for your cd burner).
1685 </impo>
1686 <p>After saving this file, Gentoo Linux installation is complete. Selecting the first option will
1687 tell GRUB to boot Gentoo Linux without a fuss. The second part of the grub.conf file is optional,
1688 and shows you how to use GRUB to boot a bootable Windows partition.
1689 </p>
1690 <note>Above, <path>(hd0,0)</path> should point to your &quot;boot&quot; partition
1691 (<path>/dev/hda1</path> in our example config) and <path>/dev/hda3</path> should point to
1692 your root filesystem. <path>(hd0,5)</path> contains the NT boot
1693 loader.
1694 </note>
1695 <note>
1696 The path to the kernel image is relative to the boot partition. If for example you have separated boot partition <path>(hd0,0)</path> and root partition <path>(hd0,1)</path>, all paths in the grub.conf file above will become <path>/bzImage</path>.
1697 </note>
1698 <p>If you need to pass any additional options to the kernel, simply
1699 add them to the end of the <c>kernel</c> command. We're already passing one option
1700 (<c>root=/dev/hda3</c>), but you can pass others as well. In particular, you can
1701 turn off devfs by default (not recommended unless you know what you're doing) by
1702 adding the <c>gentoo=nodevfs</c> option to the <c>kernel</c> command.
1703 </p>
1704 <note>Unlike in earlier versions of Gentoo Linux, you no longer have to add
1705 <c>devfs=mount</c> to the end of the <c>kernel</c> line to enable devfs. In rc6
1706 devfs is enabled by default.
1707 </note>
1708 </body>
1709 </section>
1710 <section>
1711 <title>Configuring LILO</title>
1712 <body>
1713 <p>While GRUB may be the new alternative for most people, it is not always the best choice.
1714 LILO, the LInuxLOader, is the tried and true workhorse of Linux bootloaders. Here is how to install
1715 LILO if you would like to use it instead of GRUB:
1716 </p>
1717 <p>The first step is to emerge LILO:
1718 </p>
1719 <pre caption="Emerging LILO">
1720 # <c>emerge lilo</c>
1721 </pre>
1722 <p>Now it is time to configure LILO. Here is a sample configuration file <path>/etc/lilo.conf</path>
1723 </p>
1724 <pre caption="Example lilo.conf">
1725 boot=/dev/hda
1726 map=/boot/map
1727 install=/boot/boot.b
1728 prompt
1729 timeout=50
1730 lba32
1731 default=linux
1732
1733 image=/boot/vmlinuz-2.4.20
1734 label=linux
1735 read-only
1736 root=/dev/hda3
1737
1738 #For dual booting windows/other OS
1739 other=/dev/hda1
1740 label=dos
1741 </pre>
1742 <ul>
1743 <li><i>boot=/dev/hda</i> tells LILO to install itself on the first hard disk on the first IDE controller. </li>
1744 <li><i>map=/boot/map</i> states the map file. In normal use, this should not be modified. </li>
1745 <li><i>install=/boot/boot.b</i> tells LILO to install the specified file as the new boot sector.
1746 In normal use, this should not be altered. If the install line is missing, LILO will
1747 assume a default of /boot/boot.b as the file to be used. </li>
1748 <li>The existence of <i>prompt</i> tells LILO to display the classic <i>lilo:</i> prompt at bootup.
1749 While it is not recommended that you remove the prompt line, if you do remove it, you can still
1750 get a prompt by holding down the [Shift] key while your machine starts to boot. </li>
1751 <li><i>timeout=50</i> sets the amount of time that LILO will wait for user input before proceeding
1752 with booting the default line entry. This is measured in tenths of a second, with 50 as the default. </li>
1753 <li><i>lba32</i> describes the hard disk geometry to LILO. Another common entry here is linear. You should
1754 not change this line unless you are very aware of what you are doing. Otherwise, you could put
1755 your system in an unbootable state. </li>
1756 <li><i>default=linux</i> refers to the default operating system for LILO to boot from the
1757 options listed below this line. The name linux refers to the label line below in each of the boot options. </li>
1758 <li><i>image=/boot/vmlinuz-2.4.20</i> specifies the linux kernel to boot with this particular boot option. </li>
1759 <li><i>label=linux</i> names the operating system option in the LILO screen. In this case,
1760 it is also the name referred to by the default line. </li>
1761 <li><i>read-only</i> specifies that the root partition (see the root line below) is read-only and cannot be
1762 altered during the boot process. </li>
1763 <li><i>root=/dev/hda5</i> tells LILO what disk partition to use as the root partition. </li>
1764 </ul>
1765 <p>After you have edited your <i>lilo.conf</i> file, it is time to run LILO to load the information
1766 into the MBR:
1767 </p>
1768 <pre caption="Running LILO">
1769 # <c>/sbin/lilo</c>
1770 </pre>
1771 <p>LILO is configured, and now your machine is ready to boot into Gentoo Linux!
1772 </p>
1773 </body>
1774 </section>
1775 </chapter>
1776 <chapter>
1777 <title>Creating Bootdisks</title>
1778 <section>
1779 <title>GRUB Bootdisks</title>
1780 <body>
1781 <p>It is always a good idea to make a boot disk the first
1782 time you install any Linux distribution. This is a security
1783 blanket, and generally not a bad thing to do. If you are using some kinds of hardware RAID, you may <e>need</e> make a GRUB boot
1784 disk. With these types of hardware RAID,
1785 if you try to install grub from your chrooted shell it will fail. If you are in this camp,
1786 make a GRUB
1787 boot disk, and when you reboot the first time you can install GRUB
1788 to the MBR. Make your
1789 bootdisks like this:
1790 </p>
1791 <pre caption="Creating a GRUB Bootdisk">
1792 # <c>mke2fs /dev/fd0</c>
1793 # <c>mount /dev/fd0 /mnt/floppy</c>
1794 # <c>mkdir -p /mnt/floppy/boot/grub</c>
1795 # <c>cp /usr/share/grub/i386-pc/stage1 /mnt/floppy/boot/grub/</c>
1796 # <c>cp /usr/share/grub/i386-pc/stage2 /mnt/floppy/boot/grub/</c>
1797 # <c>umount /mnt/floppy</c>
1798 # <c>grub</c>
1799
1800 grub&gt; <c>root (fd0)</c>
1801 grub&gt; <c>setup (fd0)</c>
1802 grub&gt; <c>quit</c>
1803 </pre>
1804 <p>Now reboot and load the floppy. At the floppy's <c>grub&gt;</c> prompt, you can now execute the necessary <c>root</c>
1805 and <c>setup</c> commands.</p>
1806 </body>
1807 </section>
1808 <section>
1809 <title>LILO Bootdisks</title>
1810 <body>
1811 <p>If you are using LILO, it is also a good idea to make a bootdisk:
1812 </p>
1813 <pre caption="Making a LILO Bootdisk">
1814 # <c>dd if=/boot/your_kernel of=/dev/fd0 </c>
1815 <comment>This will only work if your kernel is smaller than 1.4MB</comment>
1816 </pre>
1817 </body>
1818 </section>
1819 </chapter>
1820 <chapter>
1821 <title>Installation Complete!</title>
1822 <section>
1823 <body>
1824 <p>Now, Gentoo Linux is installed. The only remaining step is to update necessary configuration files, exit the chrooted shell,
1825
1826 safely unmount your partitions
1827 and reboot the system:
1828 </p>
1829 <pre caption="Rebooting the System">
1830 # <c>etc-update</c>
1831 # <c>exit</c>
1832 <comment>(This exits the chrooted shell; you can also type <c>^D</c>)</comment>
1833 # <c>cd / </c>
1834 # <c>umount /mnt/gentoo/boot</c>
1835 # <c>umount /mnt/gentoo/proc</c>
1836 # <c>umount /mnt/gentoo</c>
1837 # <c>reboot</c>
1838 </pre>
1839 <note>
1840 After rebooting, it is a good idea to run the <c>update-modules</c> command to create
1841 the <path>/etc/modules.conf</path> file. Instead of modifying this file directly, you should
1842 generally make changes to the files in <path>/etc/modules.d</path>.
1843 </note>
1844 <impo>Remember if you are running hardware RAID, you must
1845 use the bootdisk for the first reboot.
1846 then go back and install grub the way everyone else did the first
1847 time. You are done -- congratulations!</impo>
1848 <p>If you have any questions or would like to get involved with Gentoo Linux development,
1849 consider joining our gentoo-user and gentoo-dev mailing lists
1850 (more information on our <uri link="http://www.gentoo.org/main/en/lists.xml">mailing lists</uri> page).
1851 We also have a handy <uri link="http://www.gentoo.org/doc/en/desktop.xml">Desktop configuration guide</uri>
1852 that will
1853 help you to continue configuring your new Gentoo Linux system, and a useful
1854 <uri link="http://www.gentoo.org/doc/en/portage-user.xml">Portage user guide</uri>
1855 to help familiarize you with Portage basics. You can find the rest of the Gentoo Documentation
1856 <uri link="http://www.gentoo.org/main/en/docs.xml">here</uri>. If you have any other questions
1857 involving installation or anything for that matter, please check the Gentoo Linux
1858 <uri link="http://www.gentoo.org/doc/en/faq.xml">FAQ</uri>.
1859 Enjoy and welcome to Gentoo Linux!
1860 </p>
1861 </body>
1862 </section>
1863 </chapter>
1864 <chapter>
1865 <title>Gentoo-Stats</title>
1866 <section>
1867 <body>
1868 <p>The Gentoo Linux usage statistics program was started as an attempt to give the developers
1869 a way to find out about their user base. It collects information about Gentoo Linux usage to help
1870 us in set priorities our development. Installing it is completely optional, and it would be greatly
1871 appreciated if you decide to use it. Compiled statistics can be viewed at <uri>http://stats.gentoo.org/</uri>.
1872 </p>
1873 <p>The gentoo-stats server will assign a unique ID to your system.
1874 This ID is used to make sure that each system is counted only once. The ID will not be used
1875 to individually identify your system, nor will it be mached against an IP address or
1876 other personal information. Every precaution has been taken to assure your privacy in the
1877 development of this system. The following are the things that we are monitoring
1878 right now through our &quot;gentoo-stats&quot; program:
1879 </p>
1880 <ul>
1881 <li>installed packages and their version numbers</li>
1882 <li>CPU information: speed (MHz), vendor name, model name, CPU flags (like &quot;mmx&quot; or &quot;3dnow&quot;)</li>
1883 <li>memory information (total available physical RAM, total available swap space)</li>
1884 <li>PCI cards and network controller chips</li>
1885 <li>the Gentoo Linux profile your machine is using (that is, where the /etc/make.profile link is pointing to).</li>
1886 </ul>
1887 <p>We are aware that disclosure of sensitive information is a threat to most Gentoo Linux users
1888 (just as it is to the developers).
1889 </p>
1890 <ul>
1891 <li>Unless you modify the gentoo-stats program, it will never transmit sensitive
1892 information such as your passwords, configuration data, shoe size...</li>
1893 <li>Transmission of your e-mail addresses is optional and turned off by default.</li>
1894 <li>The IP address your data transmission originates from will never be logged
1895 in such a way that we can identify you. There are no &quot;IP address/system ID&quot; pairs.</li>
1896 </ul>
1897 <p>The installation is easy - just run the following commands:
1898 </p>
1899 <pre caption="Installing gentoo-stats">
1900 # <c>emerge gentoo-stats</c> <codenote>Installs gentoo-stats</codenote>
1901 # <c>gentoo-stats --new</c> <codenote>Obtains a new system ID</codenote>
1902 </pre>
1903 <p>The second command above will request a new system ID and enter it into
1904 <path>/etc/gentoo-stats/gentoo-stats.conf</path> automatically. You can view this file
1905 to see additional configuration options.
1906 </p>
1907 <p>After that, the program should be run on a regular schedule
1908 (gentoo-stats does not have to be run as root). Add this line to your <path>crontab</path>:
1909 </p>
1910 <pre caption="Updating gentoo-stats with cron">
1911 <c>0 0 * * 0,4 /usr/sbin/gentoo-stats --update &gt; /dev/null</c>
1912 </pre>
1913 <p>The <c>gentoo-stats</c> program is a simple perl script which can be
1914 viewed with your favorite pager or editor: <path>/usr/sbin/gentoo-stats</path>. </p>
1915 </body>
1916 </section>
1917 </chapter>
1918 </guide>

  ViewVC Help
Powered by ViewVC 1.1.20