centosnfs配置
时间:2026-11-29 09:07:00CentOS NFS(网络文件(jian)系统)是一种在分布式计算环境中实(shi)现文件共享的协议,通过使用(yong)NFS,可以(yi)在(zai)不同的计算机之间共享文件和目录,从而实现数(shu)据(ju)和资源的高效利用,本文将介绍如何在CentOS 7上安装和配置NFS服务。
1. 确保系统已经更新到最新版本,在终端中输入以下命令:


sudo yum update
2. 安装NFS服务所需的(de)软件包,在终端中输入以下命令:

sudo yum install nfs-utils
3. 启动并设置NFS服务开机自启,在终端中输入以下命令:
sudo systemctl start nfs-serversudo systemctl enable nfs-server
4. 查看NFS服务状态,在终端中输入以下(xia)命令:
sudo systemctl status nfs-server1. 创建一个用于共享的目录,创建一个名为“/shared”的目录:
sudo mkdir /shared2. 设置该目录的权限,以便其他用户可以访问和修改,设置为所有用户可读写:
sudo chmod 777 /shared
3. 在客(ke)户端计算机上创建一个挂载点,用于访问共享目录,创建一个(ge)名为“/mnt/nfs”的目录:
sudo mkdir /mnt/nfs
4. 将远程服务器上的共享目录挂载到客户端计算机上,假设远(yuan)程服务(wu)器的IP地址为“192.168.1.100”,则执行以下命令:
sudo mount -t nfs 192.168.1.100:/shared /mnt/nfssudo cp /etc/fstab /etc/fstab.bak
使用文本编辑器打开“/etc/fstab”文件,例如使用“vi”编辑器:
sudo vi /etc/fstab保存并关闭文件,执行(xing)以下命令使更改(gai)生效:
sudo mount -a1. 在客户端计(ji)算机上运(yun)行以下命令,查看挂载点下的内容(rong):
ls /mnt/nfs如果可以看到共享目录中的文件和(he)子目录,说(shuo)明NFS共享已成功。
2. 在远程服务器上检查“/var/log/messages”文件,查找与(yu)NFS相关的日志(zhi)信息,如果看到类似以下内容的日志,说明NFS服务正在正常(chang)运行(xing):
“`
Mar 3 10:23:45 server kernel: NFS client version 3 called Mount(192.168.1.100://shared) from (192.168.1.200) at Mar 3 10:23:45 by user nobody on Linux version 3.10.0-514.el7.x86_64 (systemd-238) with TCP_NODELAY enabled (protocol in use PXE-RSP/MMU/HUD) using localtime(Crunchy) and nolock(vfs) options; protocol VFS_NOLOCK (tcp), Retry: yes (max=3), Timeout in isochronous mode set to 60 seconds (RPC_TIMEOUT=60). VFS error (device or resource busy), device or resource busy (192.168.1.100://shared) is not a directory or is empty. [kernel] IP table flush before namespace switch. [IPV4] NETLINK address family [genl]: autoconfig failed (-1): Checking for a default router now without sending any packets to the network! This might take a few minutes depending on your network setup! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unreachable (netlink)! [IPV4] Network is unReachablE(NETLINK): No route to host, disconnecting … done.[iproute2-default(7)]: REJECT xmit queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only; reject rcv queue full, statistics only
客服电话18021712189
Copyright © 2012-2018 上海楠静电子商务有限公司 版权所有 备案号:
客服电话18006757605