部署 NFS 服务
- 服务端: 192.168.100.11
安装依赖
yum -y install epel-release
安装 NFS
yum -y install nfs-utils rpcbind
启动 NFS
[root@hecs-x-large-2-linux-20200321161149 ~]# systemctl enable rpcbind nfs-server nfs-lock nfs-idmap Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service. [root@hecs-x-large-2-linux-20200321161149 ~]# systemctl start rpcbind nfs-server nfs-lock nfs-idmap
配置防火墙
[root@hecs-x-large-2-linux-20200321161149 ~]# firewall-cmd --add-service=nfs --permanent --zone=public [root@hecs-x-large-2-linux-20200321161149 ~]# firewall-cmd --add-service=mountd --permanent --zone=public [root@hecs-x-large-2-linux-20200321161149 ~]# firewall-cmd --add-service=rpc-bind --permanent --zone=public [root@hecs-x-large-2-linux-20200321161149 ~]# firewall-cmd --reload
配置 NFS
- 创建存储目录
[root@hecs-x-large-2-linux-20200321161149 ~]# mkdir /data [root@hecs-x-large-2-linux-20200321161149 ~]# chmod 777 -R /data
配置NFS权限
[root@hecs-x-large-2-linux-20200321161149 ~]# vi /etc/exports /data 192.168.0.*(rw,sync,all_squash,anonuid=0,anongid=0)
- 设置 NFS 访问权限, /data 是刚才创建的将被共享的目录, 192.168.0.* 表示整个 192.168.0.* 的资产都有括号里面的权限
- 也可以写具体的授权对象 /data 192.168.0.30(rw,sync,no_root_squash) 192.168.0.31(rw,sync,no_root_squash)
继续阅读
评论