{"id":662,"date":"2016-05-18T11:25:08","date_gmt":"2016-05-18T10:25:08","guid":{"rendered":"http:\/\/www.haxed.me.uk\/?p=662"},"modified":"2016-05-18T11:28:21","modified_gmt":"2016-05-18T10:28:21","slug":"configuring-basic-nfs","status":"publish","type":"post","link":"https:\/\/haxed.me.uk\/index.php\/2016\/05\/18\/configuring-basic-nfs\/","title":{"rendered":"Configuring Basic NFS Server+Client on RHEL7"},"content":{"rendered":"<p>So, you want to configure NFS? This isn&#8217;t too difficult to do. First of all you will need to, in the simplest setup, create 2 servers, one acting as the NFS server which hosts the content and attached disks. The second server, acting as the client, which mounts the filesystem of the NFS server over the network to a local mount point on the client. In RHEL 7 this is remarkably easy to do.<\/p>\n<h1> Install and Configure NFS on the Server<\/h1>\n<h2> Install dependencies <\/h2>\n<pre>\r\nyum -y install nfs-utils rpcbind\r\n<\/pre>\n<h2> Create a directory on the server <\/h2>\n<h3> This is the directory we will share <\/h3>\n<pre>\r\n mkdir -p \/opt\/nfs\r\n<\/pre>\n<h2> Configure access for the client server on ip 10.0.0.2 <\/h2>\n<pre>\r\nvi \/etc\/exports\r\n\r\n# alternatively you can directly pipe the configuration but I don't recommend it\r\necho \"\/opt\/nfs 10.0.0.2(no_root_squash,rw,sync)\" > \/etc\/exports\r\n<\/pre>\n<h2> Open Firewall ports used by NFS <\/h2>\n<pre>\r\nfirewall-cmd --zone=public --add-port=2049\/tcp --permanent\r\nfirewall-cmd --reload\r\n<\/pre>\n<h2> Restart NFS services &#038; check NFS status <\/h2>\n<pre>\r\nservice rpcbind start; service nfs start\r\nservice nfs status \r\n<\/pre>\n<h1> Install and configure NFS on the Client <\/h1>\n<h2> Install dependencies &#038; start rpcbind <\/h2>\n<pre>\r\nyum install nfs-utils rpcbind\r\nservice rpcbind start\r\n<\/pre>\n<h2> Create directory to mount NFS <\/h2>\n<pre>\r\n# Directory we will mount our Network filesystem on the client\r\nmkdir -p \/mnt\/nfs\r\n# The server ip address is 10.0.0.1, with the path \/opt\/nfs, we want to mount it to the client on \/mnt\/nfs this could be anything like\r\n# \/mnt\/randomdata-1234 etc as long as the folder exists;\r\nmount 10.0.0.1:\/opt\/nfs \/mnt\/nfs\/\r\n<\/pre>\n<h2> Check that the NFS works <\/h2>\n<pre>\r\necho \"meh testing..\" > \/mnt\/nfs\/testing.txt\r\ncat \/mnt\/nfs\/testing.txt\r\nls -al \/mnt\/nfs\r\n<\/pre>\n<p>You should see the filesystem now has testing.txt on it. Confirming you setup NFS correctly.<\/p>\n<h2> Make NFS mount permanent by enabling the service permanently, and adding the mount to fstab <\/h2>\n<h3> This will cause the server to automount the fs during boot time <\/h3>\n<pre>\r\nsystemctl enable nfs-server\r\n<\/pre>\n<pre>\r\nvi \/etc\/fstab\r\n10.0.0.1:\/opt\/nfs\t\/mnt\/nfs\tnfs\tdefaults \t\t0 0\r\n\r\n# OR you could simply pipe the configuration to the file (this is really dangerous though)\r\n# Unless you are absolutely sure what you are doing\r\necho \"10.0.0.1:\/opt\/nfs\t\/mnt\/nfs\tnfs\tdefaults \t\t0 0\" >> \/etc\/fstab\r\n\r\n<\/pre>\n<p>If you reboot the client now, you should see that the NFS mount comes back.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, you want to configure NFS? This isn&#8217;t too difficult to do. First of all you will need to, in the simplest setup, create 2 servers, one acting as the NFS server which hosts the content and attached disks. The &hellip; <a href=\"https:\/\/haxed.me.uk\/index.php\/2016\/05\/18\/configuring-basic-nfs\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42,56,15,28,9,7,55],"tags":[],"class_list":["post-662","post","type-post","status-publish","format-standard","hentry","category-automation","category-autoscale","category-cloud","category-interweb","category-linux","category-management-tools","category-nfs"],"_links":{"self":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/662","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/comments?post=662"}],"version-history":[{"count":3,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/662\/revisions"}],"predecessor-version":[{"id":665,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/662\/revisions\/665"}],"wp:attachment":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/media?parent=662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/categories?post=662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/tags?post=662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}