Red Hat Linux 7 Unleashed

Red Hat Linux 7 Unleashed

By William Ball

Configuring a NIS Secondary Server

After you've decided to configure a machine as a NIS secondary server, you start by configuring it as a NIS client machine. Verify that you can access the server maps via the ypcat command.

Now you are ready to tell the master server that a slave server exists. To do this, edit the /var/yp/ypservers file so that the slave server you are setting up is included in the list. Now make sure you are in /var/yp and then run a make. If you configured your master server with the name of the slave server during the ypinit -m phase, you do not need to do this.

On the slave server make sure that the ypserv daemon is installed. If it is not, you will need to install this from the RPM.


   [root@client /root]# cd /mnt/cdrom/Redhat/RPMS

   [root@client RPMS]# rpm –I ypserv*

You will have to make the ypserv daemon start at boot time. The commands to do this are


   [root@client /root]# cd /etc/rc3.d

   [root@client rc3.d]# ln –s ../init.d/ypserv S60ypserv

You can now initialize the slave server by running the command


   /usr/lib/yp/ypinit -s master
   

master is the hostname for the NIS master server. In this example, it's vestax. The output should look something like the following:

We will need some minutes to copy the databases from vestax.
Transferring mail.aliases...
Trying ypxfrd ... not running
Transferring services.byname...
Trying ypxfrd ... not running
Transferring rpc.bynumber...
Trying ypxfrd ... not running
[etc...]

denon.domain.com's NIS database has been set up.
If there were warnings, please figure out what went wrong, and fix it.

At this point, make sure that /etc/passwd and /etc/group have
been edited so that when the NIS is activated, the databases you
have just created will be used, instead of the /etc ASCII files.

Don't worry about the Trying ypxfrd...not running message. This happens because you haven't set the NIS master server to run the YP map transfer daemon rpc.ypxfrd. In fact, you never set it up to do so; instead, use a server push method where the NIS master server pushes the maps to all the NIS slaves whenever there is an update.

To set the NIS master to do the actual push, you need to change its makefile a little. On the master server, edit the makefile so that the line NOPUSH="True" is changed to read NOPUSH="false" and the line that reads DOMAIN = 'basename \'pwd\'' is changed to DOMAIN = '/bin/domainname'.

Now for the big test: On the NIS master server, run cd /var/yp;make all to force all the maps to be rebuilt and pushed. The output should look something like the following:

Updating passwd.byname....
Pushed passwd.byname map.
Updating passwd.byuid...
Pushed passwd.byuid map.
Updating hosts.byname...
Pushed hosts.byname.
Updating hosts.byaddr...
Pushed hosts.byaddr.
[etc...]

If you get an error like the following:

Could not read ypservers map: 3 Can't bind to server which serves this domain

you will have to set up the master server as a client also. Change the /etc/yp.conf file to point to the server, in this case vestax.audionet.domain.com. Add an entry to the /etc/sysconfig/network file such as NISDOMAIN=nisdomain where nisdomain is your domain, in this example audionet.domain.com. Don't forget to start the ypbind daemon also.

On the NIS slave server, change the /etc/yp.conf file so that the ypserver is set to point to the slave server. Run the command ypcat passwd and see whether your NIS password file is displayed. If so, you're set. The NIS slave server is configured.

If you're having problems, trace through your steps. Also be sure to reboot the machine and see if your NIS slave server still works correctly. If it doesn't come back up, be sure that the changes you made to the boot sequence when installing ypserv were correct.

Share ThisShare This

Informit Network