NIS server and client tutorial with AutoFS (CentOS / Arch Linux)

I use both Arch and CentOS in my environment so I made this  easy tutorial that will show you how to setup a NIS client/server on Arch Linux and CentOS.

*NIS Clients will not need ypserv*

Arch Linux:
# pacman -S ypbind-mt yp-tools ypserv autofs
CentOS: 
# yum -y install ypbind rpcbind ypserv autofs
/etc/yp.conf :
domain rusher 
server rusher
 
/etc/nsswitch.conf:  (For each box)
passwd:     files nis
shadow:     files nis
group:      files nis
hosts:      files nis dns
automount:  files nis
 
/etc/autofs.master:
/mnt -hosts /etc/auto.misc
+auto.master
 
/etc/autofs.misc:
* -rw,nosuid,intr,hard,sec=sys  :192.168.1.71:/home/&
/etc/conf.d/nisdomainname : (Arch Linux Client Only)
NISDOMAINNAME=”rusher”
/etc/sysconfig/network:     (CentOS Clienet Only)
NISDOMAIN=rusher
/etc/ypserv.conf :
Uncomment:
# *                        : *       : *                : none
 
Start the service on the NIS server:
# systemctl start ypserv (Arch )
# service start ypserv     (CentOS)
 
/var/yp/MakeFile: Change the following strings to:
 
DOMAIN = `uname -n`
LOCALDOMAIN = `uname -n`
#PUBLICKEYS  = $(YPSRCDIR)/publickey  # <- Comment out.
AUTO_MASTER = $(YPSRCDIR)/auto.master
AUTO_HOME   = $(YPSRCDIR)/auto.misc
ALIASES     = $(YPPWDDIR)/postfix/aliases
HOSTS       = $(YPSRCDIR)/hosts2  # <- This is a sep. hosts files that contains the NIS master and NFS server entries
ALIASES     = $(YPPWDDIR)/postfix/aliases # <-This will depend on your distro
AUTO_MASTER = $(YPSRCDIR)/auto.master # <- Adjust to your distro
AUTO_HOME   = $(YPSRCDIR)/auto.misc   # <- Adjust to your distro
 
 
all:  passwd group hosts rpc services netid protocols netgrp mail shadow  auto.home auto.master
Save and exit the text editor.
# make
 
 
Create /etc/hosts2:
echo 192.168.1.70 rusher > /etc/hosts2
echo 192.168.1.71 storage >> /etc/hosts2
Link the autofs share to /home
# rm -rf /home
# ln -s /mnt/rusher/home /home
# chmod 755 /mnt
# chmod 755 /mnt/rusher
# chmod 755 /mnt/rusher/home
 
Arch Linux:
# systemctl enable rpcbind.service
# systemctl enable ypserv.service
# systemctl enable autofs.service
 
CentOS:
#chkconfig rpcbind on
#chkconfig ypcserv on
#chkconfig autofs on
#reboot
#yptest
#ypwhich
#ypcat -k password