CentOS 5
Sponsored Link

NISサーバー構築2015/01/13

  各サーバー間でユーザーのアカウント情報を共有できるようにNISサーバーを構築します。
[root@dir ~]#
yum -y install ypserv
[root@dir ~]#
ypdomainname srv.world
 
# NISドメイン指定

[root@dir ~]#
vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=dir.srv.world
# 最終行へ追記

NISDOMAIN=srv.world
[root@dir ~]#
vi /var/yp/Makefile
# MERGE_PASSWD=true|false
# 42行目:変更

MERGE_PASSWD=
false
# MERGE_GROUP=true|false
# 46行目:変更

MERGE_GROUP=
false
# 117行目:追記

all: passwd
shadow
 group hosts rpc services netid protocols
[root@dir ~]#
vi /var/yp/securenets
255.0.0.0       127.0.0.0
255.255.255.0   10.0.0.0

[root@dir ~]#
vi /etc/hosts
# NISデータベース登録用に自身のIPを登録

10.0.0.30       dlp.srv.world dlp

[root@dir ~]#
/etc/rc.d/init.d/portmap start

Starting portmap:     [ OK ]
[root@dir ~]#
/etc/rc.d/init.d/ypserv start

Starting YP server services:     [  OK  ]
[root@dir ~]#
/etc/rc.d/init.d/yppasswdd start

Starting YP passwd service:     [  OK  ]
[root@dir ~]#
chkconfig portmap on

[root@dir ~]#
chkconfig ypserv on

[root@dir ~]#
chkconfig yppasswdd on
[root@dir ~]#
/usr/lib64/yp/ypinit -m
   
# NISデータベース更新
At this point, we have to construct a list of the hosts which will run NIS
servers. dir.srv.world 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: dir.srv.world

next host to add:
   
# Ctrl + D キーを押す

The current list of NIS servers looks like this:
dir.srv.world
Is this correct? [y/n: y]
y
   
# y キーを押してEnter

We need a few minutes to build the databases...
Building /var/yp/srv.world/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/srv.world'
Updating passwd.byname...
Updating passwd.byuid...
Updating shadow.byname...
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/srv.world'

dir.srv.world has been set up as a NIS master server.

Now you can run ypinit -s dir.srv.world on all slave server.

# 以降、新しくユーザーを追加した場合は、以下のようにしてNISデータベースの更新もする

[root@dir ~]#
cd /var/yp

[root@dir yp]#
関連コンテンツ