/[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.131 - (hide annotations) (download) (as text)
Wed Jun 25 15:49:24 2003 UTC (14 years, 11 months ago) by swift
Branch: MAIN
Changes since 1.130: +1 -1 lines
File MIME type: application/xml
Fix wrong URL in doc for downloading stages/isos

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

  ViewVC Help
Powered by ViewVC 1.1.20