1/ Add server to /etc/hosts. This means that you can still find the server if there is a DNS failure.
2/ Install the software you need
sudo apt-get install portmap nis
You will be asked for the name of your NIS domain. Enter the name of your NIS domain. If you entered wrongly or want to change the defaultdomain of NIS change it in the file /etc/defaultdomain
robotics
For example, robotics is the name of my NIS server. Remember this parameter is case sensitive. It is probably a good idea to then add a portmap line to /etc/hosts.allow for security reasons:
portmap : <NIS server IP address>
Where "NIS server IP address" is the IP address of the NIS server.
3/ Set up name services to use NIS:
Edit /etc/passwd to add a line at the end saying:
+::::::
Edit /etc/group to add a line at the end saying:
+:::
Edit /etc/shadow to add a line at the end saying:
+::::::::
This sets up those services to include NIS entries if a match isn't found in the file. You could change other services to use NIS by using the NIS service in /etc/nsswitch.conf, but these are the important ones.
4/ Edit /etc/yp.conf and add the line:
ypserver 123.45.67.89
ypserver 987.65.43.21
Where 123.45.67.89 and 987.65.43.21 are the NIS servers.
5/ Restart NIS:
/etc/init.d/nis restart
+-------------------------------------------------------------------------------------+
Source : NIS Config