/[gentoo]/xml/htdocs/doc/en/handbook/hb-install-config.xml
Gentoo

Contents of /xml/htdocs/doc/en/handbook/hb-install-config.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.124 - (show annotations) (download) (as text)
Tue Dec 17 09:45:47 2013 UTC (4 years, 10 months ago) by swift
Branch: MAIN
Changes since 1.123: +12 -2 lines
File MIME type: application/xml
Fix bug #483654 - Add info on by-id and by-uuid for fstab

1 <?xml version='1.0' encoding='UTF-8'?>
2 <!DOCTYPE sections SYSTEM "/dtd/book.dtd">
3
4 <!-- The content of this document is licensed under the CC-BY-SA license -->
5 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
6
7 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-config.xml,v 1.123 2013/12/17 09:34:53 swift Exp $ -->
8
9 <sections>
10
11 <abstract>
12 You need to edit some important configuration files. In this chapter
13 you receive an overview of these files and an explanation on how to
14 proceed.
15 </abstract>
16
17 <version>30</version>
18 <date>2013-12-17</date>
19
20 <section>
21 <title>Filesystem Information</title>
22 <subsection>
23 <title>What is fstab?</title>
24 <body>
25
26 <p>
27 Under Linux, all partitions used by the system must be listed in
28 <path>/etc/fstab</path>. This file contains the mount points of those partitions
29 (where they are seen in the file system structure), how they should be mounted
30 and with what special options (automatically or not, whether users can mount
31 them or not, etc.)
32 </p>
33
34 </body>
35 </subsection>
36 <subsection>
37 <title>Creating /etc/fstab</title>
38 <body>
39
40 <p>
41 <path>/etc/fstab</path> uses a special syntax. Every line consists of six
42 fields, separated by whitespace (space(s), tabs or a mixture). Each field has
43 its own meaning:
44 </p>
45
46 <ul>
47 <li>
48 The first field shows the <b>partition</b> described (the path to the device
49 file)
50 </li>
51 <li>
52 The second field shows the <b>mount point</b> at which the partition should be
53 mounted
54 </li>
55 <li>
56 The third field shows the <b>filesystem</b> used by the partition
57 </li>
58 <li>
59 The fourth field shows the <b>mount options</b> used by <c>mount</c> when it
60 wants to mount the partition. As every filesystem has its own mount options,
61 you are encouraged to read the mount man page (<c>man mount</c>) for a full
62 listing. Multiple mount options are comma-separated.
63 </li>
64 <li>
65 The fifth field is used by <c>dump</c> to determine if the partition needs to
66 be <b>dump</b>ed or not. You can generally leave this as <c>0</c> (zero).
67 </li>
68 <li>
69 The sixth field is used by <c>fsck</c> to determine the order in which
70 filesystems should be <b>check</b>ed if the system wasn't shut down properly.
71 The root filesystem should have <c>1</c> while the rest should have <c>2</c>
72 (or <c>0</c> if a filesystem check isn't necessary).
73 </li>
74 </ul>
75
76 <impo>
77 The default <path>/etc/fstab</path> file provided by Gentoo <e>is not a valid
78 fstab file</e>. You <b>have to create</b> your own <path>/etc/fstab</path>.
79 </impo>
80
81 <pre caption="Opening /etc/fstab">
82 # <i>nano -w /etc/fstab</i>
83 </pre>
84
85 <p>
86 In the remainder of the text, we use the default <path>/dev/sd*</path> block
87 device files as partition. You can also opt to use the symbolic links in the
88 <path>/dev/disk/byid</path> or <path>/dev/disk/by-uuid</path>. These names are
89 not likely to change, whereas the default block device files naming depends on
90 a number of factors (such as how and in what order the disks are attached to
91 your system). However, if you do not intend to fiddle with the disk ordering,
92 you can continue with the default block device files safely.
93 </p>
94
95 </body>
96 <body test="func:keyval('/boot')">
97
98 <p>
99 Let us take a look at how we write down the options for the <path>/boot</path>
100 partition. This is just an example, if you didn't or couldn't create a
101 <path>/boot</path>, don't copy it.
102 </p>
103
104 <p>
105 In our default <keyval id="arch"/> partitioning example, <path>/boot</path> is
106 usually the <path><keyval id="/boot"/></path> partition, with <c>ext2</c> as
107 filesystem. It needs to be checked during boot, so we would write down:
108 </p>
109
110 <pre caption="An example /boot line for /etc/fstab">
111 <keyval id="/boot"/> /boot ext2 defaults 0 2
112 </pre>
113
114 <p>
115 Some users don't want their <path>/boot</path> partition to be mounted
116 automatically to improve their system's security. Those people should
117 substitute <c>defaults</c> with <c>noauto</c>. This does mean that you need to
118 manually mount this partition every time you want to use it.
119 </p>
120
121 </body>
122 <body>
123
124 <p>
125 Add the rules that match your partitioning scheme and append rules for
126 your CD-ROM drive(s), and of course, if you have other partitions or drives,
127 for those too.
128 </p>
129
130 <p>
131 Now use the <e>example</e> below to create your <path>/etc/fstab</path>:
132 </p>
133
134 <pre caption="A full /etc/fstab example" test="func:keyval('arch')='HPPA'">
135 <keyval id="/boot"/> /boot ext2 defaults,noatime 0 2
136 /dev/sda3 none swap sw 0 0
137 /dev/sda4 / ext4 noatime 0 1
138
139 /dev/cdrom /mnt/cdrom auto noauto,user 0 0
140 </pre>
141
142 <pre caption="A full /etc/fstab example" test="func:keyval('arch')='Alpha' or func:keyval('arch')='MIPS' or func:keyval('arch')='x86' or func:keyval('arch')='AMD64'">
143 <keyval id="/boot"/> /boot ext2 defaults,noatime 0 2
144 /dev/sda2 none swap sw 0 0
145 /dev/sda3 / ext4 noatime 0 1
146
147 /dev/cdrom /mnt/cdrom auto noauto,user 0 0
148 </pre>
149
150 <pre caption="A full /etc/fstab example" test="func:keyval('arch')='SPARC'">
151 /dev/sda1 / ext4 noatime 0 1
152 /dev/sda2 none swap sw 0 0
153 /dev/sda4 /usr ext4 noatime 0 2
154 /dev/sda5 /var ext4 noatime 0 2
155 /dev/sda6 /home ext4 noatime 0 2
156
157 <comment># You must add the rules for openprom</comment>
158 openprom /proc/openprom openpromfs defaults 0 0
159
160 /dev/cdrom /mnt/cdrom auto noauto,user 0 0
161 </pre>
162
163 <pre caption="A full /etc/fstab example" test="func:keyval('arch')='PPC' or
164 func:keyval('arch')='PPC64'">
165 /dev/sda4 / ext4 noatime 0 1
166 /dev/sda3 none swap sw 0 0
167
168 /dev/cdrom /mnt/cdrom auto noauto,user 0 0
169 </pre>
170
171 <p>
172 <c>auto</c> makes <c>mount</c> guess for the filesystem (recommended for
173 removable media as they can be created with one of many filesystems) and
174 <c>user</c> makes it possible for non-root users to mount the CD.
175 </p>
176
177 <p>
178 To improve performance, most users would want to add the <c>noatime</c>
179 mount option, which results in a faster system since access times
180 aren't registered (you don't need those generally anyway). This is also
181 recommended for solid state drive (SSD) users, who should also enable
182 the <c>discard</c> mount option (ext4 and btrfs only for now) which
183 makes the TRIM command work.
184 </p>
185
186 <p>
187 Double-check your <path>/etc/fstab</path>, save and quit to continue.
188 </p>
189
190 </body>
191 </subsection>
192 </section>
193 <section>
194 <title>Networking Information</title>
195 <subsection>
196 <title>Host name, Domainname, etc</title>
197 <body>
198
199 <p>
200 One of the choices the user has to make is name his/her PC. This seems to be
201 quite easy, but <e>lots</e> of users are having difficulties finding the
202 appropriate name for their Linux-pc. To speed things up, know that any name you
203 choose can be changed afterwards. For all we care, you can just call your system
204 <c>tux</c> and domain <c>homenetwork</c>.
205 </p>
206
207 <pre caption="Setting the host name">
208 # <i>nano -w /etc/conf.d/hostname</i>
209
210 <comment>(Set the hostname variable to your host name)</comment>
211 hostname="<i>tux</i>"
212 </pre>
213
214 <p>
215 Second, <e>if</e> you need a domainname, set it in <path>/etc/conf.d/net</path>.
216 You only need a domain if your ISP or network administrator says so, or if you
217 have a DNS server but not a DHCP server. You don't need to worry about DNS or
218 domainnames if your networking is setup for DHCP.
219 </p>
220
221 <pre caption="Setting the domainname">
222 # <i>nano -w /etc/conf.d/net</i>
223
224 <comment>(Set the dns_domain variable to your domain name)</comment>
225 dns_domain_lo="<i>homenetwork</i>"
226 </pre>
227
228 <note>
229 If you choose not to set a domainname, you can get rid of the "This is
230 hostname.(none)" messages at your login screen by editing
231 <path>/etc/issue</path>. Just delete the string <c>.\O</c> from that file.
232 </note>
233
234 <p>
235 If you have a NIS domain (if you don't know what that is, then you don't have
236 one), you need to define that one too:
237 </p>
238
239 <pre caption="Setting the NIS domainname">
240 # <i>nano -w /etc/conf.d/net</i>
241
242 <comment>(Set the nis_domain variable to your NIS domain name)</comment>
243 nis_domain_lo="<i>my-nisdomain</i>"
244 </pre>
245
246 <note>
247 For more information on configuring DNS and NIS, please read the examples
248 provided in <path>/usr/share/doc/openrc-*/net.example.bz2</path> which
249 can be read using <c>bzless</c>. Also, you may want to emerge <c>openresolv</c>
250 to help manage your DNS/NIS setup.
251 </note>
252
253 </body>
254 </subsection>
255 <subsection>
256 <title>Configuring your Network</title>
257 <body>
258
259 <p>
260 Before you get that "Hey, we've had that already"-feeling, you should remember
261 that the networking you set up in the beginning of the Gentoo installation was
262 just for the installation. Right now you are going to configure networking for
263 your Gentoo system permanently.
264 </p>
265
266 <note>
267 More detailed information about networking, including advanced topics like
268 bonding, bridging, 802.1Q VLANs or wireless networking is covered in the <uri
269 link="?part=4">Gentoo Network Configuration</uri> section.
270 </note>
271
272 <p>
273 All networking information is gathered in <path>/etc/conf.d/net</path>. It uses
274 a straightforward yet not intuitive syntax if you don't know how to set up
275 networking manually. But don't fear, we'll explain everything. A fully
276 commented example that covers many different configurations is available in
277 <path>/usr/share/doc/openrc-*/net.example.bz2</path>.
278 </p>
279
280 <p>
281 DHCP is used by default. For DHCP to work, you will need to install a DHCP
282 client. This is described later in <uri
283 link="?part=1&amp;chap=9#networking-tools">Installing Necessary System
284 Tools</uri>. Do not forget to install a DHCP client.
285 </p>
286
287 <p>
288 If you need to configure your network connection either because you need
289 specific DHCP options or because you do not use DHCP at all, open
290 <path>/etc/conf.d/net</path> with your favorite editor (<c>nano</c> is used in
291 this example):
292 </p>
293
294 <pre caption="Opening /etc/conf.d/net for editing">
295 # <i>nano -w /etc/conf.d/net</i>
296 </pre>
297
298 <p>
299 You will see the following file:
300 </p>
301
302 <pre caption="Default /etc/conf.d/net">
303 # This blank configuration will automatically use DHCP for any net.*
304 # scripts in /etc/init.d. To create a more complete configuration,
305 # please review /usr/share/doc/openrc-*/net.example.bz2 and save
306 # your configuration in /etc/conf.d/net (this file :]!).
307 </pre>
308
309 <p>
310 To enter your own IP address, netmask and gateway, you need
311 to set both <c>config_eth0</c> and <c>routes_eth0</c>:
312 </p>
313
314 <note>
315 This assumes that your network interface will be called eth0. This is, however,
316 very system dependent. It is recommended to assume that the interface is named
317 the same as the interface name when booted from the installation media <e>if</e>
318 the installation media is sufficiently recent. More information can be found in
319 <uri link="?part=4&amp;chap=2#doc_chap4">Network Interface Naming</uri>.
320 </note>
321
322 <pre caption="Manually setting IP information for eth0">
323 config_eth0="192.168.0.2 netmask 255.255.255.0 brd 192.168.0.255"
324 routes_eth0="default via 192.168.0.1"
325 </pre>
326
327 <p>
328 To use DHCP, define <c>config_eth0</c>:
329 </p>
330
331 <pre caption="Automatically obtaining an IP address for eth0">
332 config_eth0="dhcp"
333 </pre>
334
335 <p>
336 Please read <path>/usr/share/doc/openrc-*/net.example.bz2</path> for a
337 list of all available options. Be sure to also read your DHCP client manpage if
338 you need to set specific DHCP options.
339 </p>
340
341 <p>
342 If you have several network interfaces repeat the above steps for
343 <c>config_eth1</c>, <c>config_eth2</c>, etc.
344 </p>
345
346 <p>
347 Now save the configuration and exit to continue.
348 </p>
349
350 </body>
351 </subsection>
352 <subsection>
353 <title>Automatically Start Networking at Boot</title>
354 <body>
355
356 <p>
357 To have your network interfaces activated at boot, you need to add them to the
358 default runlevel.
359 </p>
360
361 <pre caption="Adding net.eth0 to the default runlevel">
362 # <i>cd /etc/init.d</i>
363 # <i>ln -s net.lo net.eth0</i>
364 # <i>rc-update add net.eth0 default</i>
365 </pre>
366
367 <p>
368 If you have several network interfaces, you need to create the appropriate
369 <path>net.*</path> files just like you did with <path>net.eth0</path>.
370 </p>
371
372 <p>
373 If you later find out the assumption about the network interface name (which we
374 currently document as eth0) was wrong, then
375 </p>
376
377 <ol>
378 <li>
379 update the <path>/etc/conf.d/net</path> file with the correct interface name (like enp3s0
380 instead of eth0),
381 </li>
382 <li>
383 create new symbolic link (like <path>/etc/init.d/net.enp3s0</path>),
384 </li>
385 <li>
386 remove the old symbolic link (<c>rm /etc/init.d/net.eth0</c>),
387 </li>
388 <li>
389 add the new one to the default runlevel, and
390 </li>
391 <li>
392 remove the old one using <c>rc-update del net.eth0 default</c>.
393 </li>
394 </ol>
395
396 </body>
397 </subsection>
398 <subsection>
399 <title>Writing Down Network Information</title>
400 <body>
401
402 <p>
403 You now need to inform Linux about your network. This is defined in
404 <path>/etc/hosts</path> and helps in resolving host names to IP addresses for
405 hosts that aren't resolved by your nameserver. You need to define your system.
406 You may also want to define other systems on your network if you don't want to
407 set up your own internal DNS system.
408 </p>
409
410 <pre caption="Opening /etc/hosts">
411 # <i>nano -w /etc/hosts</i>
412 </pre>
413
414 <pre caption="Filling in the networking information">
415 <comment>(This defines the current system)</comment>
416 127.0.0.1 tux.homenetwork tux localhost
417
418 <comment>(Define extra systems on your network,
419 they need to have a static IP to be defined this way.)</comment>
420 192.168.0.5 jenny.homenetwork jenny
421 192.168.0.6 benny.homenetwork benny
422 </pre>
423
424 <p>
425 Save and exit the editor to continue.
426 </p>
427
428 <p test="func:keyval('arch')='AMD64' or func:keyval('arch')='x86' or substring(func:keyval('arch'),1,3)='PPC'">
429 If you don't have PCMCIA, you can now continue with <uri
430 link="#sysinfo">System Information</uri>. PCMCIA-users should read the
431 following topic on PCMCIA.
432 </p>
433
434 </body>
435 </subsection>
436 <subsection test="func:keyval('arch')='AMD64' or func:keyval('arch')='x86' or substring(func:keyval('arch'),1,3)='PPC'">
437 <title>Optional: Get PCMCIA Working</title>
438 <body>
439
440 <p>
441 PCMCIA users should first install the <c>pcmciautils</c> package.
442 </p>
443
444 <pre caption="Installing pcmciautils">
445 # <i>emerge pcmciautils</i>
446 </pre>
447
448 </body>
449 </subsection>
450 </section>
451
452 <section id="sysinfo">
453 <title>System Information</title>
454 <subsection>
455 <title>Root Password</title>
456 <body>
457
458 <p>
459 First we set the root password by typing:
460 </p>
461
462 <pre caption="Setting the root password">
463 # <i>passwd</i>
464 </pre>
465
466 </body>
467 </subsection>
468 <subsection>
469 <title>System Information</title>
470 <body>
471
472 <p>
473 Gentoo uses <path>/etc/rc.conf</path> to configure the services, startup,
474 and shutdown of your system. Open up <path>/etc/rc.conf</path> and enjoy all
475 the comments in the file.
476 </p>
477
478 <pre caption="Configuring services">
479 # <i>nano -w /etc/rc.conf</i>
480 </pre>
481
482 <p>
483 When you're finished configuring these two files, save them and exit.
484 </p>
485
486 <p>
487 Gentoo uses <path>/etc/conf.d/keymaps</path> to handle keyboard configuration.
488 Edit it to configure your keyboard.
489 </p>
490
491 <pre caption="Opening /etc/conf.d/keymaps">
492 # <i>nano -w /etc/conf.d/keymaps</i>
493 </pre>
494
495 <p>
496 Take special care with the <c>keymap</c> variable. If you select the wrong
497 <c>keymap</c>, you will get weird results when typing on your keyboard.
498 </p>
499
500 <note test="substring(func:keyval('arch'),1,3)='PPC'">
501 PPC uses x86 keymaps on most systems.
502 </note>
503
504 <p>
505 When you're finished configuring <path>/etc/conf.d/keymaps</path>, save and
506 exit.
507 </p>
508
509 <p>
510 Gentoo uses <path>/etc/conf.d/hwclock</path> to set clock options. Edit it
511 according to your needs.
512 </p>
513
514 <pre caption="Opening /etc/conf.d/hwclock">
515 # <i>nano -w /etc/conf.d/hwclock</i>
516 </pre>
517
518 <p>
519 If your hardware clock is not using UTC, you need to add <c>clock="local"</c>
520 to the file. Otherwise you will notice some clock skew.
521 </p>
522
523 <p>
524 When you're finished configuring <path>/etc/conf.d/hwclock</path>, save and
525 exit.
526 </p>
527
528 </body>
529 </subsection>
530
531 <subsection>
532 <title>Configure locales</title>
533 <body>
534
535 <p>
536 You will probably only use one or maybe two locales on your system. You have to
537 specify locales you will need in <path>/etc/locale.gen</path>.
538 </p>
539
540 <pre caption="Opening /etc/locale.gen">
541 # <i>nano -w /etc/locale.gen</i>
542 </pre>
543
544 <p>
545 The following locales are an example to get both English (United States) and
546 German (Germany) with the accompanying character formats (like UTF-8).
547 </p>
548
549 <pre caption="Specify your locales">
550 en_US ISO-8859-1
551 en_US.UTF-8 UTF-8
552 de_DE ISO-8859-1
553 de_DE@euro ISO-8859-15
554 </pre>
555
556 <note>
557 You can select your desired locales in the list given by running <c>locale -a</c>.
558 </note>
559
560 <warn>
561 We strongly suggest that you should use at least one UTF-8 locale because some
562 applications may require it.
563 </warn>
564
565 <p>
566 The next step is to run <c>locale-gen</c>. It will generates all the locales you
567 have specified in the <path>/etc/locale.gen</path> file.
568 </p>
569
570 <pre caption="Running locale-gen">
571 # <i>locale-gen</i>
572 </pre>
573
574 <p>
575 Once done, you now have the possibility to set the system-wide locale settings
576 in the <path>/etc/env.d/02locale</path> file:
577 </p>
578
579 <pre caption="Setting the default system locale in /etc/env.d/02locale">
580 LANG="de_DE.UTF-8"
581 LC_COLLATE="C"
582 </pre>
583
584 <p>
585 And reload your environment:
586 </p>
587
588 <pre caption="Reload shell environment">
589 # env-update &amp;&amp; source /etc/profile
590 </pre>
591
592 <p>
593 We made a full <uri link="https://wiki.gentoo.org/wiki/Localization/HOWTO">Localization
594 Guide</uri> to help you through this process. You can also read the detailed
595 <uri link="https://wiki.gentoo.org/wiki/UTF-8">UTF-8 article</uri> for very specific
596 informations to enable UTF-8 on your system.
597 </p>
598
599 <p test="not(func:keyval('arch')='PPC64')">
600 Please continue with <uri link="?part=1&amp;chap=9">Installing Necessary System
601 Tools</uri>.
602 </p>
603
604 </body>
605 </subsection>
606 <subsection test="func:keyval('arch')='PPC64'">
607 <title>Configuring the Console</title>
608 <body>
609
610 <p>
611 If you are using a virtual console, you must uncomment the appropriate line in
612 <path>/etc/inittab</path> for the virtual console to spawn a login prompt.
613 </p>
614
615 <pre caption="Enabling hvc or hvsi support in /etc/inittab">
616 hvc0:12345:respawn:/sbin/agetty -L 9600 hvc0
617 hvsi:12345:respawn:/sbin/agetty -L 19200 hvsi0
618 </pre>
619
620 <p>
621 You should also take this time to verify that the appropriate console is
622 listed in <path>/etc/securetty</path>.
623 </p>
624
625 <p>
626 You may now continue with <uri link="?part=1&amp;chap=9">Installing Necessary
627 System Tools</uri>.
628 </p>
629
630 </body>
631 </subsection>
632 </section>
633 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20