Ubuntu 12.04
Sponsored Link

NISサーバー構築2012/05/07

 
各サーバー間でユーザーのアカウント情報を共有できるようにNISサーバーを構築します。
[1] NISシステムをインストールします。
root@dlp:~#
aptitude -y install nis
Preconfiguring packages ...
# インストール中、NISドメインの設定画面が出るのでドメイン名を入力

# インストール後、自動的に起動を試みるが失敗するので、終わるまで待つか放っておいて別ウィンドウで設定開始する


[2] NISサーバーとしての設定をします。
root@dlp:~#
vi /etc/default/nis
# 6行目:変更(NISマスターサーバーとする)

NISSERVER=
master
root@dlp:~#
vi /etc/ypserv.securenets
# This line gives access to everybody. PLEASE ADJUST!
# コメントにする

#
0.0.0.0 0.0.0.0
# 最終行:アクセス許可する範囲追記

255.255.255.0           10.0.0.0

root@dlp:~#
vi /var/yp/Makefile
# 119行目:追記

ALL = passwd
shadow
group hosts rpc services netid protocols netgrp
root@dlp:~#
vi /etc/hosts
127.0.0.1       localhost
127.0.1.1       dlp
# NISデータベース登録用に自身のIPを登録

10.0.0.30       dlp

root@dlp:~#
/usr/lib/yp/ypinit -m
   
# NISデータベース更新
At this point, we have to construct a list of the hosts which will run NIS
servers.  dlp 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:  dlp
        next host to add:    
# Ctrl+D を押す

The current list of NIS servers looks like this:

dlp

Is this correct? [y/n: y]
y

We need a few minutes to build the databases...
Building /var/yp/srv.world/ypservers...
Running /var/yp/Makefile...
make[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 netgroup...
Updating netgroup.byhost...
Updating netgroup.byuser...
make[1]: Leaving directory `/var/yp/srv.world'

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

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

root@dlp:~#
service ypserv start

ypserv start/running, process 1972
root@dlp:~#
sysv-rc-conf ypserv on
# 以降、新しくユーザーを追加した場合は、以下のようにしてNISデータベースの更新もする

root@dlp:~#
cd /var/yp

root@dlp:/var/yp#
関連コンテンツ