nfs网络文件系统--学习笔记-创新互联

本次实验的环境是redhat 7.0系统
nfs服务可以将远程linux服务器上的文件共享资源挂载到本地linux主机上,本地的linux主机可以基于TCP/IP协议,像使用本地目录文件一样去操作远程共享的目录文件。

为安国等地区用户提供了全套网页设计制作服务,及安国网站建设行业解决方案。主营业务为成都网站制作、网站建设、安国网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

1. 服务器端

1.1 安装

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

# 关闭iptables
[root@localhost Desktop]# iptables -F
[root@localhost Desktop]# system^C
[root@localhost Desktop]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]

1.2 创建共享目录

[root@localhost Desktop]# mkdir /nfsdir
# 确保共享目录有权限,其他人可以读写
[root@localhost Desktop]# chmod -Rf 777 /nfsdir

1.3 配置nfs

主配置文件/etc/exports
格式:共享目录的路径 允许访问的nfs客户端IP(共享权限参数),nfs客户端IP和权限之间没有空格。
权限的参数:

参数 作用
ro只读
rw读写
root_squash当nfs客户端以root管理员访问时,映射为nfs服务器的匿名用户
no_root_squash芳nfs客户端以root管理员访问时,映射为nfs服务器的root管理员
all_saquash无论nfs客户端使用什么账户访问,均映射为nfs服务器的匿名用户
sync同时将数据写入到内存与硬盘中,保证数据不丢
async优先将数据保存到内存,然后再写入硬盘;这样效率高,但有可丢失数据
[root@localhost Desktop]# vim /etc/exports
/nfsdir 192.168.137.*(rw,sync,root_squash)

1.4 启动

# 启动RPC,nfs需要使用RPC服务
[root@localhost Desktop]# systemctl restart rpcbind.service 
[root@localhost Desktop]# systemctl enable rpcbind.service 
# 启动nfs
[root@localhost Desktop]# systemctl restart nfs-server
[root@localhost Desktop]# systemctl enable nfs-server
ln -s '/usr/lib/systemd/system/nfs-server.service' '/etc/systemd/system/nfs.target.wants/nfs-server.service'

2. 客户端

2.1 安装nfs-utils工具

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

2.2 查询服务端共享信息

showmount 命令的参数

参数 作用
-e显示nfs服务器的共享列表
-a显示本机挂载的fns资源
[root@localhost ~]# showmount -e 192.168.137.10
Export list for 192.168.137.10:
/nfsdir 192.168.137.*

2.3 挂载

[root@localhost ~]# mkdir /nfsdir
[root@localhost ~]# mount -t nfs 192.168.137.10:/nfsdir /nfsdir
[root@localhost ~]# df -Th
Filesystem             Type      Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root  xfs        18G  3.0G   15G  17% /
devtmpfs               devtmpfs  985M     0  985M   0% /dev
tmpfs                  tmpfs     994M  140K  994M   1% /dev/shm
tmpfs                  tmpfs     994M  8.9M  986M   1% /run
tmpfs                  tmpfs     994M     0  994M   0% /sys/fs/cgroup
/dev/sda1              xfs       497M  112M  385M  23% /boot
/dev/sr0               iso9660   3.5G  3.5G     0 100% /media/cdrom
192.168.137.10:/nfsdir nfs4       18G  3.0G   15G  17% /nfsdir

测试成功

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。

本文题目:nfs网络文件系统--学习笔记-创新互联
文章地址:https://www.cdcxhl.com/article40/cojhho.html

成都网站建设公司_创新互联,为您提供小程序开发网站策划外贸建站定制网站微信公众号静态网站

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

h5响应式网站建设