「Linux」- 在 CentOS 中,搭建 NFS 服务

  CREATED BY JENKINSBOT

NFS 1.3.0 on ClearOS 7.5

操作系统:ClearOS release 7.5.0 (Final)
软件版本:nfs-utils 1.3.0

# 安装并启动服务
yum install -y nfs-utils nfs-utils-lib

systemctl start nfs-server.service
systemctl enable nfs-server.service

# 修改配置:到处目录
cat >> /etc/exports.d/foo.exports <<EOF
/path/to/folder 10.10.50.0/24(rw,sync,all_squash)
EOF
exportfs -ar

# 查看导出目录
showmount -e 127.0.0.1

NFS 1.2.3 on CentOS 6.5

操作系统:CentOS release 6.5 (Final)
软件版本:nfs-utils-1.2.3-75.el6_9.x86_64 | nfs-utils-lib-1.1.5-13.el6.x86_64

### 第一步、安装服务

yum install -y nfs-utils nfs-utils-lib
chkconfig nfs on
chkconfig rpcbind on
service rpcbind start
service nfs start

### 第二步、导出目录

cat >> /etc/exports <<EOF
/mnt/nfs_src 10.10.50.0/24(rw,sync,all_squash)
EOF
exportfs -ar # 重新加载配置,而无需重启

### 第三步、查看导出

showmount -e 127.0.0.1

参考文献

How To Set Up an NFS Mount on CentOS 6
mount – NFS Server changes in /etc/exports file need Service Restart? – Unix & Linux Stack Exchange