Oracle Linux实现nfs

最近在研究内网的一些基础环境的配置,由于是内网没有互联网,所以一般来说常用的yum安装就不能用了,所以一般是使用rpm包来安装,但是实际上这次配置nfs没有用到,因为系统里已经装好了nfs-utils和rpcbind

服务端

先安装nfs-utils和rpcbind

配置开机自启

chkconfig nfs on
chkconfig rpcbind on
等同于
systemctl enable nfs
systemctl enable rpcbind

开启服务

service rpcbind start
service nfs start
等同于
systemctl start nfs
systemctl start rpcbind

创建共享目录

mkdir -p /export/primary

mkdir -p -p代表如果父目录不存在先创建父目录

配置/etc/exports文件

vim /etc/exports
在编辑器内i 开始insert
/export/primary IP/掩码(rw,async,no_root_squash,no_subtree_check)

  可以共享给指定IP(192.168.1.7),也可以共享给指定网段(192.168.1.0),还可以共享给所有IP(*).rw代表读写权限。
exportfs -rv  //重新读取配置文件,而不中断服务

/etc/exports配置文件中权限参数常用的有如下五个:

ro只读权限

rw读写权限

sync同步写入内存与磁盘当中

no_all_squash保留共享文件的UID和GID(默认)

no_root_squash使得root用户具有根目录的完全访问权限

刷新配置

exportfs -a

客户端

安装nfs-utils和rpcbind

同上

设置服务开机自启

同上

chkconfig nfs on
chkconfig rpcbind on
等同于
systemctl enable nfs
systemctl enable rpcbind

开启服务

同上

service rpcbind start
service nfs start
等同于
systemctl start nfs
systemctl start rpcbind

创建挂载目录

同上

mkdir -p /mnt/primary

mkdir -p -p代表如果父目录不存在先创建父目录

挂载目录

mount -t nfs server_ip:/export/primary /mnt/primary

编辑/etc/fstab,实现开机自动挂载

vim /etc/fstab
server_ip:/export/primary/mnt/primary  nfs   rw,tcp,intr   0   1

卸载挂载的目录

umount /mnt/primary

Ref

  1. centos配置nfs服务详细步骤(centos开启nfs服务)
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值