Introduction to NISNIS, the full name in English is network information service, also called yellow pages. In Linux, NIS is an RPC-based client/server system that requires the use of RPC services. RPC stands for Remote Procedure Call Protocol. RPCBIND is used to replace the portmap component in the old version. Simply put, RPCBIND is used to bind different services to corresponding ports in order to support interoperability between machines. Network environment:
1. Environment preparation (both nodes are required)Turn off firewall systemctl stop firewalld setenforce 0 Add hostname resolution vim /etc/hosts 192.168.10.222 node1 192.168.10.223 node2 2.nis master server configurationDownload the package yum -y install rpcbind ypserv ypbind yp-tools Add nis domain name [root@localhost ~]# nisdomainname skills.com vim /etc/sysconfig/network NISDOMAIN skills.com Automatically mount the nis domain name at boot time [root@localhost ~]# vim /etc/rc.d/rc.local touch /var/lock/subsys/local /bin/nisdomainname skills.com [root@localhost ~]# chmod 777 /etc/rc.d/rc.local Modify the main configuration file to restrict permissions vim /etc/ypserv.conf 192.168.10.0/24:*:*:none //Give access rights to this network segment 192.168.10.222:*:*:none //Give access rights to this local machine:*:*:deny //Reject other servers Restart the service systemctl restart yppasswdd rpcbind ypserv systemctl enable yppasswdd rpcbind ypserv Create a database [root@localhost ~]# /usr/lib64/yp/ypinit -m At this point, we have to construct a list of the hosts which will run NIS servers. localhost is in the list of NIS server hosts. Please continue to add the names for the other hosts, one per line. When you are done with the list, type a <control D>. next host to add: localhost next host to add: The current list of NIS servers looks like this: localhost Is this correct? [y/n: y] y We need a few minutes to build the databases... Building /var/yp/skills.com/ypservers... Running /var/yp/Makefile... gmake[1]: Entering directory '/var/yp/skills.com' Updating passwd.byname... Updating passwd.byuid... Updating group.byname... Updating group.bygid... Updating hosts.byname... Updating hosts.byaddr... Updating rpc.byname... Updating rpc.bynumber... Updating services.byname... Updating services.byservicename... Updating netid.byname... Updating protocols.bynumber... Updating protocols.byname... Updating mail.aliases... gmake[1]: Leaving directory '/var/yp/skills.com' localhost has been set up as a NIS master server. Now you can run ypinit -s localhost on all slave servers. [root@localhost ~]# Create a new nis account useradd nis1 -p123 useradd nis2 -p123 When the host changes, cd to /var/yp make [root@localhost ~]# cd /var/yp/ [root@localhost yp]# make gmake[1]: Entering directory '/var/yp/skills.com' Updating passwd.byname... Updating passwd.byuid... Updating group.byname... Updating group.bygid... Updating netid.byname... gmake[1]: Leaving directory '/var/yp/skills.com' [root@localhost yp]# Restart the service systemctl restart yppasswdd rpcbind ypserv systemctl enable yppasswdd rpcbind ypserv 3.nis client settingsDownload the package yum -y install ypbind rpcbind yp-tools Add nis domain name [root@localhost ~]# nisdomainname skills.com vim /etc/sysconfig/network NISDOMAIN skills.com Automatically mount the nis domain name at boot time [root@localhost ~]# vim /etc/rc.d/rc.local touch /var/lock/subsys/local /bin/nisdomainname skills.com [root@localhost ~]# chmod 777 /etc/rc.d/rc.local Edit the yp.conf file and set the main service. domain skills.com server 192.168.10.222 Restart the service systemctl restart ypbind rpcbind yptest to see if the joining is successful [root@localhost ~]# yptest Test 1: domainname Configured domainname is "skills.com" Test 2: ypbind Use Protocol V1: Used NIS server: 192.168.10.222 Use Protocol V2: Used NIS server: 192.168.10.222 Use Protocol V3: ypbind_nconf: nc_netid: udp nc_semantics: 1 nc_flag: 1 nc_protocol: 'inet' nc_proto: 'udp' nc_device: '-' nc_nlookups: 0 ypbind_svcaddr: 192.168.10.222:740 ypbind_servername: 192.168.10.222 ypbind_hi_vers: 2 ypbind_lo_vers: 2 Test 3: yp_match WARNING: No such key in map (Map passwd.byname, key nobody) Test 4: yp_first nis1 nis1:123:1000:1000::/home/nis1:/bin/bash Test 5: yp_next nis2 nis2:123:1001:1001::/home/nis2:/bin/bash Test 6: yp_master localhost Test 7: yp_order 1639387530 Test 8: yp_maplist netid.byname group.bygid group.byname passwd.byuid passwd.byname mail.aliases protocols.byname protocols.bynumber services.byservicename services.byname rpc.bynumber rpc.byname hosts.byaddr hosts.byname ypservers Test 9: yp_all nis1 nis1:123:1000:1000::/home/nis1:/bin/bash nis2 nis2:123:1001:1001::/home/nis2:/bin/bash 1 tests failed [root@localhost ~]# Configuring Domain User Login [root@localhost ~]# authselect select nis --force Backup stored at /var/lib/authselect/backups/2021-12-13-09-34-52.8NFKZD Profile "nis" was selected. The following nsswitch maps are overwritten by the profile: - aliases -automount - ethers - group - hosts - initgroups -netgroup - networks -passwd - Protocols -publickey -rpc - services -shadow Make sure that NIS service is configured and enabled. See NIS documentation for more information. [root@localhost ~]# Configure nfs on the primary server to share the home directory. [root@localhost yp]# vim /etx/exports /home/ *(rw,sync) [root@localhost yp]# exportfs -rv exporting *:/home The client mounts the home directory of the primary server systemctl restart nfs-server [root@localhost ~]# mount 192.168.10.222:/home/ /home/ [root@localhost ~]# df Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 379852 0 379852 0% /dev tmpfs 399816 0 399816 0% /dev/shm tmpfs 399816 5688 394128 2% /run tmpfs 399816 0 399816 0% /sys/fs/cgroup /dev/mapper/cl-root 17811456 1615988 16195468 10% / /dev/sda1 1038336 196688 841648 19% /boot /dev/sr0 9046654 9046654 0 100% /media tmpfs 79960 0 79960 0% /run/user/0 192.168.10.222:/home 17811456 1644672 16166784 10% /home [root@localhost ~]# Add the function of automatically mounting the main service home directory at startup. vim /etc/fstab 192.168.10.222:/home /home nfs defaults 0 0 [root@localhost ~]# mount -a [root@localhost ~]# df Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 379852 0 379852 0% /dev tmpfs 399816 0 399816 0% /dev/shm tmpfs 399816 5688 394128 2% /run tmpfs 399816 0 399816 0% /sys/fs/cgroup /dev/mapper/cl-root 17811456 1613680 16197776 10% / /dev/sda1 1038336 196688 841648 19% /boot /dev/sr0 9046654 9046654 0 100% /media 192.168.10.222:/home 17811456 1644544 16166912 10% /home tmpfs 79960 0 79960 0% /run/user/0 [root@localhost ~]# At this point, the nis configuration is complete. This is the end of this article about the detailed steps of setting up and configuring nis domain services on Centos8. For more information about setting up nis domain services on Centos8, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: A general method for implementing infinite text carousel with native CSS
>>: uniapp Sample code for implementing global sharing of WeChat mini-programs
Table of contents Design scenario Technical Point...
I was bored and suddenly thought of the implementa...
I. Overview When writing HTML templates, spaces a...
A few days ago, I found that the official version...
The first method: dynamically add a class to show...
Object's hasOwnProperty() method returns a Bo...
This article shares the Vant Uploader component f...
What is a covering index? Creating an index that ...
let Utils = { /** * Is it the year of death? * @r...
Table of contents How to create a Pod? kubectl to...
Solve the problem that the vue project can be pac...
Table of contents Basic usage of Promise: 1. Crea...
Preface: I recently started to study the construc...
Today I will share with you a good-looking counte...
<br />Most of the time when we talk about na...