博客
关于我
NIS服务器的配置过程
阅读量:794 次
发布时间: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,如需转载请自行联系原作者

你可能感兴趣的文章
new 一个button 然后dispose,最后这个button是null吗???
查看>>
next项目部署到服务器pm2进程守护
查看>>
nexus上传jar
查看>>
Nexus指南中的更新强调集成和透明度的重要性
查看>>
Nexus指南已经发布
查看>>
NFinal学习笔记 02—NFinalBuild
查看>>
NFS
查看>>
NFS Server及Client配置与挂载详解
查看>>
NFS 服务配置篇
查看>>
NFS共享文件系统搭建
查看>>
nfs复习
查看>>
NFS安装配置
查看>>
NFS服务器配置-服务启动与停止
查看>>
NFS的安装以及windows/linux挂载linux网络文件系统NFS
查看>>
NFS的常用挂载参数
查看>>
NFS网络文件系统
查看>>
NFS远程目录挂载
查看>>
nft文件传输_利用remoting实现文件传输-.NET教程,远程及网络应用
查看>>
NFV商用可行新华三vBRAS方案实践验证
查看>>
ng build --aot --prod生成文件报错
查看>>