### C.2 Installing the C Library

To install the library and its header files, and the Info files of the manual, type `env LANGUAGE=C LC_ALL=C make install`. This will build things, if necessary, before installing them; however, you should still compile everything first. If you are installing glibc 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.

If you're upgrading from Linux libc5 or some other C library, you need to replace the `/usr/include` with a fresh directory before installing it. The new `/usr/include` should contain the Linux headers, but nothing else.

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.

If you are upgrading from a previous installation of glibc 2.0 or 2.1, ‘`make install`’ will do the entire job. You do not need to remove the old includes – if you want to do so anyway you must then follow the order given above.

You may also need to reconfigure GCC to work with the new library. The easiest way to do that is to figure out the compiler switches to make it work again (‘`-Wl,--dynamic-linker=/lib/ld-linux.so.2`’ should work on GNU/Linux systems) and use them to recompile gcc. You can also edit the specs file (`/usr/lib/gcc-lib/TARGET/VERSION/specs`), but that is a bit of a black art.

You can install glibc somewhere other than where you configured it to go by setting the `install_root` 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.

Glibc 2.2 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`. This program is invoked by the `grantpt` function; it sets the permissions on a pseudoterminal so it can be used by the calling process. This means programs like `xterm` and `screen` do not have to be setuid to get a pty. (There may be other reasons why they need privileges.) If you are using a 2.1 or newer Linux kernel with the `devptsfs` or `devfs` filesystems providing pty slaves, you don't need this program; otherwise you do. The source for `pt_chown` is in `login/programs/pt_chown.c`.

After installation you might want to configure the timezone and locale installation of your system. The GNU C library comes with a locale database which gets configured with `localedef`. For example, to set up a German locale with name `de_DE`, simply issue the command ‘`localedef -i de_DE -f ISO-8859-1 de_DE`’. To configure all locales that are supported by glibc, you can issue from your build directory the command ‘`make localedata/install-locales`’.

To configure the locally used timezone, 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 timezone 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`’.