Blog

Posted 2011/04/26

How to configure a NIS server on Centos 5.6

The headnode of our test cluster runs NIS. This is how to set it up.

Make sure you have the tools
yum -y install ypserv

Set the NIS domain and make it persistent
ypdomainname dori.cs.vt.edu Edit /etc/sysconfig/network NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=dori.cs.vt.edu
GATEWAY=128.173.236.1
NISDOMAIN=dori.cs.vt.edu

Configure the NIS make script to use the correct maps
Edit /var/yp/Makefile
MERGE_PASSWD=false
MERGE_GROUP=false
all: passwd shadow group hosts rpc services netid protocols mail

Configure what machines can talk to the NIS server
Edit /var/yp/securenets
host 127.0.0.1
host 128.173.236.229
255.255.0.0 172.16.0.0

Start the services NIS uses and make them start at boot
/etc/rc.d/init.d/portmap start
/etc/rc.d/init.d/ypserv start
/etc/rc.d/init.d/yppasswdd start
chkconfig portmap on
chkconfig ypserv on
chkconfig yppasswdd on

Initialize the NIS database
When it asks about adding more NIS servers just use ctl-D
/usr/lib/yp/ypinit

Every time you add a new user you need to update the NIS database with this:
make -C /var/yp