在Rocky Linux上安装和配置NFS服务可以通过以下步骤实现:
sudo dnf install nfs-utils
sudo systemctl start nfs-server
sudo systemctl enable nfs-server
sudo mkdir /mnt/nfs_share
sudo chmod -R 777 /mnt/nfs_share
/etc/exports
,添加以下内容:/mnt/nfs_share *(rw,sync,no_root_squash)
这里/mnt/nfs_share
是需要共享的目录,*
表示允许所有主机访问,rw
表示读写权限,sync
表示同步写入,no_root_squash
表示允许root用户访问。
sudo exportfs -a
sudo firewall-cmd --permanent --zone=public --add-service=nfs
sudo firewall-cmd --reload
sudo mount -t nfs <NFS服务器IP>:/mnt/nfs_share /mnt/nfs_client
现在,您已经成功在Rocky Linux上安装和配置了NFS服务,并且可以在客户端上挂载共享目录进行访问和使用。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
相关推荐:如何在Linux子系统中实现文件共享