centos7安装NFS手册

服务器端(即要共享的电脑)

1.NFS与RPC同时安装的yum命令

# yum install nfs* portmap -y

2.关闭防火墙,并使防火墙不开机自启

# systemctl stop firewalld
# systemctl disable firewalld

3.禁用selinux

# vi /etc/selinux/config

将SELINUX的状态修改为disabled

4.配置nfs

# vi /etc/exports

添加:/share *(insecure,rw,async,no_root_squash)
(其中/share是需要共享的文件夹,共享的文件就存放在/share文件夹中,而 * 指的是让哪个用户连接 例如:192.168.1.121 而括号里面的则是各种参数:可以百度查看)

5.创建共享文件夹

# mkdir /share

6.NFS设为开机自启并启动NFS

# systemctl enable nfs
# systemctl start nfs

7.RPC设为开机自启并启动RPC

# systemctl enable rpcbind
# systemctl start rpcbind

8.使用chown命令挂载文件夹

# chown nfsnobody.nfsnobody /share

9.输入“exportfs”查看本机的共享文件系统,如果有则代表成功

# exportfs

客户端(指查看共享文件夹的电脑)

1.安装NFS与RPC并将它们设为开机自启与启动

# yum install nfs* portmap –y
# systemctl enable nfs
# systemctl start nfs
# systemctl enable rpcbind
# systemctl start rpcbind

2.关闭防火墙,并使防火墙不开机自启

# systemctl stop firewalld
# systemctl disable firewalld

3.禁用selinux

# vi /etc/selinux/config

将SELINUX的状态修改为disabled

4.挂载共享的nfs系统

# mount 192.168.1.140:/share  /media

192.168.1.140:为装NFS服务器端的ip,/share为服务器端设置的共享文件夹,/media为本地需要挂载的文件夹

5.查看是否成功

# mount |grep media

media为本地需要挂载的文件夹

6.把共享目录写入系统挂载文件

# vi /etc/fstab

添加以下代码: 192.168.1.140:/share /media nfs nodev,rw,rsize=32768,wsize=32768 0 0

猜你喜欢

转载自blog.csdn.net/weixin_43963598/article/details/84852264