安装nis服务
[root@localhost Server]# yum install yp
[root@localhost Server]# service ypserv start
[root@localhost Server]# service yppasswdd start
Starting YP passwd service: [ OK ]
[root@localhost Server]# cd /var/yp
vim Makefile
[root@localhost yp]# vim /etc/sysconfig/network 定义nis域名
加上 NISDOMAIN=TEST
重启
构建NIS数据库
#/usr/lib/yp/ypinit -m
之后有用户增加可使用ypinit和/var/yp/make命令更新数据库
设置共享
vim /etc/exports
客户端配置
Setup 选择
在客户端上进行测试是否能和服务器连接
[root@localhost ~]# yptest
Test 1: domainname
Configured domainname is "TEST"
Test 2: ypbind
Used NIS server: TEST
Test 3: yp_match
WARNING: No such key in map (Map passwd.byname, key nobody)
Test 4: yp_first
user2 user2:$1$2RewpmMw$lDRRK7gzAtZ/bNvqZaJzv/:501:501::/home/user2:/bin/bash
Test 5: yp_next
user5 user5:$1$xDKVUrYD$aIhWCCy2.zpkP7I/YIdIp/:504:504::/home/user5:/bin/bash
user1 user1:$1$iGqKAiTp$h/wVL6bcFui73wXVI7vNA0:500:500::/home/user1:/bin/bash
user4 user4:$1$Y5ag5PZH$qkDMvBWM4DfVA306byxzZ1:503:503::/home/user4:/bin/bash
user3 user3:!!:502:502::/home/user3:/bin/bash
Test 6: yp_master
localhost.localdomain
Test 7: yp_order
1347969263
Test 8: yp_maplist
passwd.byuid
group.bygid
hosts.byaddr
hosts.byname
group.byname
passwd.byname
ypservers
Test 9: yp_all
user2 user2:$1$2RewpmMw$lDRRK7gzAtZ/bNvqZaJzv/:501:501::/home/user2:/bin/bash
user5 user5:$1$xDKVUrYD$aIhWCCy2.zpkP7I/YIdIp/:504:504::/home/user5:/bin/bash
user1 user1:$1$iGqKAiTp$h/wVL6bcFui73wXVI7vNA0:500:500::/home/user1:/bin/bash
user4 user4:$1$Y5ag5PZH$qkDMvBWM4DfVA306byxzZ1:503:503::/home/user4:/bin/bash
user3 user3:!!:502:502::/home/user3:/bin/bash
1 tests failed
[root@localhost ~]#
下面设置自动挂载服务器的家目录到本地
[root@localhost ~]# vim /etc/auto.master
[root@localhost ~]# cp /etc/auto.misc /etc/auto.nfs
[root@localhost ~]# vim /etc/auto.nfs
[root@localhost ~]# service autofs restart