nfs 共享磁盘 2023-09-08 10:40:00 编程 Linux, nfs 暂无评论 262 次阅读 1003字 修改时间:2024-01-19 10:47:50 ## 服务端安装配置 安装nfs主机: ```bash yum install nfs-utils -y ``` 重启服务,并且加入开机启动 ```bash systemctl restart rpcbind && systemctl restart nfs && systemctl enable rpcbind && systemctl enable nfs ``` 创建共享目录 ```bash mkdir /home/share # 如果是在其他目录,可能权限会影响。建议在home下。 ``` 修改配置文件 ```bash vim /etc/exports #输入以下内容(目录根据实际情况修改): /home/share/ *(insecure,rw,sync,no_root_squash) ``` ## 客户端安装配置 安装nfs: ```bash yum install nfs-utils -y ``` 创建共享目录 ```bash mkdir /data/sharedata ``` 挂载共享目录 ```bash vim /etc/fstab #输入以下内容(ip是第一步安装的nfs主机): 192.168.1.1:/home/share /data/sharedata nfs rw,soft,intr 0 0 mount -t nfs 192.168.1.1:/home/share ``` 配置完成 ```bash #重启服务,并且加入开机启动 systemctl restart rpcbind && systemctl restart nfs && systemctl enable rpcbind && systemctl enable nfs ``` ## 备注 如果发现挂载不上,可能是防火墙原因 ```bash #开启端口,重启防火墙 firewall-cmd --add-port=2049/tcp --permanent firewall-cmd --add-port=111/tcp --permanent firewall-cmd --reload ``` 标签: Linux, nfs
评论已关闭