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