网络信息系统(NIS服务器)

分为两部分:
一、服务器端配置:
1.#检查包是否安装
[root@VMLINUX2 shell3]# rpm -qa | grep ypserv        
ypserv-2.19-3
2.安装包文件 serv-2.19-3.i386.rpm
[root@VMLINUX2 Server]# rpm -ivh ypserv-2.19-3.i386.rpm
warning: ypserv-2.19-3.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:ypserv                 ########################################### [100%]
3.添加域名
[root@VMLINUX2 ~]# vim /etc/sysconfig/network
---------------------------
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=VMLINUX2
NISDOMAIN=leiqin.com   添加的域名
---------------------------
4.允许所有的主机加入所有的域,map所有东西(none是指没有安全性):
[root@VMLINUX2 ~]# vim /etc/ypserv.conf
进入配置文件:把最后一行注释掉。
----------------------------------------------------------------
 *                        : *       : *                : none
----------------------------------------------------------------
5. 配置所共享的文件
[root@VMLINUX2 ~]# vim /var/yp/Makefile
修改后结果:就共享前3项,在加上一个auto.home
-------------------------------------
all:  passwd group hosts auto.home
------------------------------------- 
 重启服务:
 [root@VMLINUX2 ~]# service ypserv restart 
 [root@VMLINUX2 ~]# service yppasswdd restart
 [root@VMLINUX2 ~]# service portmap restart
 使电脑重启后该服务还能够继续再生效
 [root@VMLINUX2 ~]# chkconfig ypserv on
 [root@VMLINUX2 ~]# chkconfig yppasswdd on
 [root@VMLINUX2 ~]# chkconfig portmap on
                   
6.初始化过程,生成NIS数据库,使发布的数据库生效。
[root@VMLINUX2 ~]# /usr/lib/yp/ypinit -m
   ----------------------------------------------------------------------
   At this point, we have to construct a list of the hosts which will run NIS
servers.  VMLINUX2 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:  VMLINUX2
        next host to add:  
The current list of NIS servers looks like this:
VMLINUX2
(ctrl+d)                  
Is this correct?  [y/n: y]  y       
We need a few minutes to build the databases...
Building /var/yp/uplooking/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/uplooking'
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
gmake[1]: Leaving directory `/var/yp/uplooking'
VMLINUX2 has been set up as a NIS master server.
Now you can run ypinit -s VMLINUX2 on all slave server.
---------------------------------------------------------
添加账户
[root@VMLINUX2 home]# mkdir /rhome        #创建账户主目录
[root@VMLINUX2 home]# useradd -Db /rhome  #使创建的用户默认在rhome下
[root@VMLINUX2 home]# useradd rblues      #创建用户
[root@VMLINUX2 home]# passwd rblues       #创建密码
Changing password for user rblues.
New UNIX password:
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
7.发布用户的主目录:
vim /etc/exports
        /rhome  *(rw,sync)
8.使/rhome目录下的用户能够自动挂载:
vim /etc/auto.home
        *       -rw,soft,intr   192.168.0.182:/rhome/&
重启服务:
service ypserv restart
service yppasswdd restart
service portmap  restart
service nfs     restart
/usr/lib/yp/ypinit -m
二、客户端配置
1.检查包装没装:一共2个包。
  rpm -qa | grep yp
-------------------
  ypbind-1.19-8.e15
  yp-tools-2.9-0.1
-------------------
2.加入NIS域
authconfig-tui
把NIS项选中:用户信息NIS域
下一步:填写
 ------------
 Leiqin.com
 192.168.0.182
 ------------
确定退出。
3.[root@VMLINUX2 ~]# vim /etc/yp.conf   (查看配置结果)
  domain uplooking server 192.168.0.182
4.测试通没通:
 [root@VMLINUX2 etc]# yptest
5.设置网络账号主目录:
mkdir /rhome
vim /etc/auto.master
        /rhome  nis:auto.home
service autofs restart
6.设置优先顺序:
vi /etc/nsswitch.conf      
passwd:     files nis
        shadow:     files nis
        group:      files nis
[root@VMLINUX2 etc]# su - leiqin3
注意:在服务端不要重启autofs服务。

你可能感兴趣的:(职场,休闲,NIS服务器)