Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3320730
  • 博文数量: 631
  • 博客积分: 10716
  • 博客等级: 上将
  • 技术积分: 8397
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-01 22:35
文章分类

全部博文(631)

文章存档

2020年(2)

2019年(22)

2018年(4)

2017年(37)

2016年(22)

2015年(1)

2013年(12)

2012年(20)

2011年(19)

2010年(20)

2009年(282)

2008年(190)

分类: LINUX

2008-08-02 16:38:01

我们来学习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
阅读(1675) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~