在CentOS系统中安装NIS服务器的方法
程序员文章站
2022-04-06 11:38:47
这篇文章主要介绍了在CentOS系统中安装NIS服务器的方法,同样适用于RedHat系的其他Linux系统,需要的朋友可以参考下... 15-07-06...
第一步 安装 nis 服务器
复制代码
代码如下:[root@s ~]# yum install ypserv yp-tools rpcbind
这样就安装完成了,是不是很 easy
我这里的环境是:
nis 服务器 ip: 192.168.100.254 主机名: www.e2fsck.org
nis 客户端 ip: 192.168.100.240 主机名: site.e2fsck.org
第二步 配置 nis 服务器
1. 增加 nisdomain
复制代码
代码如下:[root@s ~]# vi /etc/sysconfig/network</p>
<p>nisdomain=e2fsck #这里的名字要和 hostname 一样
2. 启动 nis 服务
复制代码
代码如下:[root@s ~]# service rpcbind start #如果是 centos 5 应该是 service portmap start</p>
<p>[root@s ~]# service ypserv start
3. 限制ip范围
复制代码
代码如下:[root@s ~]# vi /var/yp/securenets</p>
<p>255.255.255.255 127.0.0.1
255.255.255.0 192.168.100.0
255.255.255.0 192.168.100.0
4. 添加测试用户
复制代码
代码如下:[root@s ~]# useradd e2fsck</p>
<p>[root@s ~]# passwd e2fsck
5. 建立数据库
复制代码
代码如下:[root@s ~]# /usr/lib/yp/ypinit -m</p>
<p>
at this point, we have to construct a list of the hosts which will run nis
servers. www.e2fsck.org 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 .
next host to add: www.e2fsck.org
next host to add: <span id="comm">这里 ctrl + d 这里从服务器的地址,我们这里不用</span>
the current list of nis servers looks like this:
www.e2fsck.org
is this correct? [y/n: y] <span id="comm">y</span>
we need a few minutes to build the databases...
building /var/yp/e2fsck/ypservers...
running /var/yp/makefile...
gmake[1]: entering directory `/var/yp/e2fsck'
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/e2fsck'
www.e2fsck.org has been set up as a nis master server.
now you can run ypinit -s www.e2fsck.org on all slave server.
at this point, we have to construct a list of the hosts which will run nis
servers. www.e2fsck.org 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 .
next host to add: www.e2fsck.org
next host to add: <span id="comm">这里 ctrl + d 这里从服务器的地址,我们这里不用</span>
the current list of nis servers looks like this:
www.e2fsck.org
is this correct? [y/n: y] <span id="comm">y</span>
we need a few minutes to build the databases...
building /var/yp/e2fsck/ypservers...
running /var/yp/makefile...
gmake[1]: entering directory `/var/yp/e2fsck'
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/e2fsck'
www.e2fsck.org has been set up as a nis master server.
now you can run ypinit -s www.e2fsck.org on all slave server.
6. 启动
复制代码
代码如下:[root@s ~]# service yppasswdd start
第三步 客户端配置
1. 下载安装包
复制代码
代码如下:[root@c2 ~]# yum install ypbind rpcbind
2. 图形方式认证
复制代码
代码如下:[root@c2 ~]# authconfig-tui</p>
<p>
authconfig-tui - (c) 1999-2005 red hat, inc.
┌───────┤ authentication configuration ├────—───|
│ user information authentication │
│ [ ] cache information [*] use md5 passwords │
│ [ ] use hesiod [*] use shadow passwords │
│ [ ] use ldap [ ] use ldap authentication │
│ [*] use nis [ ] use kerberos │
│ [ ] use winbind [ ] use smb authentication │
│ [ ] use winbind authentication │
│ [ ] local authorization is sufficient │
│ │
│ │ cancel │ │ next │ │
│
│ │
└─────────────────────────────────
authconfig-tui - (c) 1999-2005 red hat, inc.
┌───────┤ authentication configuration ├────—───|
│ user information authentication │
│ [ ] cache information [*] use md5 passwords │
│ [ ] use hesiod [*] use shadow passwords │
│ [ ] use ldap [ ] use ldap authentication │
│ [*] use nis [ ] use kerberos │
│ [ ] use winbind [ ] use smb authentication │
│ [ ] use winbind authentication │
│ [ ] local authorization is sufficient │
│ │
│ │ cancel │ │ next │ │
│
│ │
└─────────────────────────────────
这里选择 use nis 然后下一步,domain写 e2fsck ;server 写ip 192.168.100.254 即可。
3. ssh测试
ssh 连接 192.168.100.240 用上面创建的 e2fsck 帐号查看是否登录。
复制代码
代码如下:login as: e2fsck
e2fsck@www.e2fsck.org’s password:
could not chdir to home directory /home/e2fsck: no such file or directory
-bash-3.2$
e2fsck@www.e2fsck.org’s password:
could not chdir to home directory /home/e2fsck: no such file or directory
-bash-3.2$
推荐阅读
-
CentOS 7.x安装部署Memcached服务器的详细方法
-
centos 7中设置tomcat 7为系统服务的方法详解
-
在Linux系统中获得文件所在目录名的方法
-
CentOS6.5服务器环境安装VPN的方法
-
在sqlserver2005中安装sql server 2000的示例数据库northwind的方法
-
无法在com+ 目录中安装和配置程序集 错误:-2146233087的解决方法[已测]
-
在Linux操作系统中修改环境变量的方法
-
centos6.5中rpm包安装mysql5.7初始化出错的解决方法
-
详解Linux系统中安装配置Samba服务器的步骤
-
在Linux系统中安装web端的远程连接工具Wetty