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,如需转载请自行联系原作者
目录
相关文章
|
3天前
|
Linux 虚拟化 数据安全/隐私保护
系统崩溃不用慌!VMware这个逆天功能竟能让CentOS一键回档?后悔药真实存在!
备份的重要性在于它能在系统出现异常或错误时,帮助我们快速恢复到正常状态,避免重新安装系统和配置环境。VMware 提供了两种备份方式:快照和克隆。 **快照**是保存虚拟机某一时刻的完整状态(包括内存、CPU、磁盘数据),便于快速回滚,适合临时保存状态。操作简单,可在系统运行时创建。 **克隆**则是复制整个虚拟机系统,侧重长期备份,需在系统关闭时进行。分为完整克隆和链接克隆,前者独立于源系统,占用更多空间,但更安全可靠。
34 17
系统崩溃不用慌!VMware这个逆天功能竟能让CentOS一键回档?后悔药真实存在!
|
1月前
|
Linux 应用服务中间件 nginx
CentOS系统下的软件安装与卸载
CentOS系统中安装及卸载软件,常用yum命令安装及卸载软件包。yum是基于RPM的软件包管理器,可用于在CentOS中安装、更新、查询和移除软件包。yum命令可以从指定服务器下载rpm包并安装,能自动解决依赖问题。
147 78
|
3月前
|
运维 监控 安全
CentOS 7系统 OpenSSH和OpenSSL版本升级指南
本文详细介绍如何在CentOS 7系统上升级OpenSSH和OpenSSL至最新稳定版本(OpenSSH 9.6p1和OpenSSL 1.1.1w),解决多个已知安全漏洞(如CVE-2023-51767等)。涵盖环境说明、现存漏洞、升级准备、具体步骤及故障排查,确保服务器安全。建议先在测试环境验证,再应用于生产环境。
335 7
|
4月前
|
Linux 开发工具 Windows
CentOS8 64位系统 搭建内网穿透frp
【10月更文挑战第23天】本文介绍了如何在Linux系统上搭建frp内网穿透服务,并配置Windows客户端进行访问。首先,通过系统信息检查和软件下载,完成frp服务端的安装与配置。接着,在Windows客户端下载并配置frpc,实现通过域名访问内网地址。最后,通过创建systemd服务,实现frp服务的开机自动启动。
240 14
|
4月前
|
存储 Linux Docker
centos系统清理docker日志文件
通过以上方法,可以有效清理和管理CentOS系统中的Docker日志文件,防止日志文件占用过多磁盘空间。选择合适的方法取决于具体的应用场景和需求,可以结合手动清理、logrotate和调整日志驱动等多种方式,确保系统的高效运行。
394 2
|
5月前
|
Web App开发 搜索推荐 Unix
Linux系统之MobaXterm远程连接centos的GNOME桌面环境
【10月更文挑战第21天】Linux系统之MobaXterm远程连接centos的GNOME桌面环境
940 5
Linux系统之MobaXterm远程连接centos的GNOME桌面环境
|
5月前
|
Unix Linux 网络安全
NFS挂载服务
【10月更文挑战第14天】
161 2
|
5月前
|
Linux 网络安全 数据安全/隐私保护
Linux系统之Centos7安装cockpit图形管理界面
【10月更文挑战第12天】Linux系统之Centos7安装cockpit图形管理界面
204 1
Linux系统之Centos7安装cockpit图形管理界面
|
7月前
|
存储 Linux 网络安全
【Azure 存储服务】如何把开启NFS 3.0协议的Azure Blob挂载在Linux VM中呢?(NFS: Network File System 网络文件系统)
【Azure 存储服务】如何把开启NFS 3.0协议的Azure Blob挂载在Linux VM中呢?(NFS: Network File System 网络文件系统)
|
10月前
|
域名解析 Unix Linux
AIX上如何正确挂载Linux 的nfs共享目录分享篇
AIX上如何正确挂载Linux 的nfs共享目录分享篇
394 1

热门文章

最新文章