小试Linux NFS安装

实验环境:


  • 虚拟机一:系统CentOS6.4 IP:192.168.0.45
  • 虚拟机二:系统CentOS6.4 IP:192.168.0.46

NFS服务器端配置:


  • 打印系统版本:

    1. cat /etc/redhat-release
    2. uname -r
    3. uname -m
  • 检查并安装NFS服务:

    1. rpm -aq nfs-utils portmap rpcbind
    2. LANG=EN
    3. yum grouplist
    4. yum install nfs-utils rpcbind -y
    5. rpm -aq nfs-utils portmap rpcbind
  • 启动RPC及NFS服务并检查:

    1. /etc/init.d/rcpbind start
    2. ps -ef |grep rpc
    3. /etc/init.d/rpcbind status
    4. rpcinfo -p localhost
    5. /etc/init.d/nfs start
    6. rpcinfo =p localhost
  • 设置开机自启动并检查:

    1. chkconfig nfs on
    2. chkconfig rpcbind on
    3. chkconfig --list nfs
    4. chkconfig --list rpcbind
  • 配置共享/data目录:

    1. cat >>/etc/exports<
    2. #shared data for bbs by jason at 20150810
    3. /data 192.168.0.0/24(rw,sync)----注IP为机器地址网段,24为子网掩码
    4. EOF
    5. cat /etc/exports
  • 创建共享目录:

    1. mkdir /data
    2. ll /data
    3. chown -R nfsnobody.nfsnobody /data
  • 平滑加载NFS服务并检查服务:

    1. /etc/init.d/nfs reload
    2. showmount -e localhost

NFS客户端:


  • 检查系统版本
    1. hostname nfsclient
    2. cat /etc/redhat-release
    3. uname -r
    4. uname -m
  • 安装rpc服务并检查
    1. rpm -aq nfs-utils portmap rpcbind
    2. yum groupinstall "NFS file server" -y
    3. rpm -aq nfs-utils portmap rpcbind
  • 启动rpc服务并检查
    1. /etc/init.d/rpcbind start
    2. /etc/init.d/rpcbind status
  • 设置开机自启动并检查
    1. chkconfig rpcbind on
    2. chkconfig --list rpcbind
  • 检查服务端的NFS是否OK
    1. showmount -e 192.168.0.46
  • 排查故障
    1. ping 192.168.0.46
    2. telnet 192.168.0.46 111
  • 挂载并测试
    1. mount -t nfs 192.168.0.46:/data /mnt
    2. cd /mnt
    3. ls -l
    4. touch jason.log
    5. ls -l
    6. echo "mount -t nfs 192.168.0.46:/data /mnt" >>/etc/rc.local

你可能感兴趣的:(小试Linux NFS安装)