Centos7 安装 NIS
网络拓扑
计算机名称 IP地址 角色
centos7-01 192.168.18.128 Master Server
centos7-02 192.168.18.129 compute1
centos7-03 192.168.18.130 compute2
防火墙设置
集群节点执行命令
#systemctl stop firewalld
#systemctl disable firewalld
集群节点关闭 selinux
#cat /etc/selinux/config
SELINUX=disabled
集群节点修改机器名
#cat /etc/hostname
计算机名称
安装 NIS 服务器端
master节点安装必备软件,执行命令
#yum -y install ypserv rpcbind
master节点设置nis域名,执行命令
#nisdomainname simcloud.com
#echo "nisdomainname simcloud.com" >>/etc/rc.local
#echo "NISDOMAIN=simcloud.com" >> /etc/sysconfig/network
master节点增加配置
#cat /etc/hosts
192.168.18.128 centos7-01
192.168.18.129 centos7-02
192.168.18.130 centos7-03
#cat /etc/sysconfig/network
YPSERV_ARGS="-p 1011"
#/etc/sysconfig/yppasswdd
YPPASSWDD_ARGS="--port 1012"
master节点,替换文件内容
#cat /etc/ypserv.conf
dns: no
files: 30
xfr_check_port: yes
* : * : shadow.byname : port
* : * : passwd.adjunct.byname : port
master节点启动服务
#systemctl restart rpcbind
#systemctl restart ypserv
#systemctl restart yppasswdd
master节点设置为开机启动项
#systemctl enable rpcbind
#systemctl enable ypserv
#systemctl enable yppasswdd
利用 rpcinfo 来检查看看
#rpcinfo -p localhost
#rpcinfo -u localhost ypserv
master节点执行创建库
#/usr/lib64/yp/ypinit -m
master节点更新NIS账户和资料库
#make -C /var/yp
NIS Client 客户端设置
NIS Client节点安装软件,执行命令
#yum install -y rpcbind yp-tools ypbind
NIS Client节点设置nis域名,执行命令
#nisdomainname simcloud.com
#echo "nisdomainname simcloud.com" >>/etc/rc.local
#echo "NISDOMAIN=simcloud.com" >> /etc/sysconfig/network
NIS Client节点配置文件
#cat /etc/hosts
192.168.18.128 centos7-01
192.168.18.129 centos7-02
192.168.18.130 centos7-03
#cat /etc/nsswitch.conf
passwd: files nis
shadow: files nis
group: files nis
hosts: files nis dns
#cat /etc/sysconfig/authconfig
USENIS=yes
#cat /etc/pam.d/system-auth
password sufficient pam_unix.so sha512 shadow nis nullok try_first_pass use_authtok
#cat /etc/yp.conf
domain simcloud.com server 192.168.18.128
NIS Client节点启动服务
#systemctl restart rpcbind
#systemctl restart ypbind
NIS Client节点开机启动
#systemctl enable rpcbind
#systemctl enable ypbind
NIS Client节点yptest用来测试 server 端和 client 端能否正常通讯
#yptest