阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

CentOS 6.4系统文件服务之NFS

156次阅读
没有评论

共计 5311 个字符,预计需要花费 14 分钟才能阅读完成。

1.CentOS 6.4 系统下查看 nfs 软件是否安装和启动服务
[root@localhost ~]# rpm -aq |egrep ‘nfs|rpcbind’
rpcbind-0.2.0-11.el6.i686
nfs-utils-1.2.3-36.el6.i686
nfs-utils-lib-1.1.5-6.el6.i686
[root@localhost ~]# /etc/init.d/rpcbind restart
Stopping rpcbind:                                          [OK]
Starting rpcbind:                                          [OK]
[root@localhost ~]# /etc/init.d/nfs restart
Shutting down NFS daemon:                                  [OK]
Shutting down NFS mountd:                                  [OK]
Shutting down NFS quotas:                                  [OK]
Shutting down NFS services:                                [OK]
Starting NFS services:                                    [OK]
Starting NFS quotas:                                      [OK]
Starting NFS mountd:                                      [OK]
Starting NFS daemon:                                      [OK]
[root@localhost ~]#

2. 修改配置文件
[root@localhost ~]# vim /etc/exports
/home/nfs      2.2.2.10(ro)          – 这个 IP 是能读不能写
/home/nfs      *(rw,sync,no_root_squash)    – 其它 IP 可以读写

3. 关于 nfs 服务端的端口管理
[root@localhost ~]# vim /etc/sysconfig/nfs
RQUOTAD_PORT=875      – 开户以下四行
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892

4. 开启包过滤
[root@localhost ~]# iptables -I INPUT -p tcp -m multiport –ports 111,875,892,2049,32769  -j ACCEPT
[root@localhost ~]# iptables -I INPUT -p udp -m multiport –ports 111,875,892,2049,32769  -j ACCEPT
[root@localhost ~]#

5. 查看服务器共享的文件
[root@localhost ~]# showmount  -e
Export list for node1:
/home/nfs (everyone)
[root@localhost ~]#

6. 客户端挂载
[root@centos media]# /etc/init.d/rpcbind restart
Stopping rpcbind:                                          [OK]
Starting rpcbind:                                          [OK]
[root@centos media]# showmount  -e 2.2.2.27
Export list for 2.2.2.27:
/home/nfs (everyone)
[root@centos media]# mount -t nfs 2.2.2.27:/home/nfs /media/
[root@centos media]# mkdir 2
[root@centos media]# ll
total 4
drwxr-xr-x 2 root root 4096 Jan 13 10:22 2
[root@centos media]#

相关阅读:

Ubuntu 12.04 安装 NFS server http://www.linuxidc.com/Linux/2012-09/70728.htm

NFS 服务器安装配置实现 Ubuntu 12.04 与 ARM 文件共享 http://www.linuxidc.com/Linux/2012-10/73159.htm

Ubuntu 搭建 nfs 服务器 http://www.linuxidc.com/Linux/2012-10/71930.htm

文件服务器 NFS 配置详解 http://www.linuxidc.com/Linux/2013-06/86542.htm

Ubuntu 下搭建 NFS 网络文件系统服务器 http://www.linuxidc.com/Linux/2013-07/87367.htm

Heartbeat_ldirector+LB+NFS 实现 HA 及 LB、文件共享 http://www.linuxidc.com/Linux/2013-06/85292.htm

CentOS 5.5 配置 NFS 服务器教程 http://www.linuxidc.com/Linux/2013-03/81737.htm

Ubuntu 12.10 下 NFS 的安装使用 http://www.linuxidc.com/Linux/2013-03/80478.htm

7. 在客户端安装 autofs 服务自动挂载
[root@CentOS media]# yum install autofs
[root@centos nfs1]# vim /etc/auto.master
/mnt/nfs /etc/auto.nfs –timeout=60 –60 秒没有连接就断开
[root@centos nfs1]# cp /etc/auto.misc /etc/auto.nfs
[root@centos nfs1]# vim /etc/auto.nfs
nfs1 -rw,sort,intr 2.2.2.27:/home/nfs –nfs1 是 /mnt/nfs 下的目录,IP 是服务器的 IP
[root@centos nfs1]# /etc/init.d/autofs restart
Stopping automount: [OK]
Starting automount: [OK]
[root@centos nfs1]#

8.Windows7 系统与 Linux 实现 nfs 文件共享
(1) 打开 Windows7 系统程序 —> 控制面板 —> 程序和功能 —> 打开或关闭 windows 功能 —> 选中 nfs 安装

