一、NIS环境(修改/etc/hosts文件)
server: t1          192.168.10.7
client: c1            192.168.10.16
二、NIS服务器端
1、从第一张光盘安装
rpm -ivh ypserv-2.13-5.i386.rpm
2、将time和time-udp服务状态改为启动
chkconfig time on
chkconfig time-udp on
service xinetd restart
3、建立nis域名
nisdomainname nishy
vi /etc/rc.local
/bin/nisdomainname nishy
vi /etc/sysconfig/network
NISDOMAIN=nishy
4、设置ypserv服务的配置文件(添加允许访问的客户端范围)
vi /etc/ypserv.conf
127.0.0.0/255.255.255.0        : *        : *         : none
192.168.10.0/255.255.255.0        : *        : *         : none
*                        : *        : *         : deny
5、vi /var/yp/securenets
host 127.0.0.1
255.255.255.0 192.168.10.0
三、服务器启动
service portmap status
service ypserv start
service yppasswdd start
四、构建nis数据库
/usr/lib/yp/ypinit -m
看看主机名是否正确。


五、NIS客户端
1、安装NIS客户端软件包
rpm -q ypbind
rpm -q yp-tools
2、vi /etc/hosts
192.168.10.7 t1
3、nisdomainname nishy

vi /etc/rc.d/rc.local
/bin/nisdomainname nishy

vi /etc/sysconfig/network
NISDOMAIN=nishy
4、vi /etc/yp.conf
domain nishy server t1
5、vi /etc/nsswitch.conf
passwd:        files nis
shadow:        files nis
group:        file nis
hosts:        files nis dns

6、service portmap status
service ypbind restart

六、设置nis客户端的宿主目录
1、在服务器端作nfs共享:
vi /etc/exports
/home         192.168.10.0/24(rw,async,all_squash)
service nfs restart
2、在客户端作更改
vi /etc/fstab
192.168.10.7:/home        /home        nfs        defaults,user 0 0
3、重启客户