在CentOS7上搭建NIS服务
yum -y install ypserv
yum -y install ypbind
yum -y install yp-tools
yum -y install portreserve
举例域名设成:WANG [root@node1 ~]# cat /etc/sysconfig/network
NISDOMAIN=WANG
增加开机设置域名: vi /etc/rc.local 加入/bin/nisdomainname WANG 提醒:centos7的rc.local一定要能够执行:chmod +x /etc/rc.d/rc.local,否则重启后一直不生效。
systemctrl start rpcbind systemctrl start ypserv systemctrl start yppasswdd
systemctl enable rpcbind systemctl enable ypserv systemctl enable yppasswdd
/usr/lib64/yp/ypinit -m systemctrl restart ypserv 当账号信息有更新时,cd /var/yp,make一下。
yum -y install ypbind
yum -y install yp-tools
yum -y install portreserve
vi /etc/sysconfig/network 加入NISDOMAIN=WANG
vi /etc/rc.local 添加/bin/nisdomainname WANG
添加 domain WANG server node1
修改USENIS=yes
执行命令:
authconfig --enablenis --nisdomain=WANG --nisserver=node1 --enablemkhomedir --update
systemctl restart rpcbind
systemctl restart ypbind
systemctl enable rpcbind
systemctl enable ypbind
若重启ypbind服务失败,可能是防火墙与selinux权限问题,若关闭仍然失败,应该是配置出现错误.
yptest
ypcat passwd
有输出server端用户信息,即配置成功。
参考链接: http://www.178pt.com/32.html https://blog.csdn.net/dream_angel_z/article/details/44226055