bash;gutter:true;
服务端配置:
1. 安装nfs-utils和rpcbind</p>
<h1>yum install nfs-utils rpcbind</h1>
<p>2.设置开机启动服务</p>
<h1>chkconfig nfs on</h1>
<h1>chkconfig rpcbind on</h1>
<p>3.启动相关服务</p>
<h1>service rpcbind start</h1>
<h1>service nfs start</h1>
<p>4.创建共享目录</p>
<h1>mkdir -p /export/libin</h1>
<p>5.编辑/etc/exports主配置文件添加如下内容</p>
<h1>vi /etc/exports</h1>
<p>==>/export/libin *(rw,async,no_root_squash,no_subtree_check)</p>
<h1>exportfs -rv //重新读取配置文件,而不中断服务</h1>
<p>解读:
<em>可以共享给指定IP(192.168.1.7),也可以共享给指定网段(192.168.1.0),还可以共享给所有IP(</em>).rw代表读写权限。
ro只读权限
rw读写权限
sync同步写入内存与磁盘当中
no_all_squash保留共享文件的UID和GID(默认)
no_root_squash使得root用户具有根目录的完全访问权限</p>
<p>6.启动nfs和rpcbind ,加入开机自启动:</p>
<h1>systemctl start rpcbind</h1>
<h1>systemctl start nfs</h1>
<h1>systemctl enable rpcbind</h1>
<h1>systemctl enable nfs</h1>
<p>7.刷新配置立即生效</p>
<h1>exportfs -a</h1>
<p>8、查看本机共享的服务</p>
<h1>showmount -e</h1>
<p>客户端配置
1. 安装nfs-utils</p>
<h1>yum install nfs-utils</h1>
<p>2.设置开机启动服务</p>
<h1>chkconfig nfs on</h1>
<p>3.启动服务</p>
<h1>service nfs start</h1>
<p>4.创建挂载点</p>
<h1>mkdir -p /mnt/libin</h1>
<p>5.挂载目录</p>
<h1>mount -t nfs server_ip:/export/libin /mnt/libin</h1>
<p>6.查看挂载的目录</p>
<h1>df -h</h1>
<p>7.卸载挂载的目录</p>
<h1>umount /mnt/libin</h1>
<p>8.编辑/etc/fstab,开机自动挂载</p>
<h1>vi /etc/fstab</h1>
<p>==>server_ip:/export/libin /mnt/libin nfs rw,tcp,intr 0 1</p>
<p>回退:
服务端:yum remove nfs-utils rpcbind
客户端:</p>
<h1>umount /mnt/libin</h1>
<h1>yum remove nfs-utils</h1>
<p>
Original: https://www.cnblogs.com/libin-linux/p/16618993.html
Author: LB_运维技术
Title: Linux NFS服务配置
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/158267/
转载文章受原作者版权保护。转载请注明原作者出处!