CentOS 6.4 系统文件服务之 NFS

(2)在 Windows7 系统中可以挂载 Linux 文件

CentOS 6.4 系统文件服务之 NFS

CentOS 6.4 系统文件服务之 NFS

9.nfs 服务的忧化
[root@localhost ~]# showmount -a – 在服务端查看有哪些客户端挂载
[root@localhost ~]# showmount -d – 在服务端查看客户端连接的所有输出目录
[root@localhost ~]# showmount -e – 在服务端或者客户端查看共享目录
[root@localhost ~]# exportfs -a – 全部挂载和卸载
[root@localhost ~]# exportfs -r – 重新挂载
[root@localhost ~]# exportfs -v – 输出目录时输出到屏幕上
[root@centos nfs1]# nfsiostat /mnt/nfs/nfs1 – 在客户端查看 nfs 详细参数
[root@centos nfs1]# nfsstat – 查看 nfs 的状态

更多 CentOS 相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14

1.CentOS 6.4 系统下查看 nfs 软件是否安装和启动服务
[root@localhost ~]# rpm -aq |egrep ‘nfs|rpcbind’
rpcbind-0.2.0-11.el6.i686
nfs-utils-1.2.3-36.el6.i686
nfs-utils-lib-1.1.5-6.el6.i686
[root@localhost ~]# /etc/init.d/rpcbind restart
Stopping rpcbind:                                          [OK]
Starting rpcbind:                                          [OK]
[root@localhost ~]# /etc/init.d/nfs restart
Shutting down NFS daemon:                                  [OK]
Shutting down NFS mountd:                                  [OK]
Shutting down NFS quotas:                                  [OK]
Shutting down NFS services:                                [OK]
Starting NFS services:                                    [OK]
Starting NFS quotas:                                      [OK]
Starting NFS mountd:                                      [OK]
Starting NFS daemon:                                      [OK]
[root@localhost ~]#

2. 修改配置文件
[root@localhost ~]# vim /etc/exports
/home/nfs      2.2.2.10(ro)          – 这个 IP 是能读不能写
/home/nfs      *(rw,sync,no_root_squash)    – 其它 IP 可以读写

3. 关于 nfs 服务端的端口管理
[root@localhost ~]# vim /etc/sysconfig/nfs
RQUOTAD_PORT=875      – 开户以下四行
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892

4. 开启包过滤
[root@localhost ~]# iptables -I INPUT -p tcp -m multiport –ports 111,875,892,2049,32769  -j ACCEPT
[root@localhost ~]# iptables -I INPUT -p udp -m multiport –ports 111,875,892,2049,32769  -j ACCEPT
[root@localhost ~]#

5. 查看服务器共享的文件
[root@localhost ~]# showmount  -e
Export list for node1:
/home/nfs (everyone)
[root@localhost ~]#

6. 客户端挂载
[root@centos media]# /etc/init.d/rpcbind restart
Stopping rpcbind:                                          [OK]
Starting rpcbind:                                          [OK]
[root@centos media]# showmount  -e 2.2.2.27
Export list for 2.2.2.27:
/home/nfs (everyone)
[root@centos media]# mount -t nfs 2.2.2.27:/home/nfs /media/
[root@centos media]# mkdir 2
[root@centos media]# ll
total 4
drwxr-xr-x 2 root root 4096 Jan 13 10:22 2
[root@centos media]#

相关阅读:

Ubuntu 12.04 安装 NFS server http://www.linuxidc.com/Linux/2012-09/70728.htm

NFS 服务器安装配置实现 Ubuntu 12.04 与 ARM 文件共享 http://www.linuxidc.com/Linux/2012-10/73159.htm

Ubuntu 搭建 nfs 服务器 http://www.linuxidc.com/Linux/2012-10/71930.htm

文件服务器 NFS 配置详解 http://www.linuxidc.com/Linux/2013-06/86542.htm

Ubuntu 下搭建 NFS 网络文件系统服务器 http://www.linuxidc.com/Linux/2013-07/87367.htm

Heartbeat_ldirector+LB+NFS 实现 HA 及 LB、文件共享 http://www.linuxidc.com/Linux/2013-06/85292.htm

CentOS 5.5 配置 NFS 服务器教程 http://www.linuxidc.com/Linux/2013-03/81737.htm

Ubuntu 12.10 下 NFS 的安装使用 http://www.linuxidc.com/Linux/2013-03/80478.htm

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-20发表,共计5311字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中