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