zoukankan      html  css  js  c++  java
  • CentOS 6.3下NFS安装配置

    CentOS 6.3下NFS安装配置


    一、环境介绍
     
      NFS服务器:CentOS6.3 192.168.8.20
      NFS客户端:CentOS6.5 192.168.8.39


    二、服务器端安装配置
     
    1、先用rpm -qa命令查看所需安装包(nfs-utils、rpcbind)是否已经安装:
    # rpm -qa | grep "rpcbind"
    rpcbind-0.2.0-9.el6.x86_64


    # rpm -qa | grep "nfs"
    nfs-utils-lib-1.1.5-4.el6.x86_64
    nfs-utils-1.2.3-26.el6.x86_64


    2、如查询结果如上,说明服务器自身已经安装了NFS,如果没有安装,则用yum命令来安装:
    # yum -y install nfs-utils rpcbind


    3、创建共享目录:
    # mkdir /sharestore


    4、NFS共享文件路径配置:
    编辑/etc/exports添加下面一行,添加后保存退出。
    # vi /etc/exports 
    /sharestore  *(rw,sync,no_root_squash)


    5、启动NFS服务(先启动rpcbind,再启动nfs;如果服务器自身已经安装过NFS,那就用restart重启两个服务):
    # service rpcbind restart
    停止 rpcbind:                                             [确定]
    正在启动 rpcbind:                                         [确定]
    
    
    # service nfs restart
    关闭 NFS 守护进程:                                        [确定]
    关闭 NFS mountd:                                          [确定]
    关闭 NFS 服务:                                            [确定]
    Shutting down RPC idmapd:                                  [确定]
    启动 NFS 服务:                                            [确定]
    启动 NFS mountd:                                          [确定]
    启动 NFS 守护进程:                                        [确定]
    正在启动 RPC idmapd:                                      [确定]


    6、设置NFS服务开机自启动:
    # chkconfig nfs on
    # chkconfig --list nfs
    nfs             0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭


    # chkconfig rpcbind on
    # chkconfig --list rpcbind
    rpcbind         0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭


    三、客户端挂载配置
    1、创建一个挂载点:
    # mkdir /mnt/store


    2、查看NFS服务器上的共享:
    # showmount -e 192.168.8.20
    # showmount -e 192.168.8.20
    -bash: showmount: command not found


    安装nfs-utils包即可
    # yum install -y nfs-utils


    # showmount -e 192.168.8.20
    Export list for 192.168.8.20:
    /sharestore *


    3、挂载:
    # mount -t nfs 192.168.8.20:/sharestore /mnt/store


    4、查看已挂载共享:
    # mount
    /dev/sda3 on / type ext4 (rw)
    proc on /proc type proc (rw)
    sysfs on /sys type sysfs (rw)
    devpts on /dev/pts type devpts (rw,gid=5,mode=620)
    tmpfs on /dev/shm type tmpfs (rw)
    /dev/sda1 on /boot type ext4 (rw)
    none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
    sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
    192.168.8.20:/sharestore on /mnt/store type nfs (rw,vers=4,addr=192.168.8.20,clientaddr=192.168.8.39)


    5、验证挂载是否生效
    # cd /mnt/store
    # touch aa
    [root@web1 store]# ls
    aa
    # echo "jack" > aa
    # cat aa
    jack
    
    
    服务端192.168.8.20:
    # cd /sharestore/
    # ls
    aa
    # cat aa
    jack
    


  • 相关阅读:
    11组 团队展示
    11组Alpha冲刺4/6
    11组Alpha冲刺2/6
    11组Alpha冲刺3/6
    EF code first 分页显示
    多条件分页存储过程控制器写法
    UML的9种图
    C#设计模式(2)——简单工厂模式
    多条件分页存储过程PageCommon写法
    五分钟读懂UML类图
  • 原文地址:https://www.cnblogs.com/reblue520/p/6239818.html
Copyright © 2011-2022 走看看