Slurm安装2之NIS服务
control节点
1、安装服务
yum install -y yp*
2、网络配置(仅提供需要修改的部分)
vim /etc/sysconfig/network
[root@control ~]# cat /etc/sysconfig/network
# Created by cloud-init on instance boot automatically, do not edit.
#
NETWORKING=yes
NISDOMAIN=hpcdemo
YPSERV_ARGS="-p 1011"
3、yppasswdd配置(仅提供需要修改的部分)
[root@control ~]# cat /etc/sysconfig/yppasswdd
# Additional arguments passed to yppasswd
YPPASSWDD_ARGS="--port 1012"
4、ypserv.conf 配置(仅提供需要修改的部分)
[root@control ~]# cat /etc/ypserv.conf
# Host : Domain : Map : Security
#
# * : * : passwd.byname : port
# * : * : passwd.byuid : port
* : * : * : none
5、启动服务
systemctl restart network
systemctl start ypserv
systemctl start rpcbind
systemctl start yppasswdd.service
systemctl enable ypserv
systemctl enable rpcbind
systemctl enable yppasswdd.service
6、检查是否运行成功
rpcinfo -p localhost
[root@control ~]# rpcinfo -p localhost
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100004 2 udp 1011 ypserv
100004 1 udp 1011 ypserv
100004 2 tcp 1011 ypserv
100004 1 tcp 1011 ypserv
100009 1 udp 1012 yppasswdd
rpcinfo -u localhost ypserv
[root@control ~]# rpcinfo -u localhost ypserv
program 100004 version 1 ready and waiting
program 100004 version 2 ready and waiting
7、创建测试用户
for i in `seq 1 5`; do echo "=====create nisuser$i====="; useradd -u 200$i nisuser$i; echo password | passwd --stdin nisuser$i; done
查看用户 cut -d : -f 1 /etc/passwd
可以看到下面5个用户已经创建好
nisuser1
nisuser2
nisuser3
nisuser4
nisuser5
su nisuser1 即可登录到nisuser1空间
exit 退出nisuser1空间
8、建立资料库
ypinit命令初始化主服务器和常见NIS映射表。默认的ypinit同make命令给出的操作一样
/usr/lib64/yp/ypinit -m
CTRL+D 完成
9、更新资料库(添加或者修改用户时使用)
cd /var/yp/;make
10、重启资料库
systemctl restart ypserv
node节点
1、安装服务
yum install -y ypbind yp-tools
vim /etc/sysconfig/network
和server配置一样
nisdomainname hpcdemo
2、自动配置更新
authconfig --enablenis --nisdomain=hpcdemo --nisserver=control --update
3、重启服务
systemctl restart ypbind
systemctl restart rpcbind
4、测试一下
yptest 看下是否能同步到用户数据
参考:
https://blog.csdn.net/younger_china/article/details/53130780