美文网首页
centos下安装nfs

centos下安装nfs

作者: phper1021 | 来源:发表于2017-02-07 10:28 被阅读39次

centos下安装nfs

1.安装

nfs服务器ip:192.168.44.12

# yum install nfs-utils rpcbind

安装完以后先不急着启动,先来了解一下nfs服务运行在哪些端口上,它默认需要使用5个端口,其中有4个端口是动态的,所以如果服务器和客户端之间有iptables,就要先把这4个动态端口设置成静态的,查看iptables是否开启了,然后加入进防火墙规则里,需要修改的端口有如下四个(端口可以根据需求改,不一定就和我这一样)

2.编辑nfs配置文件

# vi /etc/sysconfig/nfs

LOCKD_TCPPORT=30001 #TCP锁使用端口
LOCKD_UDPPORT=30002 #UDP锁使用端口
MOUNTD_PORT=30003 #挂载使用端口
STATD_PORT=30004 #状态使用端口

# service iptables status

除了以上四个端口要通过iptables,还有nfs协议端口2049以及rpc的111端口,这样才能顺利的使用nfs服务

# vi /etc/sysconfig/iptables
-A INPUT -p tcp -m tcp --dport 111 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 2049 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3001 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3002 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3003 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3004 -j ACCEPT

# service iptables reload

3.创建测试文件

# mkdir /home/wwwroot/default/upload
# touch /home/wwwroot/default/upload/test

4.添加客户端机器

# vi /etc/exports

把/home/wwwroot/default目录共享给192.168.44.13 主机,可以写主机名、域名等,使用默认参数(ro,sync,wdelay,root_squash)

/home/wwwroot/default/upload 192.168.44.13(rw,sync,no_root_squash)
/home/wwwroot/default/upload 192.168.44.11(rw,sync,no_root_squash)

5.参数详解

  • ro #只读共享
  • rw #读写共享
  • sync #同步写操作
  • async #异步写操作
  • wdelay #延迟写操作
  • root_squash #屏蔽远程root权限
  • no_root_squash #不屏蔽远程root权限
  • all_squash #屏蔽所有远程用户的权限

6.启动nfs服务

# service nfs start
# service rpcbind start
# chkconfig nfs on
# chkconfig rpcbind on

1.客户端安装nfs

# yum install nfs-utils

2.挂载

查看挂载的情况

# mount -l

挂载nfs服务器的共享目录到/home/wwwroot/default/

# mount -t nfs 192.168.44.12:/home/wwwroot/default/upload  /home/wwwroot/default/upload

取消挂载

# umount  -l /home/wwwroot/default/upload

3.开机自动挂载,添加在客户端机器

 # echo "192.168.44.12:/home/wwwroot/default/upload  /home/wwwroot/default/upload nfs defaults 0 0" >> /etc/fstab

其它的客户端的nfs安装一样,并且需要在nfs服务器的/etc/exports下新增下ip。

相关文章

  • centos下安装nfs

    centos下安装nfs 1.安装 nfs服务器ip:192.168.44.12 安装完以后先不急着启动,先来了解...

  • CENTOS6 NFS 环境构建

    CENTOS6 NFS 环境构建 nfs server => NFS Server 搭建, CENTOS6 安装N...

  • Centos下安装 nfs

    安装 验证

  • Docker Swarm 进阶:NFS 共享数据卷

    启动 NFS 服务(CentOS 7) 首先,安装 rpcbind 和 nfs-utils 然后,编辑 /etc/...

  • NFS共享服务器

    (1)nfs服务器端配置Centos使用nfs需要nfs-utils和rpcbind,但yum安装nfs-util...

  • nfs搭建

    环境 centos7安装 nfs 相关软件包: 修改nfs配置文件,nfs的默认配置文件是 /etc/export...

  • k8s基于NFS创建Storageclass

    结果展示 搭建NFS服务器 注意:安装nfs相关软件时需要在k8s的各个节点上都要安装参考Centos7搭建NFS...

  • CentOS 7 安装 NFS

    CentOS 7 安装 NFS 1.服务端&客户端: 2.新建要挂载的文件夹 3.修改文件夹权限 4.配置 NFS...

  • NFSserver use

    系统环境:Centos7.3 ip1:10.0.0.1 ip2:10.0.0.2 检测是否安装NFS服务 rpm ...

  • centos7下NFS使用与配置

    centos7下NFS使用与配置 NFS是Network File System的缩写,即网络文件系统。客户端通过...

网友评论

      本文标题:centos下安装nfs

      本文链接:https://www.haomeiwen.com/subject/jzppittx.html