服务管理 NFS

1、关闭防火墙(4步)
root@zhangwu ~]# systemctl stop  firewalld
[root@zhangwu ~]# systemctl disable firewalld
[root@zhangwu  ~]# vim /etc/selinux/config
[root@zhangwu ~]# setenforce 0
2、安装nfs服务(nfs-utils  rpcbind)
[root@zhangwu ~]# yum -y install  nfs-utils 
[root@zhangwu ~]# yum -y install  rpcbind
已加载插件:product-id, search-disabled-repos, subscription-manager
This system is 
3、启动nfs服务 和 rpcbind
[root@zhangwu ~]# systemctl start nfs-server
[root@zhangwu ~]# systemctl start rpcbind

4、编辑配置文件的共享目录
5、重启nfs服务
[root@zhangwu ~]# systemctl restart nfs-server rpcbind
6、创建共享目录
[root@zhangwu ~]# mkdir /chenqian
客户端:

1、关闭防火墙(4步
[root@add ~]# systemctl  stop  firewalld
[root@add ~]# 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@add ~]# systemctl  disable   firewalld
[root@add ~]# vim /etc/selinux/
config         final/         semanage.conf  targeted/      tmp/
[root@add ~]# vim /etc/selinux/
config         final/         semanage.conf  targeted/      tmp/
[root@add ~]# vim /etc/selinux/
config         final/         semanage.conf  targeted/      tmp/
[root@add ~]# vim /etc/selinux/config
2、搭建nfs服务
[root@add ~]# yum -y install nfs-utils rpcbind
已加载插件:product-id, search-disabled-repos, subscription-manager 
3、启动nfs服务
[root@add ~]# systemctl  start  nfs-server  rpcbind
4、验证nfs服务端的共享目录
[root@add ~]# showmount -e 192.168.50.137
Export list for 192.168.50.137:
/add  192.168.50.138
5、创建挂载的目录站点
[root@add ~]# mkdir /nfs
6、挂载
[root@add ~]# mount -t nfs 192.168.50.137:/add   /nfs
7、然后在服务端为共享目录设置匿名用户和组   
 [root@zhangwu ~]# chown  -R  nfsnobody.nfsnobody  /add  
 8、在客户端验证挂载目录站点是否可以创建文件和删除文件
 [root@add nfs]# touch  7   8
touch: 无法创建"7": 只读文件系统
touch: 无法创建"8": 只读文件系统
[root@add nfs]# touch 7  8
[root@add nfs]# ls
1  2  3   7   8

猜你喜欢

转载自blog.51cto.com/14428046/2416422