linux--nfs

1.安装nfs

网上学习NFS的安装,发现很多文章都说要用到portmap,但是在CentOS的官方软件源里面又找不到该软件包。
后来才知道portmap在CentOS 6上已经更名为rpcbind了。
默认rpcbind是已经安装的,该服务随系统启动时自动启动:
[root@centos-server ~]$ chkconfig rpcbind --list
rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off

若要重新安装,可以使用下面的命令:
[root@centos-server ~]$ yum install rpcbind

然后再安装nfs

yum install nfs-utils

2.查看是否已经安装:

rpm -qa|grep nfs

rpm -qa|grep rpcbind

3.启动nfs

service rpcbind start
service nfs start

4.修改配置文件:vi /etc/exports

/text 127.0.0.1(rw,sync,no_root_squash)

/text  要共享的目录

127.0.0.1  能访问共享目录的电脑的ip地址

rw  读写

sync 同步

no_root_squash  如果是root登录,则拥有root权限

5.修改完配置文件,需要使其生效:

exportfs -rv

6.这时就可以去另一台电脑上去挂载目录了(指定的ip地址,这里是127.0.0.1)

mount 127.0.0.1:/test/ /test-b/

7.要卸载掉 挂载目录时,先把/etc/exports 下的共享目录注释掉,

然后就可以 umount /test-b 了

原文地址:https://www.cnblogs.com/afangxin/p/7064661.html