设为首页 收藏本站
查看: 543|回复: 0

[经验分享] NFS网络文件服务快速部署

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2015-9-28 10:03:38 | 显示全部楼层 |阅读模式
服务器IP地址规划:
NFS服务端IP地址:192.168.10.106
NFS客户端IP地址: 192.168.10.183
一、NFS服务端部署:
[iyunv@oldboy ~]# hostname
nfsserver
[iyunv@oldboy ~]# logout
[oldboy@oldboy ~]$
[oldboy@oldboy ~]$ sudo su -
[iyunv@nfsserver ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
[iyunv@nfsserver ~]# uname -r
2.6.32-431.el6.x86_64
[iyunv@nfsserver ~]# uname -m
x86_64
[iyunv@nfsserver ~]# rpm -qa  nfs-utils portmap rpcbind
[iyunv@nfsserver ~]# yum -y install nfs-utils portmap rpcbind
[iyunv@nfsserver ~]# rpm -qa nfs-utils portmap rpcbind
rpcbind-0.2.0-11.el6.x86_64
nfs-utils-1.2.3-64.el6.x86_64
[iyunv@nfsserver ~]# /etc/init.d/rpcbind start
Starting rpcbind:                                          [  OK  ]
[iyunv@nfsserver ~]# ps -ef|grep rpcbind
rpc        3674      1  0 14:27 ?        00:00:00 rpcbind
root       3678   3460  0 14:27 pts/0    00:00:00 grep --color rpcbind
[iyunv@nfsserver ~]# /etc/init.d/rpcbind status
rpcbind (pid  3674) is running...
[iyunv@nfsserver ~]# 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
[iyunv@nfsserver ~]# /etc/init.d/rpcbind stop
Stopping rpcbind:                                          [  OK  ]
[iyunv@nfsserver ~]# rpcinfo -p localhost
rpcinfo: can't contact portmapper: RPC: Remote system error - Connection refused
[iyunv@nfsserver ~]#
[iyunv@nfsserver ~]# /etc/init.d/rpcbind start
Starting rpcbind:                                          [  OK  ]
[iyunv@nfsserver ~]# /etc/init.d/nfs start
Starting NFS services:                                     [  OK  ]
Starting NFS quotas:                                       [  OK  ]
Starting NFS mountd:                                       [  OK  ]
Starting NFS daemon:                                       [  OK  ]
Starting RPC idmapd:                                       [  OK  ]
[iyunv@nfsserver ~]# 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
    100011    1   udp    875  rquotad
    100011    2   udp    875  rquotad
    100011    1   tcp    875  rquotad
    100011    2   tcp    875  rquotad
    100005    1   udp  49747  mountd
    100005    1   tcp   4876  mountd
    100005    2   udp  38193  mountd
    100005    2   tcp  64733  mountd
    100005    3   udp  33538  mountd
    100005    3   tcp  49065  mountd
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    2   tcp   2049  nfs_acl
    100227    3   tcp   2049  nfs_acl
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100227    2   udp   2049  nfs_acl
    100227    3   udp   2049  nfs_acl
    100021    1   udp  53540  nlockmgr
    100021    3   udp  53540  nlockmgr
    100021    4   udp  53540  nlockmgr
    100021    1   tcp  42422  nlockmgr
    100021    3   tcp  42422  nlockmgr
    100021    4   tcp  42422  nlockmgr
[iyunv@nfsserver ~]#
[iyunv@nfsserver ~]# chkconfig nfs on
[iyunv@nfsserver ~]# chkconfig rpcbind on
[iyunv@nfsserver ~]# chkconfig --list nfs
nfs             0:off   1:off   2:on    3:on    4:on    5:on    6:off
[iyunv@nfsserver ~]# chkconfig --list rpcbind
rpcbind         0:off   1:off   2:on    3:on    4:on    5:on    6:off
[iyunv@nfsserver ~]# ll /etc/exports
-rw-r--r--. 1 root root 0 Jan 12  2010 /etc/exports
[iyunv@nfsserver ~]# ll /data
total 4
-rw-r--r-- 1 root root    0 Aug 27 00:05 a.txt
-rw-r--r-- 1 root root    0 Aug 27 00:09 b.txt
drwxr-xr-x 2 root root 4096 Sep  1 22:06 oldboy
[iyunv@nfsserver ~]# cat >>/etc/exports>>EOF
#shared /data for 192.168.10.0/24
/data 192.168.10.0/24(rw,sync)
EOF                                                              
[iyunv@nfsserver ~]# cat /etc/exports
#shared /data for 192.168.10.0/24
/data 192.168.10.0/24(rw,sync)
[iyunv@nfsserver ~]# /etc/init.d/nfs reload
[iyunv@nfsserver ~]# showmount -e localhost
Export list for localhost:
/data 192.168.10.0/24
[iyunv@nfsserver ~]# ls -ld /data
drwxr-xr-x. 3 root root 4096 Sep  1 21:51 /data
[iyunv@nfsserver ~]# chmod 777 /data
[iyunv@nfsserver ~]# ll /data
total 4
-rw-r--r-- 1 root      root         0 Aug 27 00:05 a.txt
-rw-r--r-- 1 root      root         0 Aug 27 00:09 b.txt
drwxr-xr-x 2 root      root      4096 Sep  1 22:06 oldboy
-rw-r--r-- 1 nfsnobody nfsnobody    0 Sep 25 15:39 test.log
[iyunv@nfsserver ~]# ls -ld /data   
drwxrwxrwx. 3 root root 4096 Sep 25 15:39 /data
[iyunv@nfsserver ~]# chown -R nfsnobody:nfsnobody /data
[iyunv@nfsserver ~]# ll /data
total 4
-rw-r--r-- 1 nfsnobody nfsnobody    0 Aug 27 00:05 a.txt
-rw-r--r-- 1 nfsnobody nfsnobody    0 Aug 27 00:09 b.txt
drwxr-xr-x 2 nfsnobody nfsnobody 4096 Sep  1 22:06 oldboy
二、NFS客户端部署:
Last login: Fri Sep 25 13:22:51 2015 from 192.168.10.113
[oldboy@clientserver ~]$ sudo su -
[iyunv@clientserver ~]# rpm -qa  nfs-utils portmap rpcbind
[iyunv@clientserver ~]# yum -y install nfs-utils portmap rpcbind
[iyunv@clientserver ~]# rpm -qa nfs-utils portmap rpcbind
rpcbind-0.2.0-11.el6.x86_64
nfs-utils-1.2.3-64.el6.x86_64
[iyunv@clientserver ~]# /etc/init.d/rpcbind start
Starting rpcbind:                                          [  OK  ]
[iyunv@clientserver ~]# /etc/init.d/rpcbind status
rpcbind (pid  27339) is running...
[iyunv@clientserver ~]# chkconfig rpcbind on
[iyunv@clientserver ~]# chkconfig --list rpcbind
rpcbind         0:off   1:off   2:on    3:on    4:on    5:on    6:off
[iyunv@clientserver ~]# showmount -e 192.168.10.106
Export list for 192.168.10.106:
/data 192.168.10.0/24
[iyunv@clientserver ~]# mount -t nfs 192.168.10.106:/data /mnt
[iyunv@clientserver ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             7.7G  2.1G  5.3G  28% /
tmpfs                 491M     0  491M   0% /dev/shm
/dev/sda1             194M   29M  155M  16% /boot
192.168.10.106:/data  7.7G  2.4G  5.0G  32% /mnt
[iyunv@clientserver ~]# cd /mnt/
[iyunv@clientserver mnt]# ll
total 4
-rw-r--r-- 1 root root    0 Aug 27 00:05 a.txt
-rw-r--r-- 1 root root    0 Aug 27 00:09 b.txt
drwxr-xr-x 2 root root 4096 Sep  1 22:06 oldboy
[iyunv@clientserver mnt]# touch test.log
[iyunv@clientserver mnt]# ll
total 4
-rw-r--r-- 1 root      root         0 Aug 27 00:05 a.txt
-rw-r--r-- 1 root      root         0 Aug 27 00:09 b.txt
drwxr-xr-x 2 root      root      4096 Sep  1 22:06 oldboy
-rw-r--r-- 1 nfsnobody nfsnobody    0 Sep 25 15:39 test.log



运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-119841-1-1.html 上篇帖子: CentOS6.5 NFS 服务搭建 下篇帖子: 编译linux-4.2.1+busybox-1.23.2构建简单系统 网络
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表