### C.2 Installing the C Library ¶

To install the library and its header files, and the Info files of the manual, type `make install`. This will build things, if necessary, before installing them; however, you should still compile everything first. If you are installing the GNU C Library as your primary C library, we recommend that you shut the system down to single-user mode first, and reboot afterward. This minimizes the risk of breaking things when the library changes out from underneath.

‘`make install`’ will do the entire job of upgrading from a previous installation of the GNU C Library version 2.x. There may sometimes be headers left behind from the previous installation, but those are generally harmless. If you want to avoid leaving headers behind you can do things in the following order.

You must first build the library (‘`make`’), optionally check it (‘`make check`’), switch the include directories and then install (‘`make install`’). The steps must be done in this order. Not moving the directory before install will result in an unusable mixture of header files from both libraries, but configuring, building, and checking the library requires the ability to compile and run programs against the old library. The new `/usr/include`, after switching the include directories and before installing the library should contain the Linux headers, but nothing else. If you do this, you will need to restore any headers from libraries other than the GNU C Library yourself after installing the library.

You can install the GNU C Library somewhere other than where you configured it to go by setting the `DESTDIR` GNU standard make variable on the command line for ‘`make install`’. The value of this variable is prepended to all the paths for installation. This is useful when setting up a chroot environment or preparing a binary distribution. The directory should be specified with an absolute file name. Installing with the `prefix` and `exec_prefix` GNU standard make variables set is not supported.

The GNU C Library includes a daemon called `nscd`, which you may or may not want to run. `nscd` caches name service lookups; it can dramatically improve performance with NIS+, and may help with DNS as well.

One auxiliary program, `/usr/libexec/pt_chown`, is installed setuid `root` if the ‘`--enable-pt_chown`’ configuration option is used. This program is invoked by the `grantpt` function; it sets the permissions on a pseudoterminal so it can be used by the calling process. If you are using a Linux kernel with the `devpts` filesystem enabled and mounted at `/dev/pts`, you don’t need this program.

After installation you should configure the time zone ruleset and install locales for your system. The time zone ruleset ensures that timestamps are processed correctly for your location. The locales ensure that the display of information on your system matches the expectations of your language and geographic region.

The GNU C Library is able to use two kinds of localization information sources, the first is a locale database named `locale-archive` which is generally installed as `/usr/lib/locale/locale-archive`. The locale archive has the benefit of taking up less space and being very fast to load, but only if you plan to install sixty or more locales. If you plan to install one or two locales you can instead install individual locales into their self-named directories e.g. `/usr/lib/locale/en_US.utf8`. For example to install the German locale using the character set for UTF-8 with name `de_DE` into the locale archive issue the command ‘`localedef -i de_DE -f UTF-8 de_DE`’, and to install just the one locale issue the command ‘`localedef --no-archive -i de_DE -f UTF-8 de_DE`’. To configure all locales that are supported by the GNU C Library, you can issue from your build directory the command ‘`make localedata/install-locales`’ to install all locales into the locale archive or ‘`make localedata/install-locale-files`’ to install all locales as files in the default configured locale installation directory (derived from ‘`--prefix`’ or `--localedir`). To install into an alternative system root use ‘`DESTDIR`’ e.g. ‘`make localedata/install-locale-files DESTDIR=/opt/glibc`’, but note that this does not change the configured prefix.

To configure the time zone ruleset, set the `TZ` environment variable. The script `tzselect` helps you to select the right value. As an example, for Germany, `tzselect` would tell you to use ‘`TZ='Europe/Berlin'`’. For a system wide installation (the given paths are for an installation with ‘`--prefix=/usr`’), link the time zone file which is in `/usr/share/zoneinfo` to the file `/etc/localtime`. For Germany, you might execute ‘`ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime`’.