NIS Server & Client Installation and Configuration in Linux

Опубликовано: 24 Октябрь 2024
на канале: ARN Tech Trainings
448
13

NIS Server & Client Installation and Configuration in Linux:
NIS Server Configuration:
vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.223.128 NisClient NisClient.rhce.com
192.168.223.129 NisServer NisServer.rhce.com

vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.223.128 NisClient NisClient.rhce.com
192.168.223.129 NisServer NisServer.rhce.com

Note:- 1. "xinetd" service should up and running
2. Turnoff iptables

#service xinetd staart
#service iptables stop

1. Please check below packages are not installed ot not.

rpm -q ypserv
rpm -q ypbind
rpm -q nfs
rpm -q make
rpm -q xinetd
rpm -q cache

2. Install all required packages

#yum install ypserv ypbind nfs make xinetd cache -y

3. Please check the following services should up and running.

#service ypserv start
#service ypbind start
#service nfs start
#service xinetd start
#service yppasswdd start

4. Run the "setup" and check below components

#setup
1. Click Authentication Configuration
1.1 Select NIS use (use spacebar to ckeck/select components)
1.2 Select Password/shadow
1.3 Select fingetprints
1.4 Select authintication

Click Quit to back to main screen

Select system services and click on it
Go to extream down and select below components
xinetd
ypbind
yppasswdd
ypserv
ypxfrd

5. Now update hostname and NIS domain names

#vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=NisServer
NISDOMAIN=rhce.com

6. Now create a user with the name "user1" and set /rhome as the default home dir with full permissions

#mkdir /rhome
#useradd -d /rhome/user1 user1
#passwd user1
#chmod 777 /rhome/user1
#ls -ld /rhome/user1

7. Now open the /etc/exports nfs file and set the following details

#vi /etc/exportfs
/rhome/user1 *(rw,sync)

8. Now open the /var/yp/makefile and the line 117 and remove the other entry from the lines expect passwd,group,hosts,netid

#vi /var/yp/Makefile

click ESC and type set su nu and click enter and go to 117 line and edit like below

9. Restart following services

#service portmap restart (or) #service rpcbind restart
#service xinetd restart
#service ypserv restart
#service nfs restart
#service yppasswdd restart

Big Note:- The NIS database hasn't been updated yet, so don't restart "ypcbind" now.

10. Now the change the path to /var/yp and execute the "make" command to create the database.

#cd /var/yp
#make

11. Now update the database by running the follwing details

#/usr/lib64/yp/ypinit -m

next host to add: NisServer
next host to add: NisClient
next host to add:

Press Ctrl+D

12. Once you have updated restart all services once againto take effect and also make all the services to be online upon next reboot with the help of chkconfig command.

#service xinetd restart
#service ypserv restart
#service nfs restart

#chkconfig xinetd on
#chkconfig nfs on
#chkconfig ypserv on
#chkconfig ypbind on
#chkconfig yppasswdd on

Thats all we have done with NIS server configuration.

Next we need to setup the NIS client

NIS Client Side Configuration:
On client side configuration the following RPM's are required.

*yp-tools
*ypbind

1. Install the below packages

#yum install yp-tools ypbind -y

2. Now edit /etc/sysconfig/network file as follows

#vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=NisClient.rhce.com
NISDOMAIN=rhce

3. Now run the "setup" command and choose "authentication configuration"

#setup

USE NIS
USE Shadow Passwords

Domain : rhce
Server : 192.168.223.129

The NIS Binding service should be running.

Restart the "ypbind" service if you get any errors when binding NIS server.

4. Now edit the "/etc/auto.master" file

#vi /etc/auto.master

add below

/rhome /etc/auto.misc

5. /etc/auto.misc= the name of the map which contains the list of mount point the file system location with those mount points should be mounted.

/rhome = the autofs mount point that is rhome here
The syntax insode au.misc file look as follows

mount-point map-name option

Now open and edit the /etc/auto.misc

#vi /etc/auto.misc

add below
user1 -rw,soft,intr 192.168.223.129:/rhome/user1

The mount point here refers to the auto mount point.
Location refers to the file system location such as file system path.

Make sure autofs and ypbind are both running by restarting these services and using chlconfig to ensure they are "ON"

#service autofs restart
#service ypbind restart

#chkconfig ypbind on
#chkconfig autofs on

Now Login to NIS server via ssh/telnet and check the Logged in path

if the path is showing /rhome/user1 means user database loaded from NIS server

#ssh [email protected]
#pwd

NIS Server,NIS Client,Linux Configuration,NIS Setup,Linux Secrets,NIS Demystified,Package Installation,Service Configuration,Server Secrets,Technology Tips