NIS服务器的配置过程-阿里云开发者社区

开发者社区> 开发与运维> 正文

NIS服务器的配置过程

简介:

                         NIS服务器的配置过程

以前在做实验的过程中总结和写的一些教程的一些资料,一直没时间发布到博客上面,五一到了,终于有点时间发布啦!关于Linux上面还会有RHCE系列的学习笔记发表

NIS需要的软件包:rpm -ivh ypserv-2.13-5.i386.rpm
NIS的配置文件:/etc/ypserv.conf
NIS的守护进程:ypserv
1、按装rpm包
[root@cisco RPMS]# rpm -ivh ypserv-2.13-5.i386.rpm
warning: ypserv-2.13-5.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing... ########################################### [100%]
1:ypserv ########################################### [100%]
2、开启time和time-udp服务,nis服务需要这两个服务的支持
[root@cisco RPMS]# chkconfig --list|grep time
time-udp: off
time: off
daytime: off
daytime-udp: off
[root@cisco RPMS]# chkconfig time on
[root@cisco RPMS]# chkconfig time-udp on
[root@cisco RPMS]# service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
3、设定NIS域名
[root@cisco RPMS]# nisdomainname nis-abc
[root@cisco RPMS]# vi /etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
nisdominname nis-abc
"/etc/rc.d/rc.local" 8L, 242C
[root@cisco RPMS]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
NISDOMAIN=nis-abc
:wq
4、编辑主配置文件
[root@cisco ~]# vi /etc/ypserv.conf
127.0.0.0/255.255.255.0 : * : * : none
192.168.20.0/255.255.255.0 : * : * : none
* : * : * : deny
5、设置对NIS客户端主机的安全访问 www.wqmsl.cn
cat /var/yp/securenets
host 127.0.0.1
255.255.255.0 192.168.20.0
6.、创建账号和密码,用来验证
[root@cisco ~]# useradd cisco
[root@cisco ~]# passwd cisco
Changing password for user cisco.
New UNIX password:
BAD PASSWORD: it is too simplistic/systematic
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
7、启动服务
[root@cisco ~]# service ypserv start
Starting YP server services: [ OK ]
8、构建NIS的数据库文件
[root@cisco ~]# /usr/lib/yp/ypinit -m
At this point, we have to construct a list of the hosts which will run NIS
servers. cisco is in the list of NIS server hosts. Please continue to add
the names for the other hosts, one per line. When you are done with the
list, type a <control D>.
next host to add: cisco
next host to add:
The current list of NIS servers looks like this:
cisco
Is this correct? [y/n: y]
We need a few minutes to build the databases...
Building /var/yp/nis-abc/ypservers...
gethostbyname(): Resource temporarily unavailable
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/nis-abc'
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
Updating rpc.byname...
Updating rpc.bynumber...
Updating services.byname...
Updating services.byservicename...
Updating netid.byname...
Updating protocols.bynumber...
Updating protocols.byname...
Updating mail.aliases...
gmake[1]: Leaving directory `/var/yp/nis-abc'
cisco has been set up as a NIS master server.
Now you can run ypinit -s cisco on all slave server.
NIS客户端的配置过程
NIS客户端需要的软件包:ypbind-1.17.2-3
yp-tools-2.8-7
NIS客户端的配置文件:/etc/yp.conf
NIS客户端的守护进程:ypbind
1、查看是否安装了RPM包
[root@localhost ~]# rpm -qa |grep ^yp
ypbind-1.17.2-3
yp-tools-2.8-7
2、设置NIS的域名
[root@cisco RPMS]# nisdomainname nis-abc
[root@cisco RPMS]# vi /etc/rc.d/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
nisdominname nis-abc
"/etc/rc.d/rc.local" 8L, 242C
[root@cisco RPMS]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
NISDOMAIN=nis-abc
3、设置客户机的主配置文件
[root@localhost ~]# vi /etc/yp.conf
# generated by /sbin/dhclient-script
domain nis-abc server cisco
4、设置主机的HOSTS文件
[root@localhost ~]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.20.1 cisco
5、[root@localhost ~]# vi /etc/nsswitch.conf
passwd: files nis
shadow: files nis
group: files nis
6、启动服务ypbind服务程序
[root@localhost ~]# service portmap status
portmap (pid 1696) is running...
[root@localhost ~]# service ypbind start
Binding to the NIS domain: [ OK ]
Listening for an NIS domain server..
7、验证
[root@localhost ~]# yptest
Test 1: domainname
Configured domainname is "nis-abc"
Test 2: ypbind
Used NIS server: cisco
Test 3: yp_match
WARNING: No such key in map (Map passwd.byname, key nobody)
Test 4: yp_first
cisco cisco:$1$hvFanF6I$GB4qhFjJjfF2YMlUaJVa40:500:500::/home/cisco:/bin/bash
Test 5: yp_next
WARNING: Internal NIS error (Map passwd.byname)
Test 6: yp_master
cisco
Test 7: yp_order
1243581051
Test 8: yp_maplist
protocols.byname
ypservers
rpc.bynumber
hosts.byname
netid.byname
hosts.byaddr
passwd.byuid
passwd.byname
group.byname
rpc.byname
group.bygid
services.byservicename
services.byname
mail.aliases
protocols.bynumber
Test 9: yp_all
cisco cisco:$1$hvFanF6I$GB4qhFjJjfF2YMlUaJVa40:500:500::/home/cisco:/bin/bash
2 tests failed
[root@localhost ~]# ypwhich
cisco
[root@localhost ~]# ypwhich -x
Use "ethers" for map "ethers.byname"
Use "aliases" for map "mail.aliases"
Use "services" for map "services.byname"
Use "protocols" for map "protocols.bynumber"
Use "hosts" for map "hosts.byname"
Use "networks" for map "networks.byaddr"
Use "group" for map "group.byname"
Use "passwd" for map "passwd.byname"
[root@localhost ~]# ypcat -x
Use "ethers" for map "ethers.byname"
Use "aliases" for map "mail.aliases"
Use "services" for map "services.byname"
Use "protocols" for map "protocols.bynumber"
Use "hosts" for map "hosts.byname"
Use "networks" for map "networks.byaddr"
Use "group" for map "group.byname"
Use "passwd" for map "passwd.byname"

 

有NIS的RHCE的课程图文讲解,请大家关注"RHCE全程学习笔记"哦

大家一起交流学习  一起进步




     本文转自 wqmsl 51CTO博客,原文链接:http://blog.51cto.com/wqmsl/307942,如需转载请自行联系原作者


版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
开发与运维
使用钉钉扫一扫加入圈子
+ 订阅

集结各类场景实战经验,助你开发运维畅行无忧

其他文章