码迷,mamicode.com
首页 > 其他好文 > 详细

nfs共享服务搭建

时间:2017-12-13 00:13:08      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:export   脚本   bsp   监听   unknown   rgs   sync   停止   oca   

[root@zhaoli Desktop]# uname -r
2.6.32-431.el6.x86_64
[root@zhaoli Desktop]# uname -m
x86_64

查看客户端软件是否安装(环境准备)
1、服务端(server服务端)ip:192.168.2.68
[root@zhaoli Desktop]# rpm -aq nfs-utils portmap rpcbind   客户端来查看是否安装
nfs-utils-1.2.3-39.el6.x86_64
rpcbind-0.2.0-11.el6.x86_64
[root@zhaoli Desktop]# /etc/init.d/rpcbind start  利用脚本启动或者停止服务
[root@zhaoli Desktop]# /etc/init.d/rpcbind stop
Stopping rpcbind:                                          [  OK  ]
[root@zhaoli Desktop]# /etc/init.d/rpcbind start
Starting rpcbind:                                          [  OK  ]
[root@zhaoli Desktop]# ps -ef|grep rpc   查看监听端口号
rpcuser    1912      1  0 10:08 ?        00:00:00 rpc.statd
rpc        6585      1  0 14:01 ?        00:00:00 rpcbind
root       6616   3128  0 14:03 pts/0    00:00:00 grep rpc

[root@zhaoli data]# vim /etc/exports 
[root@zhaoli data]# cat /etc/exports 
#shared data for bbs zhaoli at 20171212  注释行
/data 192.168.2.65/(rw,sync)  写上共享的目录,ip或者网段,共享目录的权限

[root@zhaoli Desktop]# /etc/init.d/rpcbind status  查看服务状态,运行中
rpcbind (pid  6585) is running...
[root@zhaoli Desktop]# rpcinfo -p localhost 查看房源
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
[root@zhaoli Desktop]# /etc/init.d/nfs start  启动nfs服务
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
[root@zhaoli Desktop]# chkconfig nfs on   设置开机自启动
[root@zhaoli Desktop]# chkconfig rpcbind on

[root@zhaoli Desktop]# chkconfig --list nfs  查看服务状态
nfs            	0:off	1:off	2:on	3:on	4:on	5:on	6:off
[root@zhaoli Desktop]# chkconfig --list rpcbind 
rpcbind        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
[root@xiaozhao data]# showmount -e localhost
如果有错误
# showmount -e localhost 报错: 
clnt_create:RPC:Unknown host 
解决: 
# /etc/init.d/rpcsvrgssd status 
rpc.svrgssd is stopped 
# /etc/init.d/rpcsvrgssd start 
# /etc/init.d/nfs restart
=============================================================================
2、客户端(client客户端)ip:192.168.2.65
查看服务端软件是否安装
[root@xiaozhao Desktop]# rpm -aq nfs-utils portmap rpcbind
nfs-utils-1.2.3-39.el6.x86_64
rpcbind-0.2.0-11.el6.x86_64
[root@xiaozhao Desktop]# /etc/init.d/rpcbind start  只需要启动bind服务
[root@xiaozhao Desktop]# /etc/init.d/rpcbind status  查看服务状态
rpcbind (pid  1740) is running...   运行中
[root@xiaozhao Desktop]# chkconfig rpcbind on  开机自启动
[root@xiaozhao Desktop]# chkconfig --list rpcbind  
rpcbind        	0:off	1:off	2:on	3:on	4:on	5:on	6:off
 [root@xiaozhao data]# showmount -e 192.168.2.68  查看服务端的服务是启动的
Export list for 192.168.2.68:
/data 192.168.2.65/

[root@xiaozhao data]# /etc/init.d/nfs reload   重启服务
[root@xiaozhao data]# showmount -e localhost
[root@xiaozhao ~]# mount -t nfs 192.168.2.68:/data /mnt/  手动挂载到mnt共享目录下
[root@xiaozhao mnt]# echo "mount -t nfs 192.168.2.68:/data /mnt" >>/etc/rc.local 开启自启动
如果客户端没有删除写的权限,就在服务端给data目录授权

  

 

nfs共享服务搭建

标签:export   脚本   bsp   监听   unknown   rgs   sync   停止   oca   

原文地址:http://www.cnblogs.com/zhaoyuen/p/8030129.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!