Linux NIS – How to Replace an NIS Master Server

linuxnis

I need to take down my current NIS master server because it is running on RHEL 4 which is too old for the auditors to approve now.

I think I need to copy some files off the master over to a slave server and run make?

I know there are files listed in the makefile but which ones are necessary for this and which ones should be left alone?

The slave server is running Ubuntu 12.04.

Best Answer

  1. Let's assume that the domain configuration is under /var/yp/<domainname>;
  2. Let's assume the NIS server configuration is under /var/yp;
  3. Let's assume you have some NIS related configuration files under /etc/ as well. Those could be /etc/yp.conf, /etc/ypserv.conf, /etc/ypserv.securenets and possible others (their filenames usually begin with yp....

What you need to do in order to move your NIS to the new server:

  1. Copy all of these files from the old server to the new one. Make sure they are not existent there beforehand or if they are - take backups before overwriting them!

  2. Decide if the new server will have the same hostname and IP address as the original master.
    If the name is the same you would skip the clients reconfiguration, otherwise it will be necessary to point to the right server (host or IP). I would rather reconfigure the clients

  3. Copy the passwords, groups, shadow files from the old server to the new one

  4. Once you have all files on the new server, run make -C /var/yp
    You may need to stop the NIS service on the old server, as the domains are to be the same and can't have two master servers. If no errors - continue with following steps. Otherwise - well ... troubleshoot.

  5. Run ypwhich on the new server and verify it returns its own hostname

  6. Run ypcat passwd | grep <username>, ypcat group | grep <groupname>
    Verify this works as expected;

  7. Stop the NIS service on the old server, if not done earlier

  8. Reconfigure all NIS clients
    Change their /etc/yp.conf to point to the respective server:
    echo -e "ypserver new_NIS_server" >> /etc/yp.conf.
    (alternatively this is where you would give the new machine the old one's IP/Hostname).

Good luck!