在两台 Linux 主机之间共享文件夹
-
安装 NFS (Network File System)
## server end , the dir shared sudo apt-get install nfs-kernel-server ## client end sudo apt-get install nfs-common
-
服务主机配置 NFS exports 文件
sudo vim /etc/exports --- /path/to/share $client_ip(rw,sync,no_subtree_check,no_root_squash) ## e.g., /home/root/share 203.0.113.*(rw,sync,no_subtree_check,no_root_squash) ---
-
服务主机启动 NFS 服务
## check status service nfs-server status ## start nfs service nfs-server start ## restart nfs service nfs-server restart
-
客户端挂载共享文件夹
## check the export list on server can be seen on client or not showmount -e $server_ip ## mount sudo mount -t nfs $server_ip:/path/to/share /home/root/share ## check mount mount -t nfs