Solaris Naming Setup and Configuration Guide

How to Set Up the Master Server With ypinit

The /usr/sbin/ypinit shell script sets up master and slave servers and clients to use NIS. It also initially runs make to create the maps on the master server.

To use ypinit to build a fresh set of NIS maps on the master server, follow these steps:

  1. Become root on the master server and ensure that the name service gets its information from the /etc files, not from NIS, by typing:


    # cp /etc/nsswitch.files /etc/nsswitch.conf
  2. Edit the /etc/hosts or /etc/inet/ipnodes file to add the name and IP address of each of the NIS servers.

  3. To build new maps on the master server, type:


    # /usr/sbin/ypinit -m
  4. ypinit prompts for a list of other machines to become NIS slave servers. Type the name of the server you are working on, along with the names of your NIS slave servers.

  5. ypinit asks whether you want the procedure to terminate at the first nonfatal error or continue despite nonfatal errors. Type y.

    When you choose y, ypinit exits upon encountering the first problem; you can then fix it and restart ypinit. This is recommended if you are running ypinit for the first time. If you prefer to continue, you can try to manually fix all problems that occur, and then restart ypinit.


    Note -

    A nonfatal error can appear when some of the map files are not present. This is not an error that affects the functionality of NIS. You might need to add maps manually if they were not created automatically. Refer to Table 10-3 for a description of all default NIS maps.


  6. ypinit asks whether the existing files in the /var/yp/domainname directory can be destroyed.

    This message is displayed only if NIS has been previously installed. You must answer yes to install the new version of NIS.

  7. After ypinit has constructed the list of servers, it invokes make.


    # make

    This program uses the instructions contained in the Makefile (either the default one or the one you modified) located in /var/yp. The make command cleans any remaining comment lines from the files you designated and runs makedbm on them, creating the appropriate maps and establishing the name of the master server for each map.

    If the map or maps being pushed by the Makefile correspond to a domain other than the one returned by the command domainname on the master, you can make sure that they are pushed to the correct domain by starting make in the ypinit shell script with a proper identification of the variable DOM, as follows:


    # make DOM=domainname password
    

    This pushes the password map to the intended domain, instead of the domain to which the master belongs.

  8. To enable NIS as the naming service, type:


    # cp /etc/nsswitch.nis /etc/nsswitch.conf

    This replaces the current switch file with the default NIS-oriented switch file. You can edit this file as necessary.

Master Supporting Multiple NIS Domains

Normally, a NIS master server supports only one NIS domain. However, if you are using a master server to support multiple domains, you must modify the steps slightly, as described in the section above, when setting up the server to serve the additional domains.

Run the domainname command on the server. The domain name returned by the command is the server's default domain. The steps described in the section above will work properly for setting up service for that domain. To configure service for any other domain, you must modify the ypinit shell script as follows:


# make DOM=correct-domain passwd

Where correct-domain is the name of the other domain that you are setting up service for, and passwd is the make target. This command pushes the password map to the intended domain, instead of the domain to which the master belongs.