nfs 服务搭建

2021-08-12  本文已影响0人  Andy_1ee

nfs百科: nfs 百科

1. 安装 nfs-server

centos

### 1. 安装
yum install -y  nfs-utils
yum install -y rpcbind 
### 2. 启动
systemctl start rpcbind
systemctl start nfs-server
systemctl status nfs-server
systemctl status rpcbind
lsof -i:111
systemctl enable rpcbind
systemctl enable nfs-server
### 3.  配置共享目录
vim /etc/exports
/data *(rw,sync,no_root_squash)
### 4. 测试
1. 重启nfs服务
systemctl restart nfs-server
2. 测试
showmount -e <ip>

ubuntu

1. 安装
apt-get update
apt-get install -y nfs-kernel-server
2. 配置共享目录
vim /etc/exports
/data *(rw,sync,no_root_squash)
3. 启动
systemctl restart nfs-kernel-server
4. 测试
showmount -e <ip>

2. 配置nfs客户端

2.1 liunx
# centos
1. 安装
  yum install nfs-utils rpcbind -y
2. 启动
systemctl start rpcbind
3. 挂载
mount -t nfs <ip>:<nfs-server path> <local path>
4. 开机启动
vim /etc/rc.local
最后一行添加: mount -t nfs <ip>:<nfs-server path> <local path>
# ubuntu
1. 安装
 apt install nfs-common
2. 挂载
mount -t nfs <ip>:<nfs-server path> <local path>
3. 卸载
umount <local path>
2.2 windows
参考: https://blog.csdn.net/qq_34158598/article/details/81976063
1. 安装

3. 常见问题处理

1. 通过127.0.0.1:/data/ifs 可以挂载nfs, 但是在其他机器上无法进行挂载
# mount.nfs: access denied by server while mounting
# 解决思路:参考 http://liuzhigong.blog.163.com/blog/static/17827237520115305226932/
# 1. 根据资料查看日志 cat /var/log/messages | grep mount 发现并没有报错
# 2. 由于描述和资料类似, 所以增加 insecure (secure 选项要求mount客户端请求源端口小于1024, 使用insecure会关闭此项)
# /data/ifs  *(insecure,rw,async,no_root_squash)
通过上述方式发现问题解决

 

持续更新中...

上一篇 下一篇

猜你喜欢

热点阅读