Tagging 1.99.1
[linux_from_scratch.git] / BOOK / chapter06 / config-glibc.xml
blob6d74eed27680798d752136f8db22cf112ca0540e
1 <sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
3 <sect2><title>Configuring Glibc</title>
5 <para>We need to create the <filename>/etc/nsswitch.conf</filename> file,
6 because, although Glibc provides defaults when this file is missing or corrupt,
7 the Glibc defaults don't work well with networking. Also, our time zone needs
8 to be set up.</para>
10 <para>Create a new file <filename>/etc/nsswitch.conf</filename> by running the
11 following:</para>
13 <screen><userinput>cat &gt; /etc/nsswitch.conf &lt;&lt; "EOF"</userinput>
14 # Begin /etc/nsswitch.conf
16 passwd: files
17 group: files
18 shadow: files
20 publickey: files
22 hosts: files dns
23 networks: files
25 protocols: db files
26 services: db files
27 ethers: db files
28 rpc: db files
30 netgroup: db files
32 # End /etc/nsswitch.conf
33 <userinput>EOF</userinput></screen>
35 <para>To find out what time zone you're in, run the following script:</para>
37 <screen><userinput>tzselect</userinput></screen>
39 <para>When you've answered a few questions about your location, the script will
40 output the name of your time zone, something like <emphasis>EST5EDT</emphasis>
41 or <emphasis>Canada/Eastern</emphasis>. Then create the
42 <filename>/etc/localtime</filename> file by running:</para>
44 <screen><userinput>cp --remove-destination /usr/share/zoneinfo/Canada/Eastern /etc/localtime</userinput></screen>
46 <para>The meaning of the option:</para>
48 <itemizedlist>
49 <listitem><para><userinput>--remove-destination</userinput>: This is needed to
50 force removal of the already existing symbolic link. The reason why we copy
51 instead of symlink is to cover the situation where <filename>/usr</filename> is
52 on a separate partition. This could matter, for example, when booted into single
53 user mode.</para></listitem>
54 </itemizedlist>
56 <para>Of course, instead of <emphasis>Canada/Eastern</emphasis>, fill in
57 the name of the time zone that the <command>tzselect</command> script
58 gave you.</para>
60 </sect2>
62 <sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
64 <sect2>
65 <title>Configuring Dynamic Loader</title>
67 <para>By default, the dynamic loader
68 (<filename>/lib/ld-linux.so.2</filename>) searches through <filename
69 class="directory">/lib</filename> and <filename
70 class="directory">/usr/lib</filename> for dynamic libraries that are needed
71 by programs when you run them. However, if there are libraries in
72 directories other than <filename class="directory">/lib</filename> and
73 <filename class="directory">/usr/lib</filename>, you need to add them to
74 the <filename>/etc/ld.so.conf</filename> file for the dynamic
75 loader to find them. Two directories that are commonly known to contain
76 additional libraries are <filename
77 class="directory">/usr/local/lib</filename> and <filename
78 class="directory">/opt/lib</filename>, so we add those directories to the
79 dynamic loader's search path.</para>
81 <para>Create a new file <filename>/etc/ld.so.conf</filename> by running the
82 following:</para>
84 <screen><userinput>cat &gt; /etc/ld.so.conf &lt;&lt; "EOF"</userinput>
85 # Begin /etc/ld.so.conf
87 /usr/local/lib
88 /opt/lib
90 # End /etc/ld.so.conf
91 <userinput>EOF</userinput></screen>
93 </sect2>