一、NIS服务器端
1、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 nistest
#echo '/bin/nisdomainname nistest' >> /etc/rc.d/rc.local 设置开机自启动
#echo 'NISDOMAIN=nistest' >> /etc/sysconfig/network 设置开机网卡检测
4、设置ypserv服务的配置文件;
#vi /etc/ypserv.conf
127.0.0.1/255.255.255.255 : * :* :none
192.168.10.0/255.255.255.0 : * : * :none
* :* :* :deny
5、启动配置服务;
#service ypserv restart
#service portmap restart
#service yppasswdd restart
#chkconfig --level 35 ypserv on
#chkconfig --level 35 yppasswdd on
6、构建NIS数据库;
#/usr/lib/yp/ypinit -m
二、NIS客户机端
1、需要的软件包(系统默认安装的)
ypbind-1.17.2-3
yp-tools-2.8-7
2、设置hosts文件
#echo '192.168.10.10 nisserver' >> /etc/hosts
3、建立NIS域名
#nisdomainname nistest
#echo '/bin/nisdomainname nistest' >> /etc/rc.d/rc.local
#echo 'NISDOMAIN=nistest' >> /etc/sysconfig/network
#echo 'domain nistest server nisserver' >> /etc/yp.conf
4、设置nsswitch.conf文件
passwd: files nis
shadow: files nis
group: files nis
hosts: files nis dns
5、启动ypbind服务
#service portmap status #需保证portmap服务正在运行
#service ypbind start
#chkconfig --level 35 ypbind on
配置完成后,可用ypcat、ypwhich、yptest来测试;
用法:
①yptest
②ypcat -x、ypwhich -x
③ypcat group、ypcat hosts