Centos7.8搭建NFS
程序员文章站
2022-03-11 22:52:19
...
1、使用yum安装(此处省略大部分具体安装内容,仅保留最后安装成功的部分内容)
[[email protected] ~]# yum install nfs-utils -y
已安装:
nfs-utils.x86_64 1:1.3.0-0.66.el7
作为依赖被安装:
gssproxy.x86_64 0:0.7.0-28.el7 keyutils.x86_64 0:1.5.8-3.el7 libbasicobjects.x86_64 0:0.1.1-32.el7 libcollection.x86_64 0:0.7.0-32.el7 libevent.x86_64 0:2.0.21-4.el7 libini_config.x86_64 0:1.3.1-32.el7 libnfsidmap.x86_64 0:0.25-19.el7 libpath_utils.x86_64 0:0.2.1-32.el7
libref_array.x86_64 0:0.1.5-32.el7 libtirpc.x86_64 0:0.2.4-0.16.el7
libverto-libevent.x86_64 0:0.2.5-4.el7 quota.x86_64 1:4.01-19.el7 quota-nls.noarch 1:4.01-19.el7 rpcbind.x86_64 0:0.2.0-49.el7 tcp_wrappers.x86_64 0:7.6-77.el7
完毕!
2、以下四条命令分别为:
启动rpcbind服务、启动nfs服务、关闭防火墙、禁止防火墙开机自启
(rpcbind的作用:主要为通知客户端NFS的端口号)
[[email protected] ~]# systemctl start rpcbind
[[email protected] ~]# systemctl start nfs
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
3、以下三条命令分别为:
新建一个共享文件夹、修改文件夹权限、配置允许连接此NFC的IP地址
[[email protected] ~]# mkdir /NFS
[[email protected] ~]# chmod 755 /NFS
[[email protected] ~]# vi /etc/exports
添加以下内容:
/data/ 192.168.1.1(rw,sync,fsid=0) 192.168.2.0/24(rw,sync,fsid=0)
4、shownount -e 显示NFS服务器的输出清单。
[[email protected] ~]# showmount -e localhost
Export list for localhost:
/data 192.168.1.1,192.168.2.0/24