zoukankan      html  css  js  c++  java
  • [转]Ubuntu下配置NFS服务

    [转]Ubuntu下配置NFS服务 

    http://blog.163.com/liu8821031%40126/blog/static/111782570200921021253516/

     

    Table of Contents

    1.下载相关软件

    2.建立共享目录

    3.修改该配置文件

    4.重启服务

    5.测试服务器

    6.测试客户端

     

    测试系统:Ubuntu8.04

    1.下载相关软件

    使用如下命令,可以在ubuntu下很方便的获取并安装相关软件

    #sudo apt-get install portmap nfs-kernel-server nfs-common

    如果是要客户端和服务器端分开,可以使用如下命令

    服务器端:

    #sudo apt-get install portmap nfs-kernel-server
    客户机端:

    #sudo apt-get install portmap nfs-common

     

    2.建立共享目录

    根据个人习惯,最好路径不要太深,毕竟敲命令太长很不爽^_^

    #sudo mkdir /nfsboot

    #sudo chmod 777 /nfsboot

     

    3.修改该配置文件

    刚安装完配置文件只有一些说明,其路径是:/etc/exports

    #sudo vi /etc/exports

    在里面加入

    /nfsboot *(rw,sync,no_root_squash)

    说明:

    /nfsboot是要共享的目录

    *代表允许所有的网络段访问

    rw是可读写权限

    sync是资料同步写入内存和硬盘

    no_root_squashNFS客户端分享目录使用者的权限,如果客户端使用的是root用户,那么对于该共享目录而言,该客户端就具有root权限

    最后重新扫描配置文件,使用户修改/etc/exports配置文件不必重启NFS服务

    #sudo exportfs -ra

     

    4.重启服务

    使用如下命令重启一下服务

    #sudo /etc/init.d/portmap restart

    #sudo /etc/init.d/nfs-kernel-server restart

     

    5.测试服务器

    查看服务目录和权限

    #showmount -e

    我得到的结果是:

    Export list for MyZone:

    /nfsboot (everyone)

     

    6.测试客户端

    /nfsboot里新建文件,主要是作测使用

    #touch /nfsboot/testfile

    在其他分区挂载nfs文件系统,记得该目录要先存在才行

    #sudo mount 218.192.***.***:/nfsboot /mnt

    查看一下:

    #ls /mnt

    testfile

     

    卸载nfs文件系统 

    #sudo  umount  218.192.***.***:/nfsboot  /mnt

     

     

     

    实 际上nfs配置是否成功还与/etc/hosts.deny   和  /etc/hosts.allow 这两个文件的设置的有关,若是在用#:showmount  -e 来激活 portmap   出现又mount: RPC: Port mapper failure - RPC: Unable to receive 或者
     mount: RPC: Program not registered,这很可能是你的这两个文件没有配置好。由于我的nfs允许任何IP挂载,所以设置如下:

           liu@liu-laptop:~$ sudo gedit /etc/hosts.deny             
       在后面加上
          ### NFS DAEMONS
    portmap:ALL
    lockd:ALL
    mountd:ALL
    rquotad:ALL
    statd:ALL

          liu@liu-laptop:~$ sudo gedit /etc/hosts.allow
    在后面加上
    #  ### NFS DAEMONS

    portmap: ALL:allow

    lockd: ALL:allow

    rquotad: ALL:allow

    mountd: ALL:allow

    statd: ALL:allow
    有些网友还说可以是防火墙的问题,这我就不清楚了。

  • 相关阅读:
    mybatis显示sql语句 log4j.properties配置文件
    Netty 4.0 demo
    Netty多线程处理机制
    crontab定时任务中文乱码问题
    linux grep、find 命令详解
    resin access.log format配置详解
    linux top命令详解
    正则表达式介绍及案例分享
    java定时任务
    rhApp遇到的项目问题
  • 原文地址:https://www.cnblogs.com/vc60er/p/4462469.html
Copyright © 2011-2022 走看看