博客
关于我
NIS服务器的配置过程
阅读量:792 次
发布时间:2023-02-16

本文共 5794 字,大约阅读时间需要 19 分钟。

                         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客户端主机的安全访问 
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,如需转载请自行联系原作者

你可能感兴趣的文章
nginx实现二级域名转发
查看>>
Nginx实现动静分离
查看>>
Nginx实现反向代理负载均衡
查看>>
nginx实现负载均衡
查看>>
Nginx将https重定向为http进行访问的配置(附Demo)
查看>>
nginx工作笔记004---配置https_ssl证书_视频服务器接口等
查看>>
nginx常用命令及简单配置
查看>>
Nginx常用屏蔽规则,让网站更安全
查看>>
nginx开机启动脚本
查看>>
nginx异常:the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx/conf
查看>>
nginx总结及使用Docker创建nginx教程
查看>>
nginx报错:the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:128
查看>>
nginx报错:the “ssl“ parameter requires ngx_http_ssl_module in usrlocalnginxconfnginx.conf128
查看>>
nginx日志分割并定期删除
查看>>
Nginx日志分析系统---ElasticStack(ELK)工作笔记001
查看>>
Nginx映射本地json文件,配置解决浏览器跨域问题,提供前端get请求模拟数据
查看>>
Nginx映射本地静态资源时,浏览器提示跨域问题解决
查看>>
nginx最最最详细教程来了
查看>>
Nginx服务器---正向代理
查看>>
Nginx服务器上安装SSL证书
查看>>