Fedora 10
Sponsored Link

NISサーバー構築
2008/11/27
  各サーバーのネットワークでユーザーのアカウント情報を共有できるようにNISサーバーを構築します。
[root@ns ~]#
yum -y install ypserv


[root@ns ~]#
ypdomainname srv.world
 
# NISドメイン指定

[root@ns ~]#
vi /etc/sysconfig/network


NETWORKING=yes
HOSTNAME=ns.srv.world
GATEWAY=192.168.0.1
NISDOMAIN=srv.world
# 最終行へ追記


[root@ns ~]#
vi /var/yp/Makefile


# MERGE_PASSWD=true|false
MERGE_PASSWD=
false
# 42行目:変更

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

#
# 117行目:追記

all: passwd
shadow
 group hosts rpc services netid protocols

[root@ns ~]#
vi /var/yp/securenets


host
127.0.0.1

255.255.255.0
192.168.0.0


# ユーザー新規追加時にWebサイト格納用のディレクトリを自動生成

[root@ns ~]#
mkdir /etc/skel/public_html

[root@ns ~]#
chmod 711 /etc/skel/public_html


# ユーザー新規追加時にメール格納用のディレクトリを自動生成

[root@ns ~]#
mkdir -p /etc/skel/Maildir/cur

[root@ns ~]#
mkdir -p /etc/skel/Maildir/new

[root@ns ~]#
mkdir -p /etc/skel/Maildir/tmp

[root@ns ~]#
chmod -R 700 /etc/skel/Maildir/


[root@ns ~]#
useradd fedora

[root@ns ~]#
passwd fedora

Changing password for user fedora.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

[root@ns ~]#
/usr/lib/yp/ypinit -m
# NISデータベース更新

At this point, we have to construct a list of the hosts which will run NIS servers. ns.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: ns.srv.world
next host to add:
# Ctrl + D キーを押す

The current list of NIS servers looks like this:

ns.srv.world

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...
gmake[1]: Entering directory `/var/yp/srv.world'
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/srv.world'

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

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

[root@ns ~]#
/etc/rc.d/init.d/rpcbind start

Starting rpcbind:
[  OK  ]

[root@ns ~]#
/etc/rc.d/init.d/ypserv start

Starting YP server services:
[  OK  ]

[root@ns ~]#
/etc/rc.d/init.d/yppasswdd start

Starting YP passwd service:
[  OK  ]

[root@ns ~]#
chkconfig rpcbind on

[root@ns ~]#
chkconfig ypserv on

[root@ns ~]#
chkconfig yppasswdd on


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

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

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