centos7搭建nfs步骤
时间: 2023-11-12 20:04:17 浏览: 93
CentOS7上搭建NFS服务器的步骤如下:
1. 确保两台CentOS7机器之间可以互相访问,可以通过ping命令测试。
2. 在NFS服务器上安装nfs-utils和rpcbind软件包,命令如下:
```
yum install -y nfs-utils rpcbind
```
3. 创建一个共享目录,例如:
```
mkdir /home/nfs_share
```
4. 配置NFS服务器,编辑/etc/exports文件,添加以下内容:
```
/home/nfs_share 192.168.0.0/24(rw,sync,no_root_squash)
```
其中,/home/nfs_share是共享目录的路径,192.168.0.0/24是允许访问的客户端IP地址段,rw表示可读写,sync表示同步写入,no_root_squash表示允许root用户访问。
5. 启动rpcbind和nfs服务,并设置开机自启动,命令如下:
```
systemctl start rpcbind.service
systemctl start nfs.service
systemctl enable rpcbind.service
systemctl enable nfs.service
```
6. 在NFS客户端上安装nfs-utils软件包,命令如下:
```
yum install -y nfs-utils
```
7. 挂载NFS共享目录,命令如下:
```
mount -t nfs 192.168.0.1:/home/nfs_share /mnt/nfs_share
```
其中,192.168.0.1是NFS服务器的IP地址,/home/nfs_share是共享目录的路径,/mnt/nfs_share是本地挂载点的路径。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)