CentOS 6.3下NFS安装配置
CentOS 6.3下NFS安装配置
一、环境介绍
NFS服务器:CentOS6.3 192.168.8.20
NFS客户端:CentOS6.5 192.168.8.39
二、服务器端安装配置
1、先用rpm -qa命令查看所需安装包(nfs-utils、rpcbind)是否已经安装:
# rpm -qa | grep "rpcbind"
rpcbind-0.2.0-9.el6.x86_64
# rpm -qa | grep "nfs"
nfs-utils-lib-1.1.5-4.el6.x86_64
nfs-utils-1.2.3-26.el6.x86_64
2、如查询结果如上,说明服务器自身已经安装了NFS,如果没有安装,则用yum命令来安装:
# yum -y install nfs-utils rpcbind
3、创建共享目录:
# mkdir /sharestore
4、NFS共享文件路径配置:
编辑/etc/exports添加下面一行,添加后保存退出。
# vi /etc/exports
/sharestore *(rw,sync,no_root_squash)
5、启动NFS服务(先启动rpcbind,再启动nfs;如果服务器自身已经安装过NFS,那就用restart重启两个服务):
6、设置NFS服务开机自启动:
# chkconfig nfs on
# chkconfig --list nfs
nfs 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
# chkconfig rpcbind on
# chkconfig --list rpcbind
rpcbind 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
三、客户端挂载配置
1、创建一个挂载点:
# mkdir /mnt/store
2、查看NFS服务器上的共享:
# showmount -e 192.168.8.20
# showmount -e 192.168.8.20
-bash: showmount: command not found
安装nfs-utils包即可
# yum install -y nfs-utils
# showmount -e 192.168.8.20
Export list for 192.168.8.20:
/sharestore *
3、挂载:
# mount -t nfs 192.168.8.20:/sharestore /mnt/store
4、查看已挂载共享:
5、验证挂载是否生效
一、环境介绍
NFS服务器:CentOS6.3 192.168.8.20
NFS客户端:CentOS6.5 192.168.8.39
二、服务器端安装配置
1、先用rpm -qa命令查看所需安装包(nfs-utils、rpcbind)是否已经安装:
# rpm -qa | grep "rpcbind"
rpcbind-0.2.0-9.el6.x86_64
# rpm -qa | grep "nfs"
nfs-utils-lib-1.1.5-4.el6.x86_64
nfs-utils-1.2.3-26.el6.x86_64
2、如查询结果如上,说明服务器自身已经安装了NFS,如果没有安装,则用yum命令来安装:
# yum -y install nfs-utils rpcbind
3、创建共享目录:
# mkdir /sharestore
4、NFS共享文件路径配置:
编辑/etc/exports添加下面一行,添加后保存退出。
# vi /etc/exports
/sharestore *(rw,sync,no_root_squash)
5、启动NFS服务(先启动rpcbind,再启动nfs;如果服务器自身已经安装过NFS,那就用restart重启两个服务):
# service rpcbind restart 停止 rpcbind: [确定] 正在启动 rpcbind: [确定] # service nfs restart 关闭 NFS 守护进程: [确定] 关闭 NFS mountd: [确定] 关闭 NFS 服务: [确定] Shutting down RPC idmapd: [确定] 启动 NFS 服务: [确定] 启动 NFS mountd: [确定] 启动 NFS 守护进程: [确定] 正在启动 RPC idmapd: [确定]
6、设置NFS服务开机自启动:
# chkconfig nfs on
# chkconfig --list nfs
nfs 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
# chkconfig rpcbind on
# chkconfig --list rpcbind
rpcbind 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
三、客户端挂载配置
1、创建一个挂载点:
# mkdir /mnt/store
2、查看NFS服务器上的共享:
# showmount -e 192.168.8.20
# showmount -e 192.168.8.20
-bash: showmount: command not found
安装nfs-utils包即可
# yum install -y nfs-utils
# showmount -e 192.168.8.20
Export list for 192.168.8.20:
/sharestore *
3、挂载:
# mount -t nfs 192.168.8.20:/sharestore /mnt/store
4、查看已挂载共享:
# mount /dev/sda3 on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) tmpfs on /dev/shm type tmpfs (rw) /dev/sda1 on /boot type ext4 (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) 192.168.8.20:/sharestore on /mnt/store type nfs (rw,vers=4,addr=192.168.8.20,clientaddr=192.168.8.39)
5、验证挂载是否生效
# cd /mnt/store # touch aa [root@web1 store]# ls aa # echo "jack" > aa # cat aa jack 服务端192.168.8.20: # cd /sharestore/ # ls aa # cat aa jack
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律