1、服务器环境准备
centos6.5系统安装,关闭防火墙、NetworkManager和selinux;配置静态IP地址,并在hosts文件添加解析。
nis域名:aa.com
2、nis server服务器软件包安装
[root@localhost ~]#yum install yp-tools ypserv ypbind rpcbind -y
3、nis server配置
[root@localhost ~]#nisdomainname aa.com
[root@localhost ~]#echo "nisdomainname aa.com " >>/etc/rc.local \\这种设置可保障计算机重启后NIS域名不变
[root@localhost ~]#echo "NSIDOMAIN=aa.com " >>/etc/sysconfig/network \\这种设置要在network服务启动时生效
[root@localhost ~]# cat /etc/sysconfig/network
HOSTNAME=localhost.localdomain
NETWORKING=yes
NISDOMAIN=aa.com
YPSERV_ARGS="-p 1011" \\新增行
[root@localhost ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.10.233 aa.com \\添加解析
[root@localhost ~]# cat /etc/sysconfig/yppasswdd
# The passwd and shadow files are located under the specified
# directory path. rpc.yppasswdd will use these files, not /etc/passwd
# and /etc/shadow.
#ETCDIR=/etc
# This options tells rpc.yppasswdd to use a different source file
# instead of /etc/passwd
# You can't mix usage of this with ETCDIR
#PASSWDFILE=/etc/passwd
# This options tells rpc.yppasswdd to use a different source file
# instead of /etc/passwd.
# You can't mix usage of this with ETCDIR
#SHADOWFILE=/etc/shadow
# Additional arguments passed to yppasswd
YPPASSWDD_ARGS="--port 1012" \\新增行
4、启动服务并开机启动
[root@localhost ~]# /etc/init.d/ypserv start
[root@localhost ~]# /etc/init.d/yppasswdd start
[root@localhost ~]#chkconfig ypserv on
[root@localhost ~]#chkconfig yppasswdd on
5、添加/删除NIS用户
[root@localhost ~]#useradd -u 用户号 用户名
[root@localhost ~]#echo xxxx | passwd --stdin用户名
[root@localhost ~]userdel -r 用户名
[root@localhost ~]/usr/lib64/yp/ypinit -m 之后 ctrl+d, y
6、nis client配置
[root@client~]yum install ypbind -y
(1)设置 /etc/hosts,添加如下内容到文件的尾部
192.168.10.233 aa.com
192.168.10.234 client
(2)编辑 /etc/sysconfig/network,如下需要修改或添加的
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=client //需要修改
NISDOMAIN=aa.com //需要修改
(3)编辑 /etc/rc.local,添加 nisdomainname aa.com 在最后一行
(4)设置认证方式,使用命令authconfig-tui,选择“Use NIS”
[root@client~]authconfig-tui
网友评论