Monday, June 22, 2009

[RedHat Enterprise Linux] How to install NIS server integrated with NFS Server

Before installing NIS server in order NIS client to be able to authenticate to NIS server, we need to install NFS server first. Below is the tutorial how to install NFS and NIS.

Installing and configuring NFS
Make sure the NFS service is enabled by doing these commands:

# service nfs status

If the NFS service is not enabled , then we should enable it by commanding:

# service nfs start
# chkconfig nfs on

Then do these command below:

# rpcinfo -p localhost
# showmount -e localhost

Edit file in /etc/sysconfig/nfs
MOUNTD_PORT="4002"
STATD_PORT="4003"
LOCKD_TCPPORT="4004"
LOCKD_UDPPORT="4004"
RQUOTAD_PORT="4005"

Then make sure the ports are opened in the firewall
4002-4005 tcp
4002-4005 udp

Edit file in /etc/exports
/directory_you_want_to_share_with *.domain-name.com(rw,sync)
!wq

Then do the following commands:
# exportfs -a
# exportfs -ra


Installing and configuring NIS Server
1. Ensure the following rpms are already installed , they are:
ypserv, portmap, and make

Configure
ypserv, vppasswdd, ypxfrd in order to be on specific ports.
edit /etc/sysconfig/network
YPSERV_ARGS="-p 835"
YPXFRD_ARGA="-p 836"


2. edit file in /etc/sysconfig/yppasswdd
YPPASSWDD_ARGS="--port 837"

3. edit /etc/sysconfig/network
NISDOMAIN=yourdomain

4. Restrict access to ypserv to your network
Edit file in /var/yp/securenets
255.255.255.255 127.0.0.1
255.255.255.0 192.168.0.0

5. Start all services and ensure it to start on boot
Edit file in /var/yp/makefile
Look for the all: target and edit it to read
all: passwd group hosts netid

6. Generate NIS map (database) by running ypinit using this following command:
/usr/lib/yp/ypinit -m
Then press CTRL+D
Then press Y

7. Start the yppasswdd service by doing the following command:
# service yppasswdd start
# chkconfig yppasswdd on

8. Verify the services have been started by doing the following command:
# ps aux|grep yp

9. # cd /var/yp
# make

10. Verify the services have been registered with portmap by doing the following command:
# rpcinfo -p localhost
11. For tracing the error, check the log in /var/log/messages





1 comments:

Luthor02 said...

Anyone who has a question about this NIS/NFS article. Don't hesitate to ask via this comment.Thanks