腾讯云 CentOS6.2 64位 NFS 安装

今天给腾讯云服务器( CentOS6.2 64位)配置  NFS 遇到了各种坑,各种不靠谱的文档

所以印证了一句话,一篇靠谱的文档是成功的关键。所以自己写一篇文章来帮助可能遇到这个问题的朋友。呵呵


(1)遇到第一个问题 portmap 名称错误

 在网上搜到一个nfs安装文档,按照文档一步一步装

1.1查询机器是否安装了nfs

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. [root@VM_72_88_centos ~]# rpm -qa | grep nfs  
  2. nfs-utils-1.2.3-39.el6.x86_64  
  3. nfs-utils-lib-1.1.5-4.el6.x86_64  
ok,这台机器已经安装了nfs

1.2 在检查 portmap

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. [root@VM_72_88_centos ~]# rpm -qa | grep portmap  
没有查到,所以就安装

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. [root@VM_75_115_centos ]# yum install portmap  
  2. Loaded plugins: fastestmirror  
  3. Loading mirror speeds from cached hostfile  
  4. Setting up Install Process  
  5. Resolving Dependencies  
  6. --> Running transaction check  
  7. ---> Package rpcbind.x86_64 0:0.2.0-8.el6 will be updated  
  8. ---> Package rpcbind.x86_64 0:0.2.0-11.el6 will be an update  
  9. --> Finished Dependency Resolution  
  10.   
  11. Dependencies Resolved  
  12.   
  13. ===============================================================================================================================================================================================  
  14.  Package                                      Arch                                        Version                                              Repository                                 Size  
  15. ===============================================================================================================================================================================================  
  16. Updating:  
  17.  rpcbind                                      x86_64                                      0.2.0-11.el6                                         base                                       51 k  
  18.   
  19. Transaction Summary  
  20. ===============================================================================================================================================================================================  
  21. Upgrade       1 Package(s)  
  22.   
  23. Total download size: 51 k  
  24. Is this ok [y/N]: y  
  25. Downloading Packages:  
  26. rpcbind-0.2.0-11.el6.x86_64.rpm                                                                                                                                         |  51 kB     00:00       
  27. Running rpm_check_debug  
  28. Running Transaction Test  
  29. Transaction Test Succeeded  
  30. Running Transaction  
  31.   Updating   : rpcbind-0.2.0-11.el6.x86_64                                                                                                                                                 1/2   
  32.   Cleanup    : rpcbind-0.2.0-8.el6.x86_64                                                                                                                                                  2/2   
  33.   
  34. Updated:  
  35.   rpcbind.x86_64 0:0.2.0-11.el6                                                                                                                                                                  
  36.   
  37. Complete!  

1.3 安装完成,所以按照以前的经验,输入命令启动服务

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. [root@VM_75_115_centos]# service portmap start  
  2. portmap: unrecognized service  
我擦,怎么没有? 然后我就各种搜索,为什么portmap服务没启动,搜了半天搜到了一个文档,有如下解释:
CentOS6.2 6.2变更了portmap服务为rpcbind,在使用nfs时这点与centos5不同,下面配置一个nfs系统,用来使局域网内的所有用户均可访问该目录,可将该目录配置成yum源,供内网机器安装软件。

唉,原来在 6.2中 portmap 服务已经变更为 rpcbind

so,按照新命令启动服务

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. [root@VM_75_115_centos]# service rpcbind start  
ok,服务正常启动。

1.4 开始配置 nfs的服务  服务端(192.168.0.13)

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. [root@VM_72_88_centos ~]# vi /etc/exports  
添加如下文字

/data/abc/bcd/ 192.168.0.14(rw,no_root_squash,no_all_squash,sync)

保存退出

启动nfs服务

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. [root@VM_72_88_centos ~]# service nfs start  
ok,服务正常启动

1.5 去客户端(192.168.0.14)配置东西


第一步,查看此台服务器是否能连接nfs服务器

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. [root@VM_75_115_centos ]# showmount -e 192.168.0.13  
  2. Export list for 192.168.0.13:  
  3. /data/abc/bcd 192.168.0.14  

ok,说明 客户端的机器(192.168.0.14)能链接服务端(192.168.0.13)

第二步:执行挂载命令

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. mount -t nfs 192.168.0.13:/data/abc/bcd /data/abc/bcd   


会遇到这个问题 (问题1)

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. mount.nfs: rpc.statd is not running but is required for remote locking.  
  2. mount.nfs: Either use '-o nolock' to keep locks local, or start statd.  
  3. mount.nfs: an incorrect mount option was specified  


和这个问题 (问题2)

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. mount.nfs: requested NFS version or transport protocol is not supported  


靠谱的办法是把服务端的3个服务都重启一遍

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. service nfslock restart  
  2. service rpcbind restart  
  3. service nfs restart  

现在运行命令,就能挂在正确 

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. mount -t nfs 192.168.0.13:/data/abc/bcd /data/abc/bcd   


然后再给出一个解除绑定的方法

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. umount -t nfs 192.168.0.13:/data/abc/bcd /data/abc/bcd   


所有配置都完成。


遇到问题1,的时候,搜了各种文档百度,谷歌。有人说需要修改 /etc/hosts.allow 和 /etc/hosts.allow 文件,所有就按照文档修改了,无果。

遇到问题2,的时候,也是搜了各种文档,说是内核错误,我擦,不会搞内核啊。

后来搜到文章说 nfslocd 服务需要启动,我就启动了。然后奇迹般的能挂在正确。

所以,建议读者把 三个服务都重启一遍最靠谱。不用修改内核和 各种文件


[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. service nfslock restart  
  2. service rpcbind restart  
  3. service nfs restart  


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

炼丹狮

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值