Liunx服务-NIS

  
   安装NSI服务器
*************************************************************************************************  
     1. 安装NIS服务器软件包
       
        NIS服务器软件包的名称是ypserv,系统默认是没有安装的,位于第1张光盘中。
 
               mount  /media/cdrom
               rpm -q portmap 
               cd /media/cdrom/RedHat/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.创建域名
                 nisdomainname lei
――――――――――――――――――――――――――――――――――――――――――――――――――
      3.启动nis服务
        
                 /etc/rc.d/init.d/ypserv start
                 /etc/rc.d/init.d/yppasswdd start   (作用是可以使客户端自己修改密码)
――――――――――――――――――――――――――――――――――――――――――――――――――
      4.创建新用户
        
                adduser qun
                passwd  qun
 
                Changing password for user qun.
                New UNIX password:
                Retype new UNIX password:
                passwd: all authentication tokens updated successfully.
――――――――――――――――――――――――――――――――――――――――――――――――――
      5.将用户映射到数据库里
   
            /usr/lib/yp/ypinit -m 
 
                  At this point, we have to construct a list of the hosts which will run NIS
            servers.  rhel4.benet.com 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:  rhel4.benet.com
                    next host to add:   (在此处按ctrl+D键)
            The current list of NIS servers looks like this:
            rhel4.benet.com
            Is this correct?  [y/n: y]  y   (在此处回答为“y”)
            We need a few minutes to build the databases...
            Building /var/yp/aa/ypservers...
            Running /var/yp/Makefile...
            gmake[1]: Entering directory `/var/yp/aa'
            Updating passwd.byname...
            Updating passwd.byuid...
            gmake[1]: Leaving directory `/var/yp/aa'
            rhel4.benet.com has been set up as a NIS master server.
            Now you can run ypinit -s rhel4.benet.com on all slave server.
―――――――――――――――――――――――――――――――――――――――――――――――――――   
      NIS服务器搭建完成
######################################################################################################
      NIS服务的应用
******************************************************************************************************
      1.在NIS服务器中输出nis共享目录
 
       NIS服务器主机中具有所有用户的本地账号,一次NIS服务器的文件系统中也为每个用户建有宿主目录,所有
       普通用户的宿主目录都在“/home”目录中,因此可以将“/home”作为NFS共享目录输出给所有的NIS客户。
 
              vi /etc/exports
      
            /home             *(async,rw,no_root_squash)
            
            ~
――――――――――――――――――――――――――――――――――――――――――――――――――――        
      2.启动服务
 
            /etc/rc.d/init.d/nfs start
――――――――――――――――――――――――――――――――――――――――――――――――――――
      3. 输出目录
                 
            exportfs
        
            /home         <world> 
――――――――――――――――――――――――――――――――――――――――――――――――――――
       客户端的配置
********************************************************************************************************
       1.修改主机名(如果两台主机的主机相同) 
            hostname    web.benet.com
     
            vi /etc/hosts
  
            # Do not remove the following line, or various programs
            # that require network functionality will fail.         
            127.0.0.1               web.benet.com web localhost.localdomain localhost
            172.16.3.68             rhel4.benet.com
    
            vi /etc/sysconfig/network
            NETWORKING=yes
            HOSTNAME=web.benet.com
            ~
――――――――――――――――――――――――――――――――――――――――――――――――――――
        2.将服务器上的/home目录挂载到客户机本地
            mount   rhel4.benet.com/home     /home
         
            vi /etc/fstab
  
           # This file is edited by fstab-sync - see 'man fstab-sync' for details
            LABEL=/                 /                     ext3    defaults        1 1
            LABEL=/boot             /boot                 ext3    defaults        1 2
            none                    /dev/pts              devpts  gid=5,mode=620  0 0
            none                    /dev/shm              tmpfs   defaults        0 0
            none                    /proc                 proc    defaults        0 0
            none                    /sys                  sysfs   defaults        0 0
            LABEL=SWAP-hda2         swap                  swap    defaults        0 0
            /dev/hdc                /media/cdrom          auto    pamconsole,exec,noauto,managed 0 0
            /dev/fd0                /media/floppy         auto    pamconsole,exec,noauto,managed 0 0
            rhel4.benet.com:/home   /home                 nfs     defaults        0 0 (添加此行内容)
――――――――――――――――――――――――――――――――――――--―――――――――――――――――        
        3.
            setup
   
            接下来选择第一项 Authentication configuration
            接下来选中 Use NIS
 
            在弹出的对话框中domain和server
 
 
           
           

你可能感兴趣的:(linux,职场,休闲)