CentOS7下安装NIS初体验

  |   0 评论   |   0 浏览

背景

体验

服务端

安装必备软件

master节点,安装必备软件

yum -y install ypserv rpcbind yp-tools

设置 NIS 域名

# nisdomainname nis.hpc
# echo "nisdomainname nis.hpc" >> /etc/rc.d/rc.local
# echo "NISDOMAIN=nis.hpc" >> /etc/sysconfig/network

增加hosts配置

172.16.0.109 console
172.16.0.110 hpc01
172.16.0.111 hpc02

设置nis端口

#cat /etc/sysconfig/network
YPSERV_ARGS="-p 1011"
#/etc/sysconfig/yppasswdd
YPPASSWDD_ARGS="--port 1012"

启动服务

systemctl restart rpcbind
systemctl restart ypserv
systemctl restart yppasswdd

设置开机启动

systemctl enable rpcbind
systemctl enable ypserv
systemctl enable yppasswdd

查看

# rpcinfo -p localhost
…………

# rpcinfo -u localhost ypserv
program 100004 version 1 ready and waiting
program 100004 version 2 ready and waiting

创建库

# /usr/lib64/yp/ypinit -m

更新NIS信息

# make -C /var/yp/

客户端设置

安装软件

yum install -y rpcbind yp-tools ypbind

设置 NIS 域名

# nisdomainname nis.hpc
# echo "nisdomainname nis.hpc" >> /etc/rc.d/rc.local
# echo "NISDOMAIN=nis.hpc" >> /etc/sysconfig/network

增加hosts配置

172.16.0.109 console
172.16.0.110 hpc01
172.16.0.111 hpc02

配置文件

/etc/nsswitch.conf 文件

passwd: files nis  
shadow: files nis  
group:  files nis  
hosts:  files nis dns

/etc/sysconfig/authconfig文件,

USENIS=yes

/etc/pam.d/system-auth文件,

password    sufficient    pam_unix.so sha512 shadow nis nullok try_first_pass use_authtok

/etc/yp.conf文件

domain nis.hpc server 172.16.0.109

启动服务

systemctl restart rpcbind
systemctl restart ypbind

开机启动

systemctl enable rpcbind
systemctl enable ypbind

测试

yptest

参考