网络文件系统之NFS

1.1 安装软件:
在客户端安装

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

在服务端安装
[root@localhost ~]# yum -y install nfs-utils

1.2主机名解析:

[root@nfsclient ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.216.200 nfsclient
192.168.216.201 nfsserver

[root@nfsserver ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.216.200 nfsclient
192.168.216.201 nfsserver

1.3 创建共享目录:

[root@nfsserver ~]# mkdir /smartgoshare

1.4共享目录设置

[root@nfsserver ~]# cat /etc/exports

/smartgoshare   *(rw,sync,no_root_squash)

1.5启动服务,加入开机自启动

[root@nfsserver ~]# systemctl enable nfs-server

Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.

[root@nfsserver ~]# systemctl start nfs-server

1.6验证

在服务端验证
[root@nfsserver ~]# showmount -e
Export list for nfsserver:
/smartgoshare *

在客户端验证
[root@nfsclient ~]# showmount -e 192.168.216.201
Export list for 192.168.216.201:
/smartgoshare *

1.7 挂载使用

root@nfsclient ~]# mount -t nfs 192.168.216.201:/smartgoshare /mnt
[root@nfsclient ~]# df -h
文件系统                       容量  已用  可用 已用% 挂载点
/dev/sda3                       96G  6.0G   91G    7% /
devtmpfs                       975M     0  975M    0% /dev
tmpfs                          991M     0  991M    0% /dev/shm
tmpfs                          991M   11M  981M    2% /run
tmpfs                          991M     0  991M    0% /sys/fs/cgroup
/dev/sda1                      2.0G  164M  1.9G    9% /boot
tmpfs                          199M   12K  199M    1% /run/user/42
tmpfs                          199M     0  199M    0% /run/user/0
192.168.216.201:/smartgoshare   50G  5.9G   45G   12% /mnt
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值