1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
|
<?xml version='1.0'?>
<guide link="/doc/install.html">
<title>Gentoo Linux Installation Guide</title>
<author title="Chief Architect"><mail link="drobbins@gentoo.org">Daniel Robbins</mail></author>
<author title="Editor"><mail link="thomasfl@gentoo.org">Thomas Flavel</mail></author>
<abstract>This guide shows you how to install Gentoo Linux 1.0_rc4_pre2. Right now,
Gentoo Linux installation is geared towards intermediate to advanced developers
and system administrators. The process itself is not incredibly complex, but
you must know how to set up partitions, manually create filesystems, and
extract tarballs. If you know how to do this, then you're ready to install the
Gentoo Linux release candidate.</abstract>
<version>1.0.1</version>
<date>22 Apr 2001</date>
<chapter>
<title>Getting started</title>
<section>
<title>Install Methods</title>
<body>
<p>Rather than provide a special system installer program, we've chosen to provide
you with a real Linux shell prompt. From this prompt, you can perform all the
steps necessary to install Gentoo Linux, and get everything set up exactly as
you need it. People often ask whether we're going to provide a fancy install
program in the future. Yes, we'd like to do this, but there will always be a
relatively simple "manual" install method for those who need it. By having
a manual install method, we not only cater to Linux experts, but also make it
easy for people building a special-purpose product out of Gentoo Linux. Because
our install process is "out in the open", it's easy for others to customize,
automate or beautify to their liking.
</p></body>
</section>
<section>
<title>Partition layout</title>
<body>
<p>Here's a quick overview of the standard Gentoo Linux partition layout. We're going to create at
least three partitions: a swap partition, a root partition (to hold the bulk of Gentoo Linux), and a special boot
partition. The boot partition is designed to hold GRUB boot loader information
as well as your Linux kernel(s). The boot partition gives us a safe place to
store everything related to booting Linux. During normal day-to-day Gentoo
Linux use, your boot partition should remain <e>unmounted</e>. This prevents
your kernel from being made unavailable to GRUB (due to filesystem corruption)
in the event of a system crash, preventing the chicken-and-egg problem where
GRUB can't read your kernel (since your filesystem is corrupted) but you can't
run fsck to uncorrupt your filesystem (since you can't boot!)
</p>
</body>
</section>
<section>
<title>Partition Selection</title>
<body>
<p>Now, on to filesystem types. We recommend that you install Gentoo Linux on a
ReiserFS filesystem because they're much faster and generally more reliable
than their ext2 counterparts. We've been using ReiserFS for a long time now
and we believe it's not only "stable enough", but perfect for use in production
environments. However, if you want to use ext2 for your root and boot
filesystems, we support this as well. Support will likely be added for JFS in
the near future, as well as XFS - as soon as it's ready. Here are our recommended
filesystem sizes and types:</p>
<table>
<tr>
<th>Partition</th>
<th>Size</th>
<th>Type</th>
</tr>
<tr>
<ti>boot partition, containing kernel(s) and boot information</ti>
<ti>~100 Megabytes</ti>
<ti>ReiserFS recommended, ext2 ok</ti>
</tr>
<tr>
<ti>root partition, containing main filesystem (/usr, /home, etc)</ti>
<ti>>=1.5 Gigabytes</ti>
<ti>ReiserFS recommended, ext2 ok</ti>
</tr>
<tr>
<ti>swap partition (no longer a 128 Megabyte limit)</ti>
<ti>>=128 Megabytes</ti>
<ti>Linux swap</ti>
</tr>
</table>
</body>
</section>
<section>
<title>Getting What You Need</title>
<body><p>
In this install guide, I'm going to be stepping you through the Gentoo
Linux CD-based installation process. To perform the CD install, you'll
need the Gentoo Linux 1.0_rc4_pre2 CD ISO image, available at <uri>
http://www.ibiblio.org/gentoo/gentoo-iso-images/</uri> (~550Mb download.)
It's also possible to install Gentoo Linux from an existing Linux
installation. If you'd like to do this instead, you'll need to
download the <path>1.0_rc4_pre2 sys.tbz2</path> file, available from <uri>
http://www.ibiblio.org/gentoo/gentoo-x86-distro/gentoo-1.0_rc4_pre2/packages/</uri> (~67Mb download.)
If you choose to install Gentoo Linux from another Linux distribution, you'll
need to have the tools to unpack a bzip'd tarball (nearly all distributions do.) However,
at this time, most distributions don't have the ability to create and mount ReiserFS
partitions. If you don't have this ability, you may need to ReiserFS-enable your
current system if you'd like to use ReiserFS. Another possibility is to use
ext2 filesystems for Gentoo Linux, or alternatively just download and burn our
CD image, which has all the tools you need for ReiserFS.
</p>
</body>
</section>
</chapter>
<chapter>
<title>Installation</title>
<section>
<title>Booting the CD</title>
<body>
<p>
Once you've downloaded the ISO image and burned your own Gentoo Linux CD, go ahead
and boot your system from the CD. You'll be presented with a GRUB menu that looks
like this:
</p>
<figure link="/images/install-boot.gif" short="The boot screen" caption="When the CD boots, you'll see this screen"/>
<p>
Go ahead and select the first option to continue the CD boot process. Linux will boot and the Gentoo
Linux CD detector will start up and detect and mount a minimal Gentoo Linux system included
on the CD. When the boot process is complete, you'll be presented with a login prompt. To
log in, go ahead and type <c>root</c> and hit Enter. You won't be prompted for a password.
</p>
</body>
</section>
<section>
<title>Using boot floppies</title>
<body>
<p>In case you can't use a bootable cd for some reason (i.e. no burner, we
haven't made isos, your cat ate all your blank cds etc.) you can use the boot
floppies. You'll need bootdisk.img and rescue.img. You can find them <uri
link="http://www.ibiblio.org/gentoo/snapshots/disks/">here</uri>
(look in the latest
rc dir).
</p>
<p>Once you've downloaded them you need to run <c>dd if=bootdisk.img of=/dev/fd0
bs=1k</c> for both the bootdisk.img and rescue.img. Then you can boot from
bootdisk.img, and insert rescue.img when it prompts you. If you have a
currently running system you may want to download sys or build tarball and
store it on a spare partition so you will have it available when you reboot.
</p>
</body>
</section>
<section>
<title>Step 1: Create and Format Your Partitions</title>
<body>
<p>
The first step is to create your boot, root (plus optional <path>/home</path>, <path>/usr</path>, <path>/var</path>)
and swap partitions using fdisk (type <c>fdisk /dev/hd?</c> to start it up.) Your
boot and root partition should be tagged as a "Linux" partitions (type 83) even
if you're using ReiserFS. Your swap partition should be tagged as "Linux swap"
(type 82). Here's a screenshot of an example partition layout. In this
example, <path>/dev/hda1</path> is the boot partition (256Mb), <path>/dev/hda2</path> is the swap
partition (256Mb), and <path>/dev/hda3</path> is the root partition (1.5Gb). Notice that
<path>/dev/hda1</path> has the bootable flag set (you can set this with the <c>a</c> option.)
Once you've created your partitions, remember to write your changes using the
<c>w</c> option.
</p>
<figure link="/images/install-fdisk.gif" short="Creating partitions" caption="Creating partitions using fdisk"/>
</body>
</section>
<section>
<title>Step 2: Create and Mount Filesystems</title>
<body>
<p>
The second step is to create your filesystems. Use the commands <c>mke2fs</c>, <c>mkreiserfs</c> and <c>mkswap</c> for this. For example, to create
a new ReiserFS filesystem on the partition /dev/hda1, type:
</p><pre>
# <i>mkreiserfs /dev/hda1</i></pre>
<p>For my example partition layout above, I typed in the following commands:
</p>
<pre linkid="filesyscode" caption="Creating and mounting filesystems">
# <i>mkreiserfs /dev/hda1</i>
# <i>mkswap /dev/hda2</i>
# <i>mkreiserfs /dev/hda3</i>
</pre><p>
Now that the filesystems have been created, it's time to get your boot and root (and optionally your /var, /usr and /home partitions) mounted.
For my example partition layout, I typed in the following:
</p><pre>
# <i>mount /dev/hda3 /mnt/gentoo</i>
# <i>mkdir /mnt/gentoo/boot</i>
# <i>mount /dev/hda1 /mnt/gentoo/boot -o notail</i>
</pre>
<note title="The notail option">The "notail" option is required if you're
installing GRUB as a secondary boot loader. It also doesn't hurt to include it
if you're not.</note>
<p>Notice that I had to create the <path>/mnt/gentoo/boot</path> filesystem before mounting <path>/dev/hda1</path>. If you've created
additional non-root filesystems (<path>/var</path>, <path>/usr</path>, <path>/home</path>, etc), you'll need to create the appropriate directories under <path>/mnt/gentoo</path>
and then mount all your filesystems at the correct locations. Once all your filesystems are mounted, we're ready to extract
the <path>sys.tbz2</path> tarball - the file that contains the Gentoo Linux base system.
</p>
<note>
If you're installing Gentoo Linux direct from an existing Linux distribution, make sure that all your filesystems are mounted at the <path>/mnt/gentoo</path>
mountpoint just like I described above. From this point on, you should be able to follow our install instructions word for
word.
</note>
</body>
</section>
<section>
<title>Step 3: Extract the sys.tbz2 Tarball</title>
<body>
<p>
Now, it's time to extract the <path>sys.tbz2</path> tarball to <path>/mnt/gentoo</path>.
You'll find the tarball at <path>/mnt/distcd/packages/sys.tbz2</path>.
Extract it by typing:</p>
<pre>
# <i>tar xpjvf /mnt/distcd/packages/sys.tbz2 -C /mnt/gentoo</i>
</pre>
<impo>Please notice that we use the <c>p</c> option when extracting the
sys tarball. This is <e>extremely</e> important, since it ensures that
the literal permissions in the tarball will be preserved on disk. Without
the <c>p</c>, directory perms are affected by the umask -- which is helpful
when you're extracting a source tarball, but not so helpful when you're
restoring a system image.</impo>
<p>
If you're installing from another Linux distribution and your version of tar doesn't have the <c>-j</c> (bzip2) option, the following
pipeline should do the exact same thing:
</p><pre>
# <i>cat /path/to/sys.tbz2 | bzip2 -d | tar -xpvf - -C /mnt/gentoo</i>
</pre>
<impo>Again, notice that we use the extremely important <c>p</c> option to
extract the tarball.</impo>
</body>
</section>
</chapter>
<chapter>
<title>Configuration</title>
<section>
<title>Configure the system</title>
<body><note>If you want to compile a custom kernel during the install process, them before proceeding with the
following instructions, copy the linux-sources tbz2 file from <path>/mnt/distcd/packages/All/linux-sources-???.tbz2</path> to <path>/mnt/gentoo/tmp</path>.
Then, proceed with these instructions. I'll let you know when it's time to merge it.</note>
<p>Now that the base system tarball has been extracted, we need to get the system ready for booting. Begin this process
by typing:
</p><pre>
# <i>chroot /mnt/gentoo</i>
</pre><p>The chroot command will start a new shell with the root filesystem set to <path>/mnt/gentoo</path>.
If you have a non-US keyboard, you've probably noticed that some keys aren't in the right place. This can be fixed by
typing:
</p><pre>
# <i>loadkeys [keymap]</i>
</pre><p>
Here are some popular non-English keymaps:</p>
<table><th>Language</th><th>Keymap</th>
<tr><ti>German</ti><ti>de-latin1-nodeadkeys</ti></tr>
<tr><ti>French</ti><ti>fr_latin1</ti></tr>
<tr><ti>Swedish</ti><ti>se_latin1</ti></tr>
</table>
<p>
Please <mail link="drobbins@gentoo.org">email me</mail> the keymaps that you use for your
preferred language so that I can add them to this document. Now, type the following commands:
</p><pre>
# <i>env-update</i>
# <i>/etc/rc.d/init.d/initscripts-install</i>
</pre><p>The first command, env-update, is a special Gentoo Linux command that auto-generates the <path>/etc/ld.so.conf</path> file and configures
the default shell environment variable and path settings. The second script will configure Gentoo Linux initialization scripts,
so that all the proper symlinks are in place in <path>/etc/rc.d</path> so that the system will boot.
</p>
<p>There are just a few files that need to be configured before we're ready to install the Gentoo Linux boot loader (GRUB) and
start Gentoo Linux. Right now, the only editor included with the base system is <c>vi</c>. In the next release, we're also going
to include another text editor that's easier to use for those who don't know <c>vi</c>. If you don't know how to use vi, here are
some quick instructions. To edit a file, type <c>vi filename</c>. Immediately after <c>vi</c> loads the file, press the <c>i</c> key to enter
INSERT mode. In this mode, you'll be able to move around in the file by using the arrow keys, and you'll be able to insert
text just by typing it and delete text with the backspace or delete key. If you need to delete an entire line, press escape
to leave INSERT mode (you're now in command mode), and hit <c>dd</c>. Then, hit <c>i</c> again to go back to INSERT mode. When you need
to save your changes, hit escape to leave INSERT mode and type <c>:x</c>. If you want to throw away your changes, type <c>:q!</c>.
Vim, the version of vi that's included with Gentoo Linux, also includes extensive help. You can type <c>:help</c> (in command mode)
to access it.</p>
</body>
</section>
<section>
<title>/etc/fstab</title>
<body>
<p>Edit this file, making sure that the partition names and filesystem types are correct. Here are the
first three configuration lines for my example system configuration:
</p><pre>
/dev/hda3 / reiserfs defaults 1 1
/dev/hda2 none swap sw 0 0
/dev/hda1 /boot reiserfs noauto,notail 0 2
</pre>
</body>
</section>
<section>
<title>/etc/localtime</title>
<body>
<p>Look for your timezone (or GMT if you using Greenwich Mean Time) in <path>/usr/share/zoneinfo</path>. Then, make a symbolic link by typing:
</p><pre>
# <i>cd /etc; ln -sf /usr/share/zoneinfo/path/to/timezonefile localtime</i>
</pre>
</body>
</section>
<section>
<title>/etc/hostname</title>
<body>
<p>Edit this file so that it contains your fully-qualified domain name on a single line, i.e. <c>mymachine.mydomain.com</c>.
</p>
</body>
</section>
<section>
<title>/etc/resolv.conf</title>
<body>
<p>This file contains DNS server and domain information. Here's a template to follow:
</p><pre>
domain mydomain.com
nameserver 10.0.0.1
nameserver 10.0.0.2
</pre>
</body>
</section>
<section>
<title>/etc/hosts</title>
<body>
<p>This file contains a list of ip addresses and their associated hostnames. It's used by the system to resolve the IP addresses
of any hostnames that may not be in your nameservers. Here's a template for this file:
</p><pre>
127.0.0.1 localhost
<comment># the next line contains your IP for your local LAN, and your associated machine name</comment>
192.168.1.1 mymachine.mydomain.com mymachine
</pre>
</body>
</section>
<section>
<title>Configure ethernet</title>
<body>
<p>Look in the <path>/etc/rc.d/config</path> directory; you'll see a file
called <path>OFF_inet.eth0</path>. Copy this file to <path>inet.eth0</path>, and edit the top part of it
so that it contains the IP address settings you want to use on your first
ethernet card. Look in <path>/lib/modules</path> for the ethernet module
specific to your particular ethernet card, and append it to the
<path>/etc/rc.d/config/modules</path> file (you can also add any options you
need to the same line.) Then, when Gentoo Linux boots, this module will be
automatically loaded from disk. If you have multiple network cards, copy
<path>inet.eth0</path> to <path>inet.eth1</path> and edit this file so that it
configures your second interface correctly. Repeat for eth2, etc as necessary.
If you have a static ppp link, you can copy the <path>inet.eth0</path> file to
<path>inet.ppp0</path>, and insert the appropriate commands in the
<c>netup()</c> and <c>netdown()</c> functions. All
<path>/etc/rc.d/config/inet.*</path> files will be started automatically at
boot time by the <path>/etc/rc.d/init.d/inet</path> rc script. </p>
</body>
</section>
<section>
<title>Configure basic settings</title>
<body>
<p>Take a look at the <path>/etc/rc.d/config/basic</path>, and make sure that it's set up properly. Important settings are GMT
(set to <c>yes</c> if your system clock is set to GMT, otherwise <c>no</c> if it's set to your local time) and KEYMAP (look in
<path>/usr/share/keymaps/i386</path> for available keymaps. To specify the keymap, set KEYMAP to the <e>prefix</e>
of the keymap filename (i.e. drop the <path>.kmap.gz</path> extension from the end.)
</p>
</body>
</section>
<section>
<title>Configure GRUB</title>
<body>
<p>
The most critical part of understanding GRUB is getting comfortable with how GRUB refers to hard drives and partitions.
Your Linux partition <path>/dev/hda1</path> is called <path>(hd0,0)</path> under GRUB. Notice the parenthesis around the hd0,0 - they are required.
Hard drives count from zero rather than "a", and partitions start at zero rather than one. So, <path>/dev/hdb3</path> gets translated to <path>(hd1,2)</path>, and <path>/dev/hdd7</path> gets translated to <path>(hd3,6)</path>. After you've gotten the feel for that, convert your boot and root partition names to the GRUB format and write them down. Now, it's time to install GRUB.
</p>
<p>The easiest way to install grub is to simply type <c>grub</c> at your chrooted shell prompt:
</p><pre>
# <i>grub</i>
</pre><p>You'll be presented with the <c>grub></c> grub command-line prompt. Now, you need to type in the
right commands to install the GRUB boot record onto your hard drive. In my example configuration,
I want to install the GRUB boot record on my hard drive's MBR (master boot record), so that
the first thing I see when I turn on the computer is the GRUB prompt. In my case, the commands
I want to type are:</p>
<pre>grub> <i>root (hd0,0)</i>
grub> <i>setup (hd0)</i>
</pre>
<p>Here's how the two commands work. The first <c>root ( )</c> command tells GRUB
the location of your boot partition (in my case, <path>/dev/hda1</path> or
<path>(hd0,0)</path> in GRUB terminology. Then, the second <c>setup ( )</c> command tells GRUB where to install the
boot record - it will be configure to look for its special files at the <c>root
( )</c> location that you specified. In my case, I want the boot record on the
MBR of the hard drive, so I simply specify <path>/dev/hda</path> (also known as <path>(hd0)</path>). If I were using
another boot loader and wanted to set up GRUB as a secondary boot-loader, I
could install GRUB to the boot record of a particular partition. In that case,
I'd specify a particular partition rather than the entire disk. Once the GRUB
boot record has been
successfully installed, you can type <c>quit</c> to quit GRUB. Gentoo Linux is
installed, but we need to create the <path>/boot/boot/grub/menu.lst</path> file so that
we get a nice GRUB boot menu when the system reboots. Here's how to do it.</p>
<p>Now, create the menu.lst file (<c>vi /boot/boot/grub/menu.lst</c>), and add the following to it:</p>
<pre>
default 0
timeout 30
title=My example Gentoo Linux
root (hd0,0)
kernel /boot/bzImage root=/dev/hda3
title=Windows NT Workstation
root (hd0,2)
chainloader +1
</pre><p>After saving this file, Gentoo Linux installation is complete. Selecting the first option will
tell GRUB to boot Gentoo Linux without a fuss. The second part of the menu.lst file is optional, and shows you how to
use GRUB to boot a bootable Windows partition.</p>
<note>Above, <path>(hd0,0)</path> should point to your "boot" partition
(<path>/dev/hda1</path> in my case) and <path>/dev/hda3</path> should point to
your root filesystem. <path>(hd0,2)</path> contains the NT boot
loader.</note> <p>Also, if you need to pass any options to the kernel, simply
add them to the end of the <c>kernel</c> command. We're already passing one option
(<c>root=/dev/hda3</c>), but you can pass others as well. There's one in particular
that you may be interested in. If you want to enable devfs (a special device
filesystem), you can add the <c>devfs=mount</c> option at the end of the <c>kernel</c>
line. </p>
</body>
</section>
<section>
<title>One Last Step</title>
<body>
<p>If you copied over the <path>linux-sources-???.tbz2</path> file, you can now install the package and compile a fresh new
kernel. To merge the linux-sources, type <c>pkgmerge /tmp/linux-sources-???.tbz2</c>. After the merge completes,
you can remove the .tbz2 from <path>/tmp</path> and continue with the kernel compile step. If you didn't copy over the
linux sources, you can skip the kernel compile step and proceed unmounting your filesystems below.</p>
<p>To compile your own kernel, perform the following steps:</p><pre>
# <i>cd /usr/src/linux</i>
# <i>make menuconfig</i>
<codenote>make sure you compile-in support for ReiserFS as well as your boot drive controller</codenote>
# <i>make bzImage</i>
# <i>make modules</i>
# <i>make modules_install</i>
# <i>cp arch/i386/boot/bzImage /boot/boot</i>
<codenote>Above, "/boot/boot" is intentional and should not simply be "/boot"</codenote>
</pre>
<p>Now, Gentoo Linux is installed. The only remaining step is to exit the chrooted shell, safely unmount your partitions
and reboot the system:</p>
<pre>
# <i>exit</i>
<codenote>This exits the chrooted shell; you can also type <c>^D</c></codenote>
# <i>umount /mnt/gentoo/boot</i>
# <i>umount /mnt/gentoo</i>
# <i>reboot</i>
</pre>
</body>
</section>
</chapter>
<chapter>
<title>You're done!</title>
<section>
<title>Congratulations!</title>
<body><p>If you have any questions or would like to get involved with Gentoo Linux development,
consider joining our gentoo-dev mailing list (there's a "click to subscribe" link on our <uri link="http://www.gentoo.org">main page</uri>).
</p>
</body>
</section>
</chapter>
</guide>
|