/[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.14 - (hide annotations) (download) (as text)
Sat Dec 20 20:32:02 2003 UTC (10 years, 7 months ago) by swift
Branch: MAIN
Changes since 1.13: +5 -4 lines
File MIME type: application/xml
Fix #35770, fixup on /etc/hosts

1 swift 1.4 <!-- The content of this document is licensed under the CC-BY-SA license -->
2     <!-- See http://creativecommons.org/licenses/by-sa/1.0 -->
3    
4 swift 1.14 <!-- $Header: /home/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-config.xml,v 1.13 2003/12/07 12:15:17 swift Exp $ -->
5 swift 1.8
6 swift 1.2 <sections>
7 swift 1.1 <section>
8     <title>Timezone</title>
9     <body>
10    
11     <p>
12 swift 1.3 You now need to select your timezone so that your system knows where it is
13     located. Look for your timezone in <path>/usr/share/zoneinfo</path>, then make a
14     symlink to <path>/etc/localtime</path> using <c>ln</c>:
15 swift 1.1 </p>
16    
17 swift 1.3 <pre caption="Setting the timezone information">
18     # <i>ls /usr/share/zoneinfo</i>
19 swift 1.11 <comment>(Suppose you want to use GMT:)</comment>
20 swift 1.6 # <i>ln -sf /usr/share/zoneinfo/GMT /etc/localtime</i>
21 swift 1.3 </pre>
22    
23 swift 1.1 </body>
24 swift 1.2 </section>
25     <section>
26 swift 1.1 <title>Filesystem Information</title>
27 swift 1.3 <subsection>
28     <title>What is fstab?</title>
29 swift 1.1 <body>
30    
31     <p>
32 swift 1.3 Under Linux, all partitions used by the system must be listed in
33     <path>/etc/fstab</path>. This file contains the mountpoints of those partitions
34     (where they are seen in the file system structure), how they should be mounted
35     (special options) and when (automatically or not, can users mount those or not,
36     etc.).
37 swift 1.1 </p>
38    
39     </body>
40 swift 1.3 </subsection>
41     <subsection>
42     <title>Creating /etc/fstab</title>
43     <body>
44    
45     <p>
46     <path>/etc/fstab</path> uses a special syntaxis. Every line consists of six
47 swift 1.9 fields, separated by whitespace (space(s), tabs or a mixture). Each field has
48 swift 1.3 its own meaning:
49     </p>
50    
51     <ul>
52     <li>
53     The first field shows the <b>partition</b> described (the path to the device
54     file)
55     </li>
56     <li>
57     The second field shows the <b>mountpoint</b> at which the partition should be
58     mounted
59     </li>
60     <li>
61     The third field shows the <b>filesystem</b> used by the partition
62     </li>
63     <li>
64     The fourth field shows the <b>mountoptions</b> used by <c>mount</c> when it
65     wants to mount the partition. As every filesystem has its own mountoptions,
66     you are encouraged to read the mount manpage (<c>man mount</c>) for a full
67 swift 1.9 listing. Multiple mountoptions are comma-separated.
68 swift 1.3 </li>
69     <li>
70     The fifth field is used by <c>dump</c> to determine if the partition needs to
71     be <b>dump</b>ed or not. You can generally leave this as <c>0</c> (zero).
72     </li>
73     <li>
74     The sixth field is used by <c>fsck</c> the order in which filesystems should
75     be <b>check</b>ed if the system wasn't shut down properly. The root filesystem
76     should have <c>1</c> while the rest should have <c>2</c> (or <c>0</c> in case
77     a filesystem check isn't necessary).
78     </li>
79     </ul>
80    
81     <p>
82     So start <c>nano</c> (or your favorite editor) to create your
83     <path>/etc/fstab</path>:
84     </p>
85    
86     <pre caption="Opening /etc/fstab">
87     # <i>nano -w /etc/fstab</i>
88     </pre>
89    
90     <p>
91     Lets take a look at how we write down the options for the <path>/boot</path>
92     partition. This is just an example, so if your architecture doesn't require a
93     <path>/boot</path> partition, don't copy it verbatim.
94     </p>
95    
96     <p>
97     In our default x86 partitioning example <path>/boot</path> is the
98     <path>/dev/hda1</path> partition, with <c>ext2</c> as filesystem. It shouldn't
99     be mounted automatically (<c>noauto</c>) but does need to be checked. So we
100     would write down:
101     </p>
102    
103     <pre caption="An example /boot line for /etc/fstab">
104     /dev/hda1 /boot ext2 noauto 1 2
105     </pre>
106    
107     <p>
108     Now, to improve performance, most users would want to add the <c>noatime</c>
109     option as mountoption, which results in a faster system since access times
110     aren't registered (you don't need those generally anyway):
111     </p>
112    
113     <pre caption="An improved /boot line for /etc/fstab">
114     /dev/hda1 /boot ext2 noauto,noatime 1 2
115     </pre>
116    
117     <p>
118     If we continue with this, we would end up with the following three lines (for
119     <path>/boot</path>, <path>/</path> and the swap partition):
120     </p>
121    
122     <pre caption="Three /etc/fstab lines">
123     /dev/hda1 /boot ext2 noauto,noatime 1 2
124     /dev/hda2 none swap sw 0 0
125     /dev/hda3 / ext3 noatime 0 1
126     </pre>
127    
128     <p>
129     To finish up, you should add a rule for <path>/proc</path>, <c>tmpfs</c>
130 swift 1.7 (required) and for your CD-ROM drive (and of course, if you have other
131 swift 1.3 partitions or drives, for those too):
132     </p>
133    
134     <pre caption="A full /etc/fstab example">
135     /dev/hda1 /boot ext2 noauto,noatime 1 2
136     /dev/hda2 none swap sw 0 0
137     /dev/hda3 / ext3 noatime 0 1
138    
139     none /proc proc defaults 0 0
140     none /dev/shm tmpfs defaults 0 0
141    
142     /dev/cdroms/cdrom0 /mnt/cdrom auto noauto,user 0 0
143     </pre>
144    
145     <p>
146     <c>auto</c> makes <c>mount</c> guess for the filesystem (recommended for
147     removable media as they can be created with one of many filesystems) and
148     <c>user</c> makes it possible for non-root users to mount the CD.
149     </p>
150    
151     <p>
152     Now use the above example to create your <path>/etc/fstab</path>. If you are a
153     SPARC-user, you should add the following line to your <path>/etc/fstab</path>
154     too:
155     </p>
156    
157     <pre caption="Adding openprom filesystem to /etc/fstab">
158 swift 1.5 none /proc/openprom openpromfs defaults 0 0
159     </pre>
160    
161     <p>
162     If you need <c>usbfs</c>, add the following line to <path>/etc/fstab</path>:
163     </p>
164    
165     <pre caption="Adding usbfs filesystem to /etc/fstab">
166     none /proc/bus/usb usbfs defaults 0 0
167 swift 1.3 </pre>
168    
169     <p>
170     Reread your <path>/etc/fstab</path>, save and quit to continue.
171     </p>
172    
173     </body>
174     </subsection>
175 swift 1.2 </section>
176     <section>
177 swift 1.1 <title>Networking Information</title>
178 swift 1.3 <subsection>
179     <title>Hostname, Domainname etc.</title>
180     <body>
181    
182     <p>
183     One of the choices the user has to make is name his PC. This seems to be quite
184     easy, but <e>lots</e> of users are having difficulties finding the appropriate
185     name for their Linux-pc. To speed things up, know that any name you choose can
186     be changed afterwards. For all we care, you can just call your system
187     <c>tux</c> and domain <c>homenetwork</c>.
188     </p>
189    
190     <p>
191     We use these values in the next examples. First we set the hostname:
192     </p>
193    
194     <pre caption="Setting the hostname">
195     # <i>echo tux &gt; /etc/hostname</i>
196     </pre>
197    
198     <p>
199     Second we set the domainname:
200     </p>
201    
202     <pre caption="Setting the domainname">
203     # <i>echo homenetwork &gt; /etc/dnsdomainname</i>
204     </pre>
205    
206     <p>
207     If you have a NIS domain (if you don't know what that is, then you don't have
208     one), you need to define that one too:
209     </p>
210    
211     <pre caption="Setting the NIS domainname">
212     # <i>echo nis.homenetwork &gt; /etc/nisdomainname</i>
213 swift 1.12 </pre>
214    
215     <p>
216     Now add the <c>domainname</c> script to the default runlevel:
217     </p>
218    
219     <pre caption="Adding domainname to the default runlevel">
220     # <i>rc-update add domainname default</i>
221 swift 1.3 </pre>
222    
223     </body>
224     </subsection>
225     <subsection>
226     <title>Configuring your Network</title>
227     <body>
228    
229     <p>
230     Before you get that "Hey, we've had that already"-feeling, you should remember
231     that the networking you set up in the beginning of the gentoo installation was
232     just for the installation. Right now you are going to configure networking for
233     your Gentoo system permanently.
234     </p>
235    
236     <p>
237     All networking information is gathered in <path>/etc/conf.d/net</path>. It uses
238     a straightforward yet not intuitive syntax if you don't know how to setup
239     networking manually. But don't fear, we'll explain everything :)
240     </p>
241    
242     <p>
243     First open <path>/etc/conf.d/net</path> with your favorite editor (<c>nano</c>
244     is used in this example):
245     </p>
246    
247     <pre caption="Opening /etc/conf.d/net for editing">
248     # <i>nano -w /etc/conf.d/net</i>
249     </pre>
250    
251     <p>
252     The first variable you'll find is <c>iface_eth0</c>. It uses the following
253     syntax:
254     </p>
255    
256     <pre caption="iface_eth0 syntaxis">
257     iface_eth0="<i>&lt;your ip address&gt;</i> broadcast <i>&lt;your broadcast address&gt;</i> netmask <i>&lt;your netmask&gt;</i>"
258     </pre>
259    
260     <p>
261     If you use DHCP (automatic IP retrieval), you should just set <c>iface_eth0</c>
262     to <c>dhcp</c>. However, if you need to setup your network manually and you're
263     not familiar with all the above terms, please read the section on <uri
264     link="?part=1&amp;chap=3#doc_chap4_sect3">Understanding Network
265     Terminology</uri> if you haven't done so already.
266     </p>
267    
268     <p>
269     So lets give two examples; the first one uses DHCP, the second one a static IP
270     (192.168.0.2) with netmask 255.255.255.0, broadcast 192.168.0.255 and gateway
271     192.168.0.1:
272     </p>
273    
274     <pre caption="Examples for /etc/conf.d/net">
275     <comment>(For DHCP:)</comment>
276     iface_eth0="dhcp"
277    
278     <comment>(For static IP:)</comment>
279     iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"
280     gateway="eth0/192.168.0.1"
281     </pre>
282    
283     <p>
284     If you have several network interfaces, create extra <c>iface_eth</c> variables,
285     like <c>iface_eth1</c>, <c>iface_eth2</c> etc. The <c>gateway</c> variable
286     shouldn't be reproduced as you can only set one gateway per computer.
287     </p>
288    
289     <p>
290     Now save the configuration and exit to continue.
291     </p>
292    
293     </body>
294     </subsection>
295     <subsection>
296     <title>Automatically Start Networking at Boot</title>
297 swift 1.1 <body>
298    
299     <p>
300 swift 1.3 To have your network interfaces activated at boot, you need to add those to the
301     default runlevel. If you have PCMCIA interfaces you should skip this action as
302     the PCMCIA interfaces are started by the PCMCIA init script.
303     </p>
304    
305     <pre caption="Adding net.eth0 to the default runlevel">
306     # <i>rc-update add net.eth0 default</i>
307     </pre>
308    
309     <p>
310     If you have several network interfaces, you need to create the appropriate
311     <path>net.eth1</path>, <path>net.eth2</path> etc. initscripts for those. You can
312     use <c>ln</c> to do this:
313 swift 1.1 </p>
314    
315 swift 1.3 <pre caption="Creating extra initscripts">
316     # <i>cd /etc/init.d</i>
317     # <i>ln -s net.eth0 net.eth1</i>
318     # <i>rc-update add net.eth1 default</i>
319     </pre>
320    
321 swift 1.1 </body>
322 swift 1.3 </subsection>
323     <subsection>
324     <title>Writing Down Network Information</title>
325     <body>
326    
327     <p>
328     You now need to inform Linux about your network. This is defined in
329     <path>/etc/hosts</path> and helps in resolving hostnames to IP addresses
330     for hosts that aren't resolved by your nameserver. For instance, if your
331     internal network consists of three PCs called <c>jenny</c> (192.168.0.5),
332 swift 1.14 <c>benny</c> (192.168.0.6) and <c>tux</c> (192.168.0.7 - this system) you would
333 swift 1.3 open <path>/etc/hosts</path> and fill in the values:
334     </p>
335    
336     <pre caption="Opening /etc/hosts">
337     # <i>nano -w /etc/hosts</i>
338     </pre>
339    
340     <pre caption="Filling in the networking information">
341 swift 1.14 127.0.0.1 localhost
342 swift 1.3 192.168.0.5 jenny
343 swift 1.14 192.168.0.6 benny
344     192.168.0.7 tux
345 swift 1.3 </pre>
346    
347     <p>
348     If your system is the only system (or the nameservers handle all name
349     resolution) a single line is sufficient:
350     </p>
351    
352     <pre caption="/etc/hosts for lonely or fully integrated PCs">
353     127.0.0.1 localhost tux
354     </pre>
355    
356     <p>
357     Save and exit the editor to continue.
358     </p>
359    
360     <p>
361     If you don't have PCMCIA, you can now continue with <uri
362     link="#doc_chap4">System Information</uri>. PCMCIA-users should read the
363     following topic on PCMCIA.
364     </p>
365    
366     </body>
367     </subsection>
368     <subsection>
369     <title>Optional: Get PCMCIA Working</title>
370     <body>
371    
372     <p>
373     PCMCIA-users should first install the <c>pcmcia-cs</c> package:
374     </p>
375    
376     <pre caption="Installing pcmcia-cs">
377 swift 1.10 # <i>emerge --usepkg pcmcia-cs</i>
378 swift 1.3 </pre>
379    
380     <p>
381     When <c>pcmcia-cs</c> is installed, add <c>pcmcia</c> to the <e>boot</e>
382     runlevel:
383     </p>
384    
385 swift 1.13 <pre caption="Adding pcmcia to the boot runlevel">
386 swift 1.3 # <i>rc-update add pcmcia boot</i>
387     </pre>
388    
389     </body>
390     </subsection>
391 swift 1.2 </section>
392     <section>
393 swift 1.1 <title>System Information</title>
394     <body>
395    
396     <p>
397 swift 1.3 Gentoo uses <path>/etc/rc.conf</path> for general, system-wide configuration.
398     Open up <path>/etc/rc.conf</path> and enjoy all the comments in that file :)
399     </p>
400    
401     <pre caption="Opening /etc/rc.conf">
402     # <i>nano -w /etc/rc.conf</i>
403     </pre>
404    
405     <p>
406     As you can see, this file is well commented to help you set up the necessary
407     configuration variables. When you're finished configuring
408     <path>/etc/rc.conf</path>, save and exit to continue.
409 swift 1.1 </p>
410    
411     </body>
412     </section>
413 swift 1.2 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20