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