PUTTY软件操作<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

login as: root
Sent username "root"
root@192.168.9.150's password:
Last login: Fri Apr  4 16:11:12 2008
安装winscp403setupintl软件,ypserv-2.13-5.i386.rpm托入到LINUX中的/ROOT目录中
 [root@localhost ~]# cd /root                                  进入/ROOT目录
[root@localhost ~]# ls                                      查看软件包
anaconda-ks.cfg  install.log         ypserv-2.13-5.i386.rpm

Desktop          install.log.syslog
[root@localhost ~]# rpm -ivh ypserv-2.13-5.i386.rpm              安装软件包,很快,一般只要几秒钟
warning: ypserv-2.13-5.i386.rpm: V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing...                ########################################### [100%]
   1:ypserv                 ########################################### [100%]
[root@localhost ~]# nisdomainname nis.benet.com     设置NIS域名      
[root@localhost ~]# adduser st01                             新建用户                    
[root@localhost ~]# passwd st01                              设置密码
Changing password for user st01.
New UNIX password:
BAD PASSWORD: it is too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]#
[root@localhost ~]# vi /etc/ypserv.conf                            可以不修改配置文件,我没有修改
[root@localhost ~]# service portmap start                 NIS服务需要PORTMAP服务的支持
Starting portmap:                                          [  OK  ]
[root@localhost ~]# service ypserv start                    NIS服务需要启动这个服务
Starting YP server services:                               [  OK  ]
[root@localhost ~]# service yppasswdd start                    NIS服务需要启动这个服务
Starting YP passwd service:                                [  OK  ]
[root@localhost ~]# /usr/lib/yp/ypinit –m                   初使化数据库

 

At this point, we have to construct a list of the hosts which will run <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />NIS
servers.  localhost.localdomain 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>.        CTRLD
        next host to add:  localhost.localdomain
        next host to add:
The current list of NIS servers looks like this:

 

localhost.localdomain

 

Is this correct?  [y/n: y]  y        Y
We need a few minutes to build the databases...
Building /var/yp/nis.benet.com/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/nis.benet.com'
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.benet.com'

 

localhost.localdomain has been set up as a NIS master server.

 

Now you can run ypinit -s localhost.localdomain on all slave server.

 

 

 

在客户机上的配置
[root@localhost ~]# rpm –qa |grep ypbind查看客户机上有无安装客户端软件,这里已经安装了
ypbind-1.17.2-3   这条命令运行的时间较才,大概有2分钟
[root@localhost ~]# nisdomainname nis.benet.com     设置域名             
[root@localhost ~]#hostname nis.benet.com                     主机名要和NIS域名一致
[root@localhost ~]#setup 用这个软件修改配置文件,我改了域名,服务器IP

或直接修改配置文件用这条命令vi //etc/yp.conf,这两种可以任选一种

[root@localhost ~]# service portmap start          NIS服务需要这个服务的支持
Starting portmap:                                          [  OK  ]
[root@localhost ~]# service ypbind restart                 NIS要启动这个服务   
Shutting down NIS services:                                [  OK  ]
Binding to the NIS domain:                                 [  OK  ]
[root@localhost ~]# service yppasswdd restart          NIS要启动这个服务
Stopping YP passwd service:                                [  OK  ]
Starting YP passwd service:                                [  OK  ]
 [root@localhost ~]# chkconfig --level 35 ypbind on         启动ypbind35
 [root@localhost ~]# su - st01
su: warning: cannot change directory to /home/st01: No such file or directory

-bash-3.00$因为本地没有服务器上的/HOME目录,所以有这样的反应

 

 

在服务器上配置文件共享
[root@localhost ~]# rpm -qa |grep nfs         查看有无NFS目录

nfs-utils-1.0.6-65.EL4 
[root@localhost ~]# chkconfig --level 35 nfs on
[root@localhost ~]# service portmap start          NFS需要先启动这个服务
Starting portmap:                                          [  OK  ]
[root@localhost ~]# service nfs start           启动NFS服务
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
[root@localhost ~]# vi /etc/exports  写出要共享的条目
/home       *(rw,sync)
~

 

 

[root@localhost ~]# exportfs –rv                导出目录
exporting *:/home
[root@localhost ~]# showmount –e            查看导出的目录
Export list for localhost.localdomain:
/home *

 

[root@localhost ~]# vi /etc/fstab

 

# This file is edited by fstab-sync - see 'man fstab-sync' for deta:
192.168.9.150:/home     /home                      nfs     defaults        0 0
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-sda2         swap                    swap    defaults        0 0
/dev/hdc                /media/cdrom            auto    pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0
/dev/fd0                /media/floppy           auto    pamconsole,fscontext=system_u:object_r:removable_t,exec,noauto,managed 0 0
~
~
其中的192.4168.150为服务器名称紧跟在后的:/HOME为共享目录,/HOME为本地挂载点,NFS为文件格式,其中的0 0 表示开机不做磁盘检查,如果是0 1则表示开机做磁盘检查,
0 0 只能用上面一排的键盘搞,不能用右边的数字搞

 

 

[root@localhost ~]# service portmap start                 在客户机上启动这个服务支持NFS
Starting portmap:                                          [  OK  ]
[root@localhost ~]# service nfs start                      只有启动NFS服务,才能挂载目录
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]

 

[root@localhost ~]# mount /home                      这条命令也很快,一般也只有23秒钟
[root@localhost ~]# su - st01
[st01@nis ~]$                                                  现在用户登录的显示是正常的

 

 

修改密码则需要TIME TIME-UDP这两个服务的支持,启动后要重启XINETD服务

CHKCONFIG TIME ON

CHKCONFIG YPSERV START

SERVICE XINETD START

VI /ETC/HOSTS 中添加一条记录