Configuration
NIS
Service
Set
NIS
Server
. As
NIS server, which needs to be installed
Ypserv Software Package
. Directly use
Ypserv-2.8-3.
Step 1: Set
Ypserv
The service is automatically started after it is started.
[Root @ VM1 root] #
Chkconfig ypserv on
[Root @ VM1 root] #
Chkconfig ypxfrd on
[Root @ VM1 root] #
Chkconfig yppasswdd on
You can also
In the setup command.
Step 2: Specify
NIS
Domain Name
[Root @ VM1 root] # nisdomainname grid1
To maintain this domain name after restart, modify
In the/etc/sysconfig/network file, add
Nisdomain = grid1 line.
Step 3: set which hosts can use which Mappings
Modify
Add a line to the/etc/ypserv. conf file:
192.168.56.0/24: *: None
Where
192.168.56.0 is
Automatically assigned by DHCP
IP address segment.
Step 4: Set the information to export
Modify
/Var/yp/makefile. Every setting in this file is explained in the annotations. In my file
All is as follows:
# If you don't
Want some of these maps built, feel free to comment
# Them out from
This list.
ALL: passwd Group
Hosts RPC services netid protocols mail/
# Netgrp
Shadow publickey networks ethers bootparams printcap/
# AMD. Home
Auto. Master auto. Home auto. Local passwd. Adjunct/
# Timezone
Locale netmasks
Use the default settings.
Step 5: Start
Ypserv
[Root @ VM1 root] #
Service ypserv start
Starting YP Server
Services: [OK]
Step 6: Build a ing Database
[Root @ VM1 root] #
/Usr/lib/yp/ypinit-m
At this point, we
Have to construct a list of the hosts which will run NIS
Servers. VM1 is
In the list of NIS server hosts. Please continue to add
The names for
Other hosts, one per line. When you are done with
List, type
<Control D>.
Next host
To add: VM1
Next host
To add:
The current list
Of NIS servers looks like this:
VM1
Is this correct?
[Y/N: Y] y
We need a few
Minutes to build the databases...
Building
/Var/yp/grid1/ypservers...
Running
/Var/yp/makefile...
Gmake [1]: Entering
Directory '/var/yp/grid1'
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/grid1'
VM1 has been set
Up as a NIS master server.
Now you can run
Ypinit-s VM1 on all slave server.
Step 7: test whether the service is correctly started
[Root @ VM1 root] #
Rpcinfo-P localhost
Program vers
PROTO Port
100000 2
TCP 111 Portmapper
100000 2
UDP 111 Portmapper
100004 2
UDP 679 ypserv
100004 1
UDP 679 ypserv
100004 2
TCP 682 ypserv
100004 1
TCP 682 ypserv
[Root @ VM1 root] #
Rpcinfo-u VM1 ypserv
Program100004
Version 1 ready and waiting
Program100004
Version 2 ready and waiting
Note:
- NIs and
All NFS operations are required.
Supported by RPC, available for search
NFS and
Learn how NIS works.
- Data Introduction
Another advantage of RPC technology is that the Service implementers do not have to consider too much details about the underlying communication protocol, but focus only on the implementation of service functions.
- After ypserv is installed
Ypxfrd service and
Yppasswdd service, yes
Man.
Ypxfrd is used in
Information transmitted between the NIS master server and slave server.
The yppasswdd service is the password update daemon.
- After the information on the server changes, you must
Run the command again on the NIS server.
Build a database using ypinit.
Set
NIS
Client
. As
NIS client, which needs to be installed
Ypbind and
YP-tools.
You can also directly use the installation package on the installation disc.
Step 1: Specify
NIS
Domain Name
VM1 has been set.
VM2 and
Modify on vm3 respectively
/Etc/sysconfig/network, and
Nisdomain = grid1 line.
[Root @ VM2 root] #
Vim/etc/sysconfig/Network
[Root @ VM2 root] #
Nisdomainname grid1
Step 2: Set
NIS
Server
In
In the/etc/yp. conf file, specify
NIS server. In
On VM1:
Ypserver
Localhost, in
VM2 and
On vm3:
Domain
Grid1 Broadcast
Step 3: Set
Ypbind
Automatic startup
[Root @ VM1 root] # chkconfig ypbind on
Perform the same settings on VM2 and vm3.
Step 4: Start
Ypbind
[Root @ VM2 root] #
Service ypbind start
Binding to the NIS
Domain: [OK]
Listening for
NIS domain server.
The other two machines are the same.
Step 5: Test client settings
[Root @ VM2 root] #
Ypwhich
VM1
[Root @ VM2 root] #
Rpcinfo-u VM1 ypserv
Program100004
Version 1 ready and waiting
Program100004
Version 2 ready and waiting
For example
Create a new user in VM1:
[Root @ VM1 root] #
Useradd jcwkyl
[Root @ VM1 root] #
Passwd jcwkyl
Changing Password
For user jcwkyl.
New password:
Bad password: it
Is too simplistic/systematic
Retype new
Password:
Passwd: All
Authentication tokens updated successfully.
Rebuild the database:
[Root @ VM1 root] #
/Usr/lib/yp/ypinit-m
In
On VM2:
[Root @ VM2 root] #
Ypcat passwd
Jcwkyl: $1 $ q0cyxfd3 $ R. cbifnu0/tbn53eqxv911: 500: 500:/home/jcwkyl:/bin/bash
[Root @ VM2 root] #
Ypcat Group
Jcwkyl :! : 500:
In
On vm3:
[Root @ vm3 root] #
Yptest
Test 1: domainname
Configured
Domainname is "grid1"
Test 2: ypbind
Used NIS Server:
192.168.56.101
Test 3: yp_match
Warning: no such
Key in map (MAP passwd. byname, key nobody)
Test 4: yp_first
Jcwkyl
Jcwkyl: $1 $ q0cyxfd3 $ R. cbifnu0/tbn53eqxv911: 500: 500:/home/jcwkyl:/bin/bash
Test 5: yp_next
Test 6: yp_master
VM1
Test 7: yp_order
1259269592
Test 8: yp_maplist
Mail. aliases
Protocols. bynumber
Services. byservicename
Netid. byname
Services. byname
Rpc. bynumber
Rpc. byname
Hosts. byaddr
Hosts. byname
Group. bygid
Group. byname
Passwd. byname
Protocols. byname
Ypservers
Passwd. byuid
Test 9: yp_all
Jcwkyl
Jcwkyl: $1 $ q0cyxfd3 $ R. cbifnu0/tbn53eqxv911: 500: 500:/home/jcwkyl:/bin/bash
1 tests failed
So far,
The NIS service is successfully set.
Note:
- To be modified on the client
The/etc/nsswitch. conf file is used to specify the client who initiates the query when querying a certain information. For example
In/etc/nsswitch. conf
Hosts
: Files NIS
DNS indicates that when the host name resolution is performed, the local
/Etc/hosts file. If not found, query
NIS server, last Query
DNS server. If no
NIS, although
The NIS server has exported
Hosts file. The client still does not query the host name during host name resolution.
NIS server.
- I don't like it very much.
Yppasswd can be used to change the user password.
Run passwd again after modification
/Usr/lib/yp/ypinit
-The M Command Re-constructs the database. Note that my
The NIS server also runs
NIS client.
When passwd changes the user password
The ypbind service is disabled. Otherwise, an error may occur.
- Improper configuration of the/etc/hosts file may affect
NIS.
Configuration
NFS
Service
Next, configure
NFS service,
VM1
NFS server. Install
SGE,
Of VM1
$ Home directory and
$ Sge_root is exported.
Install configurations
NFS server,
NFS server to be installed
Nfs-utils
.
NFS configuration is extremely simple:
On the server side, modify
/Etc/exports
, Specify the directory to export
:
/Home
192.168.56.0/24 (RW, sync)
On the client,
Mount
Directory exported by the server:
[Root @ VM2 root] #
Mount-t nfs VM1:/home
Use
Mount to view
Directory on Mount:
[Root @ VM2 root] #
Mount
/Dev/hda2 on/
Type ext3 (RW)
None on/proc type
Proc (RW)
None on/dev/PTS
Type devpts (RW, gid = 5, mode = 620)
Usbdevfs on
/Proc/bus/USB Type usbdevfs (RW)
/Dev/hda1 on/boot
Type ext3 (RW)
None on/dev/SHM
Type tmpfs (RW)
VM1:/home on/home
Type NFS (RW, ADDR = 192.168.56.101)
Here is just a demonstration,
The security and Performance Settings of NFS servers are not explored. Related Commands include:
Showmount,
Exportfs.
Exportfs
-R can re-export all
/Etc/exports is set as the export directory. The output of this command can be used to check
Does the/etc/exports file have any irregularities? modify it according to its warning information
/Etc/exports.