Linux下如何架设NIS服务器

84 篇文章 0 订阅
69 篇文章 0 订阅

今天小编将为大家介绍Linux下NIS服务器的架设,对于Linux下NIS服务器的架设相信很多小伙伴们都不是非常的了解,
那么我们现在就一起跟小编去看看Linux下如何架设NIS服务器的内容。

实验环境:AS4最小化安装
实验目标:架设NIS服务器
大家好!
这次我们来学习Linux系统中的NIS服务器的配置。主要目标能够使用nis服务器中的账号登陆nis客户机
NIS服务器IP192.168.1.10 hostname = crazylinux.nistest 该服务器下面有mike john2个账号
NIS客户机IP192.168.1.20
NIS初始配置:
首先配置NIS服务器:
1.检查服务器是否安装了下列包:portmap、ypserv、ypbind、yp-tools
ypserv在第一张安装光盘中,
[root@crazylinux cdrom]# mount /media/cdrom/ 挂载
[root@crazylinux /]# rpm -ivh /media/cdrom/RedHat/RPMS/ypserv-2.13-5.i386.rpm
warning: /media/cdrom/RedHat/RPMS/ypserv-2.13-5.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
Preparing… ########################################### [100%]
1:ypserv ########################################### [100%]
[root@crazylinux /]# rpm -qa | grep portmap
portmap-4.0-63
[root@crazylinux /]# rpm -qa | grep ^yp
yp-tools-2.8-7
ypserv-2.13-5
ypbind-1.17.2-3
2.设置time和time-udp服务的启动状态
[root@crazylinux /]# chkconfig --list | grep time 默认设置
time-udp: off
daytime-udp: off
daytime: off
time: off
[root@crazylinux /]# chkconfig time on
[root@crazylinux /]# chkconfig time-udp on
[root@crazylinux /]# service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
3.建立NIS的域名
[root@crazylinux /]# nisdomainname nistest
[root@crazylinux /]# cat /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
/bin/nisdomainname nistest 添加这行使之开机运行
修改/etc/sysconfig/network文件,增加此行:NISDOMAIN=nistest
4.设置ypserv服务的配置文件
把下面这些添加到/etc/ypserv.conf最后
127.0.0.0/255.255.255.0 : * : * : none
192.168.1.0/255.255.255.0 : * : * : none

  •                   : *       : *                : deny
    

[root@ crazylinux /]# touch /etc/netgroup
[root@crazylinux /]#hostname crazylinux.nistest
[root@crazylinux /]# cat /var/yp/securenets 需要自己建立
host 127.0.0.1
255.255.255.0 192.168.1.0
5.启动相关服务:
#service portmap restart
[root@crazylinux /]# service portmap status
portmap (pid 1649) is running…
[root@crazylinux /]# service ypserv start
Starting YP server services: [ OK ]
[root@crazylinux /]# service yppasswdd start
Starting YP passwd service: [ OK ]
[root@crazylinux /]# chkconfig --level 35 ypserv on
[root@crazylinux /]# chkconfig --level 35 yppasswdd on 设置开机自动运行
6.初始化NIS数据库:
[root@crazylinux /]# useradd user1
[root@crazylinux /]# passwd user1
#/usr/lib/yp/ypinit –m
此时会询问是否有其他NIS服务器,如果没有,则可以直接按Ctrl+D结束,并重启ypserv服务。
#service ypserv restart
#service yppasswdd restart
同时检查进程是否正常运行以及信息是否正确:ps –aux | grep yp tail /var/log/message
以下进行客户端上的配置:
1.确认安装以下包: ypbind、yp-tools默认安装了的
2.设置hosts文件
[root@localhost ~]# cat /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.1.10 crazylinux NIS服务器的主机名
3.建立NIS域名
[root@crazylinux /]# nisdomainname nistest
[root@crazylinux /]# cat /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
/bin/nisdomainname nistest 添加这行使之开机运行
修改/etc/sysconfig/network文件,增加此行:NISDOMAIN=nistest
4.设置yp.conf
[root@localhost ~]# cat /etc/yp.conf

generated by /sbin/dhclient-script

domain domain.org broadcast
domain nistest 添加这句
ypserver crazylinux.nistest
在/etc/passwd最下面添加
+::::::
5.设置nsswitch.conf
vi /etc/nsswitch.conf 修改为这样
passwd: files nis nisplus
shadow: files nis nisplus
group: files nis nisplus
#hosts: db files nisplus nis dns
hosts: files nis dns
6.启动ypbind服务程序
[root@localhost ~]# service portmap status
portmap (pid 1683) is running…
[root@localhost ~]# service ypbind start
Binding to the NIS domain: [ OK ]
Listening for an NIS domain server…
在NIS服务器中输出NFS共享目录
在nis服务器上
[root@localhost ~]# vi /etc/exports 添加
/home 192.168.1.0/24(rw,async,np_root_squash)
[root@localhost ~]#service nfs start
在NIS客户机上
[root@localhost ~]#vi /etc/fstab
Crazylinux.nistest:/home/ /home nfs defaults 0 0
现在在客户机中用服务器里面的帐号登陆 嘿嘿 OK
速维网络!!!
需要服务器可以扣俺!!
tel: 137 1307 8760
上文中介绍的Linux下如何架设NIS服务器的内容你学会了吗?
linux系统还有更多丰富的功能和特性,可以帮助我们提高工作学习效率,有待朋友们多多发掘。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值