Sunday, April 13, 2008

Configure NIS Master

HOW TO CONFIGURE NIS MASTER

You must login as root.

1. Define the NIS domainname.
domainname example-domain

2. Populate the /etc/defaultdomain file with the domainname.
domainname > /etc/defaultdomain

3. Edit the /etc/hosts file to ensure that the NIS master and all NIS slave
servers have been defined and that a fully qualified name exists for this server.

4. Optionally, create an alternate directory and copy the source files there.
mkdir /var/yp/src
cd /etc
cp auto_home auto_master bootparams ethers group hosts netgroup netmasks networks \
passwd protocols publickey rpc services shadow timezone user_attr /var/yp/src

5. Edit the Makefile.
cp /var/yp/Makefile /var/yp/Makefile.orig
vi /var/yp/Makefile

Modify DIR= and PWDIR= entries to reflect the location of the alternate directory
used in step 4.
Example:DIR=/var/yp/src
Example:PWDIR=/var/yp/src

If you wish NIS to resolve hosts through DNS comment out "B=" and uncomment "B=-b".
Locate the target labeled all: and remove any map from the definition that does not have a
corresponding file and will not be used as part of this service. For example, bootparams,
ethers, and timezone files do not exist by default, and may be removed. This will avert
errors during the make process (IE. make: Fatal error: Command failed for target 'k').

Note: If the netgroup map is to be used later, but does not yet exist, create a
placeholder for this in the target directory.
touch /var/yp/src/netgroup

Note: To relocate RBAC related files or /etc/inet/ipnodes consult the comments in
/var/yp/Makefile.

6. Ensure files are selected as the naming service, if not previously defined.
cp /etc/nsswitch.files /etc/nsswitch.conf

7. Initialize the server:

cd /var/yp
/usr/sbin/ypinit -m

It will ask you for the other yp server's name. Type the name of the server you
are working on, along with the name of your NIS slave servers, and then
press CTRL-D.

It will ask the question "Do you want this procedure to quit on non-fatal
errors [y/n:n]n. choose n.

8. Start the NIS daemons.

/usr/lib/netsvc/yp/ypstart

This will start all NIS server daemons (ypbind ypserv ypxfrd rpc.yppasswdd rpc.ypupdated).

9. Test the configuration.
cd /var/yp
/usr/ccs/bin/make (this should complete without errors)
ypcat -k hosts (to make sure the new maps are there)
ypwhich -m (display the maps that are being served)
NOTE: All the resulting NIS maps will be stored under /var/yp/example-domain directory.
10. To enable this host as a NIS client.
cp /etc/nsswitch.nis /etc/nsswitch.conf
Edit /etc/nsswitch.conf as necessary (ie. add dns entry).


Note: To control NIS services from the command line:

/usr/lib/netsvc/yp/ypstop (to stop NIS services)
/usr/lib/netsvc/yp/ypstart (to start NIS services)

For Solaris 10, you can use:

ypstop/ypstart (enable/disable/restart)

svcadm disable network/nis/server:default
svcadm disable network/nis/client:default

0 comments: