1.安装NFS服务器  

  sudo apt-get install nfs-kernel-server  (安装nfs-kernel-server时,apt会自动安装nfs-common和portmap)

 

 

2.配置nfs

  sudo vim /etc/exports     

   在末尾一行加入/home/nfs *(rw,sync,no_root_squash,no_subtree_check)

 

  注意:修改后,要在linux中断 运行exportfs -rv  使配置文件/etc/exports 生效 ;设置 /home/nfs目录权限sudo chmod 777 /home/nfs -R

 

 

3.重启服务

  #sudo /etc/init.d/rpcbind restart          重启portmap,后面最新的版本都rpcbind重启

  #sudo /etc/init.d/nfs-kernel-server restart     重启nfs服务  

  #showmount -e                显示共享出的目录

 

 

4.本地挂载 (选其一即可)

   sudo mount -t nfs localhost:/home/forlinx/nfs /mnt

   sudo mount 127.0.0.1:/home/forlinx/nfs /mnt

 

   注:localhost为本机linux的IP地址 

 

 

5.远程挂载  (选其一即可)

  mount -t nfs 192.168.1.100:/home/forlinx/nfs /mnt 

  busybox mount -o nolock -t nfs 192.168.1.100:/home/forlinx/nfs /mnt

 

 

 

----------------------------------------我是漂亮的分割线------------------------------------------------------

 

ubuntu下nfs安装配置

  https://jingyan.baidu.com/article/59a015e30215a5f7948865f1.html

 

NFS挂载失败: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.