nfs服务

1、关闭防火墙(4步)
root@cq ~]# systemctl stop firewalld
[root@cq ~]# systemctl disable firewalld
[root@cq ~]# vim /etc/selinux/config
[root@cq ~]# setenforce 0
2、安装nfs服务(nfs-utils rpcbind)
[root@cq ~]# yum -y install nfs-utils
[root@cq ~]# yum -y install rpcbind
已加载插件:product-id, search-disabled-repos, subscription-manager
This system is
3、启动nfs服务 和 rpcbind
[root@cq ~]# systemctl start nfs-server
[root@cq ~]# systemctl start rpcbind
4、编辑配置文件的共享目录
5、重启nfs服务
[root@cq ~]# systemctl restart nfs-server rpcbind
6、创建共享目录
[root@cq ~]# mkdir /chenqian
客户端:
1、关闭防火墙(4步
[root@chenqian ~]# systemctl stop firewalld
[root@chenqian ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@chenqian ~]# systemctl disable firewalld
[root@chenqian ~]# vim /etc/selinux/
config final/ semanage.conf targeted/ tmp/
[root@chenqian ~]# vim /etc/selinux/
config final/ semanage.conf targeted/ tmp/
[root@chenqian ~]# vim /etc/selinux/
config final/ semanage.conf targeted/ tmp/
[root@chenqian ~]# vim /etc/selinux/config
2、搭建nfs服务
[root@chenqian ~]# yum -y install nfs-utils rpcbind
已加载插件:product-id, search-disabled-repos, subscription-manager
3、启动nfs服务
[root@chenqian ~]# systemctl start nfs-server rpcbind
4、验证nfs服务端的共享目录
[root@chenqian ~]# showmount -e 172.16.195.128
Export list for 172.16.195.128:
/chenqian 172.16.195.129
5、创建挂载的目录站点
[root@chenqian ~]# mkdir /nfs
6、挂载
[root@chenqian ~]# mount -t nfs 172.16.195.128:/chenqian /nfs
7、然后在服务端为共享目录设置匿名用户和组
[root@cq ~]# chown -R nfsnobody.nfsnobody /chenqian
8、在客户端验证挂载目录站点是否可以创建文件和删除文件
[root@chenqian nfs]# touch 4 5
touch: 无法创建"4": 只读文件系统
touch: 无法创建"5": 只读文件系统
[root@chenqian nfs]# touch 4 5
[root@chenqian nfs]# ls
1 2 3 4 5

作业
1.手动搭建一个nfs服务器

开放/nfs/shared目录,供所有用户查阅资料
开放/nfs/upload目录为172.16.12.0/24网段的数据上传目录,并将所有用户及所属的用户组都映射为nfs-upload,其UID与GID均为300

[root@cq ~]# mkdir -p /nfs/{shared,upload}
[root@cq nfs]# ls
shared upload
[root@cq nfs]# vim /etc/exports
/chenqian 172.16.195.129(rw)
/nfs/shared *(ro)
/nfs/upload 172.16.195.0/24(rw,anonuid=300,anongid=300)

[root@cq nfs]# exportfs -r
chown -R 300.300 /nfs/upload/

[root@chenqian ~]# vim /etc/fstab
172.16.195.128:/nfs /cq nfs defaults,_netdev 0 0
[root@chenqian ~]# mount -a
[root@chenqian upload]# touch 2 3
[root@chenqian upload]# ll
总用量 0
-rw-r--r--. 1 300 300 0 7月 2 18:19 2
-rw-r--r--. 1 300 300 0 7月 2 18:19 3

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值