nfs是一种网路文件系统,须要依赖rpc进行过程调度

注意nfs只验证id,验证用户名,而且只能在类unixos上进行文件共享服务,因为它的脆弱的验证机制,所以不适合在internet上工作,在外网使用是特别可行的。

nfs服务端须要确定这两个包正确安装nfs-utilsrpcbind

若是ubuntu服务器linux 发邮件,则是nfs-commonLINUX 删除目录,nfs-kernel-server两个包linux下nfs挂载命令,rpcbind是默认安装的。

yum -y install nfs-utils rpcbind

编辑共享目录配置文件/etc/exports

linux挂载操作_linux挂载sr0_linux下nfs挂载命令

/var/www/html 192.168.10.0/24(rw,async,no_root_squash) 192.168.20.0/24(ro)
#多个网段或主机之间用空格分开
/var/www 192.168.10.0/24(ro,sync,root_squash)

参数:ro表示只读,rw表示可读写linux下nfs挂载命令,sync同步写*即同时写入显存和硬碟,async异步*暂存于显存,no_root_squash表示若果顾客端联接过来的用户是root,则对服务端的目录同样是root权限****请不要开启,好危险的,root_squash表示顾客端是root则将其转为匿名用户的权限***建议开启。

启动nfs服务,并设为开机自启动

service rpcbind start		#或则 systemctl start rpcbind
service nfs start		#或则 systemctl start nfs
######ubuntu服务器则是 service startnfs-kernel-server start
chkconfig rpcbind on		#或则 systemctl enable rpcbind
chkconfig nfs on		#或则 systemctl enable nfs

linux下nfs挂载命令_linux挂载操作_linux挂载sr0

配置防火墙,放行响应端口或服务

https://www.linuxprobe.com/chapter-08.html不理解的可以参考这个页面
firewall-cmd --permanent --add-service=nfs
firewall-cmd --permanent --add-service=rpc-bind
firewall-cmd --permanent --add-service=mountd
firewall-cmd --reload
firewall-cmd --list-all		#查看firewalld方向的资源

linux下nfs挂载命令_linux挂载sr0_linux挂载操作

顾客端挂载

showmount -e nfs_server_ip: 查看nfs服务端的可用挂载点

顾客端挂载操作

mount -t nfs nfs_server:/var/www/html /bendikongmulu
或者
mount -t nfs nfs_server:/var/www/html /bendikongmulu -o proto=tcp

Author

这篇优质的内容由TA贡献而来

刘遄

《Linux就该这么学》书籍作者,RHCA认证架构师,教育学(计算机专业硕士)。

发表回复