nfs服务配置



安装yum
[root@localhost ~]# yum install -y nfs-utils
修改配置文件
[root@localhost ~]# vim /etc/exports
在vim中写入
/home/nfstestdir 172.16.1.0/16(rw,sync,all_squash,anonuid=1000,anongid=1000)
编辑并启动nfs
[root@localhost ~]# vim /etc/exports
[root@localhost ~]# mkdir /home/nfstestdir
[root@localhost ~]# systemctl start rpcbind
[root@localhost ~]# systemctl start nfs
[root@localhost ~]# systemctl enable rpcbind
[root@localhost ~]# systemctl enable nfs
客户端挂载nfs
[root@a yum.repos.d]# showmount -e 172.16.1.196
Export list for 172.16.1.196:
/home/nfstestdir 172.16.1.0/16
挂载
[root@a ~]# mount -t nfs 172.16.1.196:/home/nfstestdir /mnt/
[root@a ~]# df -h
文件系统                       容量  已用  可用 已用% 挂载点
/dev/sda2                       18G  1.2G   16G    8% /
devtmpfs                       479M     0  479M    0% /dev
tmpfs                          489M     0  489M    0% /dev/shm
tmpfs                          489M   13M  476M    3% /run
tmpfs                          489M     0  489M    0% /sys/fs/cgroup
/dev/sda1                      488M   93M  360M   21% /boot
tmpfs                           98M     0   98M    0% /run/user/0
172.16.1.196:/home/nfstestdir   18G  1.3G   15G    8% /mnt

创建测试文件
[root@a ~]# cd /mnt/
[root@a mnt]# touch txt.txt
touch: 无法创建"txt.txt": 权限不够

在服务器上设置
[root@localhost ~]# chmod 777 /home/nfstesdir/
[root@localhost ~]#

在客户端上创建测试文件
[root@a ~]# cd /mnt/
[root@a mnt]# touch txt.txt
[root@a mnt]# ls -l
总用量 0
-rw-r--r--. 1 1000 1000 0 4月  24 11:20 txt.txt

在服务器上修改配置文件
[root@localhost ~]# vim /etc/exports
多加一行
/tmp/172.16.1.0/16(rw,sync,no_root_squash)
在执行exportfs -arv命令
[root@localhost ~]# exportfs -arv
exportfs: No options for /tmp/172.16.1.0/16(rw,sync,no_root_squash) : suggest (sync) to avoid warning
exporting 172.16.1.0/16:/home/nfstestdir
exporting :/tmp/172.16.1.0/16(rw,sync,no_root_squash)
exportfs: Failed to stat /tmp/172.16.1.0/16(rw,sync,no_root_squash): No such file or directory
[root@localhost ~]#

在客户端上
[root@a mnt]# mount -t nfs -o nolock 172.16.1.196:/tmp/ /wl/
[root@a mnt]#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值