centos7搭建nfs

简介:

#服务端

centos7.2 

#

yum install nfs-utils  rpcbind -y

chmod -R 777 /u02/liyangjie

#start the server

systemctl enable rpcbind

systemctl enable nfs-server

systemctl enable nfs-lock

systemctl enable nfs-idmap

systemctl start rpcbind

systemctl start nfs-server

systemctl start nfs-lock

systemctl start nfs-idmap

vim /etc/exports

#添加如下内容,允许10.0.0.161 10.0.0.196 10.0.0.168 这几个ip访问,这次进行了更正,上次出现了少少的配置错误。

1
/u02/liyangjie  10.0.0.161(rw, sync ,no_root_squash,no_subtree_check) 10.0.0.196(rw, sync ,no_root_squash,no_subtree_check) 10.0.0.168(rw, sync ,no_root_squash,no_subtree_check)

#

systemctl restart nfs-server

firewall-cmd --permanent --zone=public --add-service=nfs

firewall-cmd --reload



#客户端NFS client end

yum install nfs-utils

#Now create the NFS directory mount point as follows:

mkdir -p /mnt/nfs/home

mkdir -p /mnt/nfs/var/nfsshare

#Start the services and add them to boot menu.

systemctl enable rpcbind

systemctl enable nfs-server

systemctl enable nfs-lock

systemctl enable nfs-idmap

systemctl start rpcbind

systemctl start nfs-server

systemctl start nfs-lock

systemctl start nfs-idmap

Next we will mount the NFS shared content in the client machine as shown below:

mount -t nfs 10.0.0.10:/u02/liyangjie /mnt/nfs/home/



#设置开机挂载

# Permanent NFS mounting

We need to mount the NFS share at client end permanent that it must be mounted even after reboot. So we need to add the NFS-share in /etc/fstab file of client machine as follows:

nano /etc/fstab

Add the entries like this:

[...]

10.0.0.10:/u02/liyangjie    /mnt/nfs/home   nfs defaults 0 0 



注释:查看了外国的一篇文章,简单搭建了nfs服务



#相关命令

exportfs -rv  重新共享所有目录并输出详细信息



本文转自 yanconggod 51CTO博客,原文链接:http://blog.51cto.com/yanconggod/1889740

相关文章
|
存储 Linux 虚拟化
CentOS 7搭建NFS服务器
CentOS 7搭建NFS服务器
|
网络协议 安全 Unix
centos7.9系统部署NFS详细流程—2023.04
centos7.9系统部署NFS详细流程—2023.04
1791 0
|
网络协议 Unix Linux
Centos下nfs+rpcbind实现服务器之间的文件共享
Centos下nfs+rpcbind实现服务器之间的文件共享
939 0
|
存储 网络协议 Linux
Linux/centos上如何配置管理NFS服务器?
Linux/centos上如何配置管理NFS服务器?
1454 0
|
Kubernetes 监控 网络协议
CentOS 7.9: NFS服务搭建与配置
CentOS 7.9: NFS服务搭建与配置
CentOS 7.9: NFS服务搭建与配置
|
运维 Linux
【Linux网络服务】Centos7搭建nfs文件共享服务器
【Linux网络服务】Centos7搭建nfs文件共享服务器
【Linux网络服务】Centos7搭建nfs文件共享服务器
|
网络协议 Linux
Centos7 nfs常用命令详解
`/etc/exports`是NFS服务的配置文件,定义了共享给客户端的文件系统和访问规则。共享目录、客户端IP或域名、以及访问权限和用户映射选项是其主要内容。客户端指定方式包括IP地址、子网、域名或通配符。选项包括读写权限(ro/rw)、用户映射(如root_squash/no_root_squash/all_squash)和其他设置(sync/async/secure/insecure等)。`exportfs -r`用于重新应用配置。配置示例:`/opt/test`共享给192.168.1.0/24,权限为rw,同步写入(sync)。注意,不建议开启no_root_squash以确保安全。
933 0
|
Linux 网络安全
Centos6.5安装并配置NFS服务
该内容描述了在Linux系统中设置NFS服务的步骤。首先挂载yum源,然后安装NFS服务,并编辑配置文件。接着,重启rpcbind和NFS服务,可能需要重复此过程以解决初始可能出现的问题。此外,关闭防火墙策略,并再次重启服务。最终,根目录被共享,特定IP网段被允许访问。
492 0
|
Linux
linux篇-Centos7构建NFS服务器和连接
linux篇-Centos7构建NFS服务器和连接
376 0
linux篇-Centos7构建NFS服务器和连接
|
安全 Linux 网络安全
CentOS 7.2搭建NFS并使用
CentOS 7.2搭建NFS并使用
1012 0
CentOS 7.2搭建NFS并使用