master,slave,client 均采用RHEL5
master:
hostname: master.atyu30.com 10.0.0.150
Slave:
hostname: slave.atyu30.com 10.0.0.160
Client:
hostname: client1.atyu30.com 10.0.0.170
#################################1.安装NIS Server
Author:atyu30(iopenbsd#gmail.com)
Data: 08/04/04
HK_client--
| |
| |
|---Master |
| || |
| slave---|
| |
| |
BJ_client
################################
Master:
# yum install ypbind
2.正名
# cat /etc/hosts
10.0.0.150 master.atyu30.com master
10.0.0.160 slave.atyu30.com slave
10.0.0.170 client1.atyu30.com client1
3.指定NISDOAMIN
# vi /etc/sysconfig/network
+ NISDOMAIN=master
4.生成NIS数据库5.共享的资源
# /usr/lib/yp/ypinit -m
At this point, we have to construct a list of the hosts which will run NIS
servers. master.atyu30.com 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.
next host to add: master.atyu30.com
next host to add:
The current list of NIS servers looks like this:
master.atyu30.com
Is this correct? [y/n: y] y
We need a few minutes to build the databases...
Building /var/yp/(none)/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/(none)'
Updating passwd.byname...
failed to send 'clear' to local ypserv: RPC: Port mapper failureUpdating passwd.byuid...
failed to send 'clear' to local ypserv: RPC: Port mapper failureUpdating group.byname...
failed to send 'clear' to local ypserv: RPC: Port mapper failureUpdating group.bygid...
failed to send 'clear' to local ypserv: RPC: Port mapper failureUpdating hosts.byname...
failed to send 'clear' to local ypserv: RPC: Port mapper failureUpdating hosts.byaddr...
failed to send 'clear' to local ypserv: RPC: Port mapper failureUpdating rpc.byname...
failed to send 'clear' to local ypserv: RPC: Port mapper failureUpdating rpc.bynumber...
failed to send 'clear' to local ypserv: RPC: Port mapper failureUpdating services.byname...
failed to send 'clear' to local ypserv: RPC: Port mapper failureUpdating services.byservicename...
failed to send 'clear' to local ypserv: RPC: Port mapper failureUpdating netid.byname...
failed to send 'clear' to local ypserv: RPC: Port mapper failureUpdating protocols.bynumber...
failed to send 'clear' to local ypserv: RPC: Port mapper failureUpdating protocols.byname...
failed to send 'clear' to local ypserv: RPC: Port mapper failureUpdating mail.aliases...
failed to send 'clear' to local ypserv: RPC: Port mapper failuregmake[1]: Leaving directory `/var/yp/(none)'
master.atyu30.com has been set up as a NIS master server.
Now you can run ypinit -s master.atyu30.com on all slave server.
# vi /var/yp/Makefile
#NOPUSH=true(把这一行注释掉,缺省是不允许主动推的)
NOPUSH=false
6.授权slave
# vi /var/yp/ypservers
master.atyu30.com
+slave.atyu30.com
7.启动NIS Server
# /etc/init.d/portmap restart
# /etc/init.d/ypbind restart
# /etc/init.d/yppasswdd restart
8.测试
# yptest
Test 1: domainname
Configured domainname is "master"
Test 2: ypbind
Used NIS server: master.atyu30.com
Test 3: yp_match
WARNING: No such key in map (Map passwd.byname, key nobody)
Test 4: yp_first
user1 user1:$1$0yzHpbZd$IFk/llsLo6fg7yKfQsoYr/:500:500::/home/user1:/bin/bash
Test 5: yp_next
Test 6: yp_master
master.atyu30.com
Test 7: yp_order
0
Test 8: yp_maplist
group.bygid
netid.byname
protocols.byname
protocols.bynumber
passwd.byname
services.byname
hosts.byaddr
hosts.byname
rpc.bynumber
rpc.byname
services.byservicename
group.byname
mail.aliases
passwd.byuid
ypservers
Test 9: yp_all
user1 user1:$1$0yzHpbZd$IFk/llsLo6fg7yKfQsoYr/:500:500::/home/user1:/bin/bash
1 tests failed
9.添加启动项
# chkconfig portmap 235 on
# chkconfig ypbind 235 on
# chkconfig yppasswdd on
SlaveClient
1.安装NIS Server
# yum install ypbind ypserv
2.正名
# cat /etc/hosts
10.0.0.150 master.atyu30.com master
10.0.0.160 slave.atyu30.com slave
10.0.0.170 client1.atyu30.com client1
3.指定NISDOAMIN
# vi /etc/sysconfig/network
+ NISDOMAIN=master
4.启动NIS Server
# /etc/init.d/portmap restart
# /etc/init.d/ypbind restart
# /etc/init.d/yppasswdd restart
5.与master同步数据
# /usr/lib/yp/ypinit -s master
6.添加启动项
# chkconfig portmap 235 on
# chkconfig ypbind 235 on
# chkconfig yppasswdd on
1.安装NIS Server
# yum install ypbind
2.正名
# cat /etc/hosts
10.0.0.150 master.atyu30.com master
10.0.0.160 slave.atyu30.com slave
10.0.0.170 client1.atyu30.com client1
3.指定NISDOAMIN
# vi /etc/sysconfig/network
+ NISDOMAIN=slave
4. # vi /etc/nsswitch.conf
passwd: files nis
shadow: files nis
group: files nis
hosts: files nis dns
5.# vi /etc/sysconfig/authconfig
USENIS=yes
6. # vi /etc/pam.d/system-auth
password sufficient pam_unix.so md5 shadow nis nullok try_first_pass use_authtok
7. # vi /etc/yp.conf
domain slave broadcast
如果想省方便4-7 可以采用authconfig-tui来一步完成
8.启动NIS
# /etc/init.d/portmap restart
# /etc/init.d/ypbind restart
# /etc/init.d/yppasswdd restart
9.登录验证
======================================================
全文结束
如果有问题请联系我(iopenbsd#gmail.com),共同学习