两台Linux机器之间通过nfs共享文件

1、ubuntu 20.04 server端:

shell脚本实现自动配置:

vi nfs.sh

增加:

sudo apt-get install nfs-kernel-server
cat /etc/exports | grep "home/george/下载 *(rw,sync,no_root_squash)"
if [ $? -eq 1 ];then
        echo "/home/george/下载 *(rw,sync,no_root_squash)" >> /etc/exports
fi
sudo exportfs -rv

sudo rpcbind stop
sudo  service nfs-kernel-server stop 

sudo ps -ef | grep rpc* | grep -v grep | cut -c 9-16 | xargs kill -9
sudo ps -ef | grep *nfs* | grep -v grep | cut -c 9-16 | xargs kill -9

sudo rpcbind restart
sudo service nfs-kernel-server restart

echo "Now test if nfs configure OK!"

showmount -e

echo "Congratulation! Your nfs is configured OK!"
2、deepin 20 beta client端:
sudo apt-get install nfs-common

vi /etc/fstab

文件最后增加:

192.168.1.105:/home/george/下载 /mnt/nfs nfs rw 0 0

保存
重启系统验证一下是否自动挂载。

So easy~

你可能感兴趣的:(两台Linux机器之间通过nfs共享文件)