NIS服务器架设教程
我们定义NIS服务器IP192.168.1.10 hostname = liflinux.nistest 该服务器下面有test个账号
NIS客户机IP192.168.1.20
NIS初始配置:
首先配置NIS服务器:
1.检查服务器是否安装了下列包:portmap、ypserv、ypbind、yp-tools
ypserv在第一张安装光盘中,
[root@liflinux cdrom]# mount /media/cdrom/ 挂载
[root@liflinux /]# 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@liflinux /]# rpm -qa | grep portmap
portmap-4.0-63
[root@liflinux /]# rpm -qa | grep ^yp
yp-tools-2.8-7
ypserv-2.13-5
ypbind-1.17.2-3
2.设置time和time-udp服务的启动状态
[root@liflinux /]# chkconfig --list | grep time 默认设置
time-udp: off
daytime-udp: off
daytime: off
time: off
[root@liflinux /]# chkconfig time on
[root@liflinux /]# chkconfig time-udp on
[root@liflinux /]# service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
3.建立NIS的域名
[root@liflinux /]# nisdomainname nistest
[root@liflinux /]# 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@ liflinux /]# touch /etc/netgroup
[root@liflinux /]#hostname liflinux.nistest
[root@liflinux /]# cat /var/yp/securenets 需要自己建立
host 127.0.0.1
255.255.255.0 192.168.1.0
5.启动相关服务:
#service portmap restart
[root@liflinux /]# service portmap status
portmap (pid 1649) is running...
[root@liflinux /]# service ypserv start
Starting YP server services: [ OK ]
[root@liflinux /]# service yppasswdd start
Starting YP passwd service: [ OK ]
[root@liflinux /]# chkconfig --level 35 ypserv on
[root@liflinux /]# chkconfig --level 35 yppasswdd on 设置开机自动运行
6.初始化NIS数据库:
[root@liflinux /]# useradd user1
[root@liflinux /]# 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 crliflinux NIS服务器的主机名
- 最新评论
