nfs使用

本文介绍了如何在Linux系统中安装NFS-utils包,并详细展示了NFS服务的配置过程及客户端挂载NFS共享目录的方法。通过具体命令演示了如何设置NFS服务器的共享目录权限,以及客户端如何通过fstab实现自动挂载。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

yum -y install nfs-utils

[root@nfs ~]# cat /etc/exports
/public *(ro)

[root@docker02 ~]# cat /etc/fstab
192.168.6.200:/public /mnt/nfs nfs defaults 0 0

[root@docker02 ~]# systemctl start nfs-server.service
[root@docker02 ~]# systemctl enable nfs-server.service
systemctl status nfs

[root@docker02 ~]# mount -a
[root@docker02 ~]# df -h
文件系统               容量  已用  可用 已用% 挂载点
/dev/vda1               16G  1.2G   15G    8% /
devtmpfs               1.9G     0  1.9G    0% /dev
tmpfs                  1.9G     0  1.9G    0% /dev/shm
tmpfs                  1.9G  8.4M  1.9G    1% /run
tmpfs                  1.9G     0  1.9G    0% /sys/fs/cgroup
tmpfs                  377M     0  377M    0% /run/user/0
192.168.6.200:/public   16G  1.2G   15G    7% /mnt/nfs
 

543 yum -y install nfs-utils

544 mount -t nfs 192.168.6.200:/var/webroot /mnt

545 ls /mnt

546 systemctl restart nfs

547 mount -t nfs 192.168.6.200:/var/webroot /mnt

548 df -h

549 cd /mnt

550 echo 12345 > index.html

551 ll

552 docker run -it -v /mnt:/var/www/html myos

553 umount /mnt

554 cd

555 umount /mnt

556 ls

557 history

 

 

76 mkdir /var/webroot

77 vim /etc/exports

78 cd /var/webroot/

79 ll

80 cd ..

81 ll -d

82 ls

83 df -h

84 ls *

85 ls -ll

86 chmod 777 webroot/

87 ls -ll

88 exportfs -avr

89 ifconfig

90 systemctl restart nfs

91 history

 

[root@nfs var]# cat /etc/exports

/var/webroot *(rw)

[root@nfs var]#

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

乐于技术分享

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值