Host

  • sudo apt-get install nfs-kernel-server
  • sudo gedit /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,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#

/mnt/hgfs/I *(rw,sync,no_subtree_check,fsid=0)
/home/yzbx/config *(rw,sync,no_subtree_check)
  • sudo exportfs -a
  • sudo /etc/init.d/nfs-kernel-server restart

Client

  • sudo apt-get install nfs-kernel-server
  • sudo mkdir /mnt/hahaha
  • sudo mount -t nfs 192.168.x.x:/mnt/hgfs/I /mnt/hahaha

附加篇

  • 如果是在局域网内用虚拟机,则记得将网卡模式设为桥接,将桥接网卡从自动修改为正确的硬件,此时虚拟机可以分配到局域网中的IP,并直接访问局域网中的其它电脑。
  • 利用ln -s TrueDir LinkDir 可以链接数据库路径TrueDir,而程序可以通过LinkDir访问TrueDir中的数据。
Logo

更多推荐