<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>NFS &#8211; Blog of Kliment Andreev &#8211; A place so I won&#039;t forget things</title>
	<atom:link href="https://blog.andreev.it/tag/nfs/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.andreev.it</link>
	<description></description>
	<lastBuildDate>Sun, 01 Nov 2020 13:18:09 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>CentOS: NFS &#8211; quick install</title>
		<link>https://blog.andreev.it/2018/12/139-centos-nfs-quick-install/</link>
					<comments>https://blog.andreev.it/2018/12/139-centos-nfs-quick-install/#respond</comments>
		
		<dc:creator><![CDATA[Kliment Andreev]]></dc:creator>
		<pubDate>Sun, 09 Dec 2018 00:26:07 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[NFS]]></category>
		<guid isPermaLink="false">https://blog.andreev.it/?p=4180</guid>

					<description><![CDATA[NFS (Network File System) is a distributed file system protocol originally developed by Sun&#8230;]]></description>
										<content:encoded><![CDATA[<div id="bsf_rt_marker"></div><p>NFS (Network File System) is a distributed file system protocol originally developed by Sun Microsystems in 1984, allowing a user on a client computer to access files over a computer network much like local storage is accessed. NFS, like many other protocols, builds on the Open Network Computing Remote Procedure Call (ONC RPC) system. The NFS is an open standard defined in Request for Comments (RFC), allowing anyone to implement the protocol. That&#8217;s what <a href="https://en.wikipedia.org/wiki/Network_File_System" rel="noopener noreferrer" target="_blank">Wikipedia</a> says.<br />
NFS is used as a file system when two or more instances need access to the same file system. E.g. SQL clusters, VM clusters, Docker Swarm, etc&#8230;<br />
In this post, I&#8217;ll describe a very quick install on a server and show you how to mount that on another CentOS box.</p>
<h1>Server Install</h1>
<p>On the server (in my case 192.168.1.91) I&#8217;ll install the NFS server, start it, make sure it starts at boot and then I&#8217;ll allow the firewall to accept the NFS clients. If you have SELinux enabled, it&#8217;s automatically configured.</p>
<pre class="brush: bash; title: ; notranslate">
yum -y install nfs-utils
systemctl start nfs-server
systemctl enable nfs-server
firewall-cmd --permanent --zone=public --add-service nfs
firewall-cmd --reload
</pre>
<p>Let&#8217;s create an empty directory, configure the permissions and create the NFS share. </p>
<pre class="brush: bash; title: ; notranslate">
mkdir /nfs
chown nfsnobody:nfsnobody /nfs
chmod 755 /nfs
</pre>
<p>We have to tell the NFS server about the share. Execute this line that will add the correct line in <strong>/etc/exports</strong>. That&#8217;s where the NFS server expects its shares defined.</p>
<pre class="brush: bash; title: ; notranslate">
echo &quot;/nfs    *(rw,sync,no_root_squash,no_subtree_check)&quot; &gt;&gt; /etc/exports
</pre>
<p>The * means that all IPs can have access to this share.  Do <strong>man 5 exports</strong> to see all available options. We have to tell the NFS server to export the share now.</p>
<pre class="brush: bash; title: ; notranslate">
exportfs -a
</pre>
<p>Check the exported share.</p>
<pre class="brush: bash; highlight: [1]; title: ; notranslate">
exportfs -s
/nfs  *(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash)
</pre>
<h1>Client install</h1>
<p>On the client, we&#8217;ll have to install the NFS client. It&#8217;s the same package.</p>
<pre class="brush: bash; title: ; notranslate">
yum -y install nfs-utils
</pre>
<p>There is no need to start any service or change any firewall settings.<br />
Let&#8217;s mount the share. I&#8217;ll mount it under <strong>/mnt/nfs</strong> which is a new directory on the client.</p>
<pre class="brush: bash; title: ; notranslate">
mkdir -p /mnt/nfs
mount 192.168.1.91:/nfs /mnt/nfs
</pre>
<p>If you create a file on the share now and go back to the server you&#8217;ll see that the file is there.</p>
<pre class="brush: bash; title: ; notranslate">
echo &quot;NFS test&quot; &gt; /mnt/nfs/nfs.txt
</pre>
<p>In order to mount this share anytime you boot the client, you&#8217;ll have to add it to <strong>/etc/fstab</strong> so it mounts on boot.</p>
<pre class="brush: bash; title: ; notranslate">
echo &quot;192.168.1.91:/nfs       /mnt/nfs    nfs     defaults 0 0&quot; &gt;&gt; /etc/fstab
</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.andreev.it/2018/12/139-centos-nfs-quick-install/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
