Linux总结笔记7-配置NFS服务实现Linux间文件共享

搭建NFS服务器

1.安装nfs-utils

[root@linux1 ~]# yum -y install nfs-utils

2.创建共享目录,修改目录权限为777

3.在配置文件/etc/exports 里写入需要共享的配置信息

[root@linux1 ~]# vim /etc/exports
/nfsshare       192.168.100.*(rw,sync,root_squash)

4.重启 rpcbind 和 nfs 服务

[root@linux1 ~]# systemctl restart rpcbind
[root@linux1 ~]# systemctl restart nfs-server
(注意先后顺序,否则客户端报错如下)
[root@Linux2 ~]# showmount -e 192.168.100.10
clnt_create: RPC: Program not registered

在Linux客户端使用

1.用showmount命令查看远程主机NFS共享列表

[root@linux2 ~]# showmount -e 192.168.10.10 
Export list for 192.168.10.10: 
/nfsfile 192.168.10.*

2.创建挂载点然后挂载使用

[root@linux2 ~]# mkdir /nfsshare
[root@linux2 ~]# mount -t nfs 192.168.100.10:/nfsshare /nfsshare

3.写入/etc/fstab文件

[root@linux2 ~]# vim /etc/fstab
192.168.100.10:/nfsshare        /nfsshare       nfs     defaults    0 0

你可能感兴趣的:(linux,nfs,服务器,Linux,Linux服务器配置,Linux,服务器搭建)