• ubuntu nfs服务器


    建立 nfs 服务器 
            在嵌入式 linux 开发的时候,常常需要使用 nfs 以方便程序的调试。使用 nfs,用户可以
    将板子要用到的根文件系统放在主机目录下,开发板则通过以太网挂载到这个目录并将这个
    目录下的文件作为根文件系统的内容,这样用户的程序更新后不比重新烧写板子的根文件系
    统便能被重新使用,这点能够大大加快程序的调试。
    Ubuntu 下安装 nfs 服务器的步骤如下:
    4.3.1 进行 NFS 服务器端与客户端的安装:
    sudo apt-get install nfs-kernel-server   nfs-common   portmap
    安装客户端的作用是可以在本机进行 NFS 服务的测试。
    4.3.2 配置 portmap
    两种方法任选一种就可以:
    (1):sudo emacs /etc/default/portmap
    去掉  -i 127.0.0.1  
    (2)sudo dpkg-reconfigure portmap  
    运行后选择“否”
    另外很重要的一点,要用 sysv-rc-conf  (而不是 chkconfig)工具查看一下当前 nfs 和 portmap
    的状态,若是 off,则用 sudo sysv-rc-conf portmap on  或 sudo sysv-rc-conf nfs-kernel-server on
    打开
    4.3.3 配置挂载目录和权限
    emacs /etc/exports
    我的配置如下:
    # /etc/exports: the access control list for filesystems which may be exported
    #  to NFS clients.   See exports(5).
    #
    # Example for NFSv2 and NFSv3:
    # /srv/homes        hostname1(rw,sync) hostname2(ro,sync)
    #
    # Example for NFSv4:
    # /srv/nfs4         gss/krb5i(rw,sync,fsid=0,crossmnt)
    # /srv/nfs4/homes   gss/krb5i(rw,sync)
    #
    /nfsboot *(rw,sync)
    解释一下:
    #后面的都是解释
    /nfsboot 是 NFS 的共享目录,*表示任何 IP 都可以共享这个目录,你可以改为受限的 IP,rw
    表示的是权限,sync 是默认的。
    4.3.4 更新 exports 文件
    只要你更改了/etc/exports,  你不可以通过 sudo exportfs -r  来更新  这个文件
    4.3.5 重启 NFS 服务
    Sudo /etc/init.d/portmap start
    sudo /etc/init.d/nfs-kernel-server restart  重启 nfs 服务
    4.3.6 进行测试
    尝试一下挂载本地磁盘(我的 linux 系统 IP 为 202.198.137.18,将/home/nfsboot 挂载到/mnt)  
    $ sudo mount 202.198.137.18:/nfsboot /mnt  
    运行  $ df  看看结果  
    $ sudo umount /mnt

  • 相关阅读:
    Angular.js为什么如此火呢?
    Javascript实现页面跳转的几种方式
    Bootstrap:弹出框和提示框效果以及代码展示
    Bootstrap模态框(modal)垂直居中
    JS倒计时跳转页面
    复选框、单选框与文字对齐问题
    RFC/IEC/ISO
    shell
    websocket programming in python
    产品固件(系统)升级——curl/wget
  • 原文地址:https://www.cnblogs.com/feisky/p/1704163.html
Copyright © 2020-2023  润新知