Centos6.4系统文件服务之NFS

简介:

1.查看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

[root@localhost ~]#


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]#


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安装

wKioL1LTVsHTXWGeAAHoFaWRfuU602.jpg

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

wKioL1LTV3ORATSpAABgcXN9P-E093.jpg

wKioL1LTV6jSmNZrAAJ79nSrs6w604.jpg

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的状态
[root@centos nfs1]# rpcinfo -p localhost |grep nfs   --查看rpc端口连接
[root@centos nfs1]# cat /var/lib/nfs/etab            --查看nfs默认的参数
[root@centos nfs1]# cat /var/lib/nfs/xtab            --nfs服务器被挂载的信息










本文转自 z597011036 51CTO博客,原文链接:http://blog.51cto.com/tongcheng/1351145,如需转载请自行联系原作者
目录
相关文章
|
1月前
|
Linux Shell Windows
通过Linux挂载Windows端NFS服务实现板端Linux传输文件到PC
通过Linux挂载Windows端NFS服务实现板端Linux传输文件到PC
|
2月前
|
Java Linux Shell
linux自动部署jar包,注册系统服务(基于Centos7)
linux自动部署jar包,注册系统服务(基于Centos7)
81 0
|
3月前
|
存储 监控 网络协议
【Linux】文件服务NFS(Network File System)
【Linux】文件服务NFS(Network File System)
34 0
|
3月前
|
安全 Linux 网络安全
百度搜索:蓝易云【centos7系统添加用户、密码,以及修改端口教程】
请牢记,对系统进行任何更改都需要谨慎行事。在执行这些操作之前,最好备份重要的数据和配置文件,并确保您具有足够的权限和知识来进行这些更改。如果在操作过程中遇到任何问题,请务必小心并及时修复,以免影响系统的稳定性和安全性。
69 2
|
3月前
|
监控 安全 Linux
CentOS7下部署ARL资产侦察灯塔系统
CentOS7下部署ARL资产侦察灯塔系统
155 3
|
29天前
|
关系型数据库 MySQL 数据库
虚拟机Linux-Centos系统网络配置常用命令+Docker 的常用命令
虚拟机Linux-Centos系统网络配置常用命令+Docker 的常用命令
34 0
|
1月前
|
关系型数据库 MySQL Linux
【VMware安装+centos 7Linux系统+MySQL安装】——在Linux系统中安装MySQL步骤,以及遇见的各种问题(如:vm两个虚拟网卡消失、vm网络适配器有感叹号等等)
【VMware安装+centos 7Linux系统+MySQL安装】——在Linux系统中安装MySQL步骤,以及遇见的各种问题(如:vm两个虚拟网卡消失、vm网络适配器有感叹号等等)
178 0
|
2月前
|
关系型数据库 Linux Shell
Centos系统上安装PostgreSQL和常用PostgreSQL功能
Centos系统上安装PostgreSQL和常用PostgreSQL功能
|
3月前
|
监控 Linux
CentOS7中使用一键脚本部署Librenms网络监控系统
CentOS7中使用一键脚本部署Librenms网络监控系统
88 1
|
3月前
|
安全 Linux Anolis
CentOS to 龙蜥衍生版 KeyarchOS 系统迁移体验 | 开发者说
CSDN 知名博主使用龙蜥衍生版 KeyarchOS 迁移使用体验,欢迎阅读。