Config NIS Server/Client on CentOS 5

297

I created two VMs via VirtualBox, named CentOS_Srv and CentOS_Cli with the IPs 192.168.172.131 and 192.168.172.131, networking type is bridged.

 1. ENV

OS: CentOS 5.3

Software: ypserv, yp-tools, ypbind, etc

NIS Server: 192.168.172.132 glynnsrv.com

NIS Client: 192.168.172.131 glynn.glynnsrv.com

2.  Steps

1) Config NFS in the NFS server (use the NIS Server here)

[root@glynnsrv]vi /etc/exports, add the following line:

/home  *(rw,sync)

this allow  all host to mount /home as writable.

2)Make effective

[root@glynnsrv] exportfs -a

3)Start NFS server

[root@glynnsrv]service nfs start

4)Let nfs start when boot

[root@glynnsrv]chkconfig nfs on

 5)Config the firewall

[root@glynnsrv]setup

select firewall settings and add NFS service.

6)Config the NFS client

[root@glynn]mv /home /home.bak

[root@glynn]mkdir /home

[root@glynn]vi /etc/hosts

127.0.0.1 localhost localhost

192.168.172.131 glynn.glynnsrv.com glynn

192.168.172.132 glynnsrv.com glynnsrv

[root@glynn]mount -t nfs glynnsrv:/home /home

Let autofs mount the nfs at boot time:

[root@glynn]vi /etc/auto.master # add the following line:

 /home      /etc/auto.home  –timeout 600

[root@glynn]vi /etc/auto.home # add the following line:

  *    -fstype=nfs,r2   192.168.172.132:/home

 [root@glynn]chkconfig autofs on

 7) Config NIS Server

a) install needed softwares:

[root@glynnsrv] yum -y install ypserv ypbind yp-tools

b)vi /etc/sysconfig/network

NISDOMAIN=glynnsrv