多语言展示
当前在线:615今日阅读:113今日分享:31

Centos7 使用NFS

Cents os安装和挂载NFS
工具/原料
1

CentOS7x

2

连接互联网,可以使用yum

方法/步骤
1

服务端:1.关闭系统防火墙[root@server ~]systemctl stop firewalld

2

服务端:2.禁用selinux[root@server ~]vi /etc/sysconfig/selinux

3

服务端:3.安装所需的软件包[root@server ~]yum install -y rpc-bind nfs-utils

4

服务端:4.修改/etc/exports文件,定义NFS共享如下:/home/mallapp/nfs 172.18.0.0/16 (rw,no_root_squash,no_all_squash,sync)

5

服务端:5.创建需要共享目录将需要共享的资源放入此目录,或者第四步之前准备好目录,然后在编辑exports的时指向需要共享的目录mkdir -p /home/mallapp/nfs

6

服务端:6.启动nfs和rpcbind 服务[root@server ~]systemctl enable nfs[root@server ~]systemctl start nfs[root@server ~]systemctl enable rpcbind[root@server ~]systemctl start rpcbind

7

服务端:7.查看服务状态 查看NFS服务的服务状态[可忽略][root@server ~]systemctl status nfs查看本机共享的文件系统[可忽略][root@server ~]exportfs/home/mallapp/nfs                172.18.0.0/16

8

客户端:1.关闭防火墙和selinux,方法见上面

9

客户端:2.安装nfs-utils[root@client ~]yum install -y nfs-utils

10

客户端:3.创建需要挂载的目录这里使用相同的目录路径,如:[root@client ~]mkdir -p /home/mallapp/nfs

11

客户端:4.挂载[root@client ~]mount -t nfs 172.18.112.80:/home/mallapp/nfs /home/mallapp/nfs -o proto=tcp -o nolock

12

客户端:5.查看挂载是否成功通过进入目录查看或者使用命令mount -l

推荐信息