{"id":16569,"date":"2024-11-02T08:04:54","date_gmt":"2024-11-02T08:04:54","guid":{"rendered":"https:\/\/truehost.com\/support\/?post_type=docs&#038;p=16569"},"modified":"2024-11-02T08:05:49","modified_gmt":"2024-11-02T08:05:49","password":"","slug":"how-to-set-up-network-file-system-nfs-on-a-linux-server","status":"publish","type":"docs","link":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-network-file-system-nfs-on-a-linux-server\/","title":{"rendered":"How to Set Up Network File System (NFS) on a Linux Server"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Overview of NFS<\/h3>\n\n\n\n<p>Network File System (NFS) is a distributed file system protocol that allows you to share directories and files with other Linux clients over a network. It\u2019s often used for centralized storage where files need to be accessed across different systems.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Prerequisites<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Two Linux systems<\/strong>:\n<ul class=\"wp-block-list\">\n<li><strong>NFS Server<\/strong>: The server that hosts the shared directory.<\/li>\n\n\n\n<li><strong>NFS Client<\/strong>: The system that will access the shared directory.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Root or sudo access<\/strong> on both the server and client systems.<\/li>\n\n\n\n<li><strong>Firewall configuration<\/strong> (if needed) to allow NFS traffic.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Install NFS on the Server<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Update the package index<\/strong>:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update # On Debian\/Ubuntu<br>sudo yum update # On CentOS\/RHEL<\/code><\/pre>\n\n\n\n<p>   2. <strong>Install the NFS server package<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install nfs-kernel-server    # On Debian\/Ubuntu\nsudo yum install nfs-utils            # On CentOS\/RHEL<\/code><\/pre>\n\n\n\n<p>3. <strong>Enable and start the NFS service<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl enable nfs-server\nsudo systemctl start nfs-server<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Create a Shared Directory<\/h3>\n\n\n\n<p>Choose a directory on the server to share. Here, we\u2019ll use <code>\/srv\/nfs_share<\/code>.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Create the directory<\/strong>:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mkdir -p \/srv\/nfs_share<\/code><\/pre>\n\n\n\n<p>2. <strong>Set permissions<\/strong> on the directory (adjust permissions as needed):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chown -R nobody:nogroup \/srv\/nfs_share   # Debian\/Ubuntu\n\nsudo chown -R nfsnobody:nfsnobody \/srv\/nfs_share   # CentOS\/RHEL<\/code><\/pre>\n\n\n\n<p>3. <strong>Add files<\/strong> to the directory (optional, for testing):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"NFS Test File\" | sudo tee \/srv\/nfs_share\/test.txt<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Configure NFS Exports<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Open the exports file<\/strong>:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/exports<\/code><\/pre>\n\n\n\n<p>    2. <strong>Add the export entry<\/strong> for your directory and client IP. The syntax is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/path\/to\/share client_IP(options)<\/code><\/pre>\n\n\n\n<p>For example, to share <code>\/srv\/nfs_share<\/code> with a client at IP <code>192.168.1.100<\/code> with read-write access:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/srv\/nfs_share 192.168.1.100(rw,sync,no_subtree_check)<\/code><\/pre>\n\n\n\n<p><strong>Explanation of Options<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>rw<\/code>: Allows read and write access.<\/li>\n\n\n\n<li><code>sync<\/code>: Writes changes to disk before confirming.<\/li>\n\n\n\n<li><code>no_subtree_check<\/code>: Prevents subtree checking for better performance.<\/li>\n<\/ul>\n\n\n\n<p>3. <strong>Save and close<\/strong> the file.<\/p>\n\n\n\n<p>4. <strong>Apply the changes<\/strong> by exporting the shared directories:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo exportfs -a<\/code><\/pre>\n\n\n\n<p>5. Verify the NFS share<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo exportfs -v<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Configure the Firewall (if applicable)<\/h3>\n\n\n\n<p>If you have a firewall enabled, allow NFS service traffic.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Open NFS ports<\/strong>:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow from 192.168.1.0\/24 to any port nfs # On Debian\/Ubuntu with UFW<br>sudo firewall-cmd --permanent --add-service=nfs # On CentOS\/RHEL with Firewalld<br>sudo firewall-cmd --reload<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Mount the NFS Share on the Client<\/h3>\n\n\n\n<p>Now that the server is configured, set up the client to access the shared directory.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Install NFS client<\/strong> packages:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install nfs-common     # On Debian\/Ubuntu\nsudo yum install nfs-utils      # On CentOS\/RHEL<\/code><\/pre>\n\n\n\n<p>2. <strong>Create a mount point<\/strong> on the client:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mkdir -p \/mnt\/nfs_share<\/code><\/pre>\n\n\n\n<p>3. <strong>Mount the NFS share<\/strong> to the client\u2019s mount point:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mount -t nfs 192.168.1.10:\/srv\/nfs_share \/mnt\/nfs_share<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Replace <code>192.168.1.10<\/code> with the IP of your NFS server.<\/li>\n<\/ul>\n\n\n\n<p>4. <strong>Verify the mount<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df -h | grep nfs_share<\/code><\/pre>\n\n\n\n<p>5. <strong>Access the shared directory<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ls \/mnt\/nfs_share<br>cat \/mnt\/nfs_share\/test.txt<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 6: Auto-mount the NFS Share at Boot (Optional)<\/h3>\n\n\n\n<p>To automatically mount the NFS share at boot, add it to the <code>\/etc\/fstab<\/code> file on the client.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Open the fstab file<\/strong>:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vi \/etc\/fstab<\/code><\/pre>\n\n\n\n<p>2. Add the following entry at the end of the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>192.168.1.10:\/srv\/nfs_share  \/mnt\/nfs_share  nfs  defaults  0  0<\/code><\/pre>\n\n\n\n<p>3. <strong>Save and close the file<\/strong>.<\/p>\n\n\n\n<p>4. <strong>Test the fstab entry<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mount -a<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 7: Manage and Troubleshoot NFS<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">1. <strong>To unmount the NFS share<\/strong>:<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo umount \/mnt\/nfs_share<\/code><\/pre>\n\n\n\n<p>2. <strong>To restart the NFS service<\/strong> on the server<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart nfs-server<\/code><\/pre>\n\n\n\n<p>3. <strong>To check NFS logs<\/strong> for troubleshooting:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo tail -f \/var\/log\/syslog # On Debian\/Ubuntu<br>sudo tail -f \/var\/log\/messages # On CentOS\/RHEL<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Final word<\/h3>\n\n\n\n<p>You\u2019ve now set up an NFS server to share directories with Linux clients over a network. This setup allows easy access to shared files, making it ideal for environments that need centralized file storage.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview of NFS Network File System (NFS) is a distributed file system protocol that allows you to share directories and files with other Linux clients over a network. It\u2019s often used for centralized storage where files need to be accessed across different systems. Prerequisites Step 1: Install NFS on the Server 2. Install the NFS [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_eb_attr":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"doc_category":[1820,1824,1879,2128],"doc_tag":[],"class_list":["post-16569","docs","type-docs","status-publish","hentry","doc_category-cloud-servers-in-kenya","doc_category-dedicated-servers","doc_category-servers","doc_category-vps-servers"],"year_month":"2026-06","word_count":616,"total_views":0,"reactions":{"happy":0,"normal":0,"sad":0},"author_info":{"name":"Eugene","author_nicename":"eugene","author_url":"https:\/\/truehost.com\/support\/author\/eugene\/"},"doc_category_info":[{"term_name":"Cloud servers in Kenya","term_url":"https:\/\/truehost.com\/support\/docs-category\/cloud-servers-in-kenya\/"},{"term_name":"dedicated servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/dedicated-servers\/"},{"term_name":"Servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/servers\/"},{"term_name":"VPS-Servers","term_url":"https:\/\/truehost.com\/support\/docs-category\/vps-servers\/"}],"doc_tag_info":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Set Up Network File System (NFS) on a Linux Server -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-network-file-system-nfs-on-a-linux-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Set Up Network File System (NFS) on a Linux Server -\" \/>\n<meta property=\"og:description\" content=\"Overview of NFS Network File System (NFS) is a distributed file system protocol that allows you to share directories and files with other Linux clients over a network. It\u2019s often used for centralized storage where files need to be accessed across different systems. Prerequisites Step 1: Install NFS on the Server 2. Install the NFS [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-network-file-system-nfs-on-a-linux-server\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-02T08:05:49+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-network-file-system-nfs-on-a-linux-server\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-network-file-system-nfs-on-a-linux-server\\\/\",\"name\":\"How to Set Up Network File System (NFS) on a Linux Server -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#website\"},\"datePublished\":\"2024-11-02T08:04:54+00:00\",\"dateModified\":\"2024-11-02T08:05:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-network-file-system-nfs-on-a-linux-server\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-network-file-system-nfs-on-a-linux-server\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/knowledge-base\\\/how-to-set-up-network-file-system-nfs-on-a-linux-server\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/truehost.com\\\/support\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Set Up Network File System (NFS) on a Linux Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#website\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/\",\"name\":\"\",\"description\":\"Help In a Click\",\"publisher\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/truehost.com\\\/support\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#organization\",\"name\":\"Truehost Kenya\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"contentUrl\":\"https:\\\/\\\/truehost.com\\\/support\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/cropped-image_2026-04-16_174808866.png\",\"width\":240,\"height\":48,\"caption\":\"Truehost Kenya\"},\"image\":{\"@id\":\"https:\\\/\\\/truehost.com\\\/support\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Set Up Network File System (NFS) on a Linux Server -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-network-file-system-nfs-on-a-linux-server\/","og_locale":"en_US","og_type":"article","og_title":"How to Set Up Network File System (NFS) on a Linux Server -","og_description":"Overview of NFS Network File System (NFS) is a distributed file system protocol that allows you to share directories and files with other Linux clients over a network. It\u2019s often used for centralized storage where files need to be accessed across different systems. Prerequisites Step 1: Install NFS on the Server 2. Install the NFS [&hellip;]","og_url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-network-file-system-nfs-on-a-linux-server\/","article_modified_time":"2024-11-02T08:05:49+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-network-file-system-nfs-on-a-linux-server\/","url":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-network-file-system-nfs-on-a-linux-server\/","name":"How to Set Up Network File System (NFS) on a Linux Server -","isPartOf":{"@id":"https:\/\/truehost.com\/support\/#website"},"datePublished":"2024-11-02T08:04:54+00:00","dateModified":"2024-11-02T08:05:49+00:00","breadcrumb":{"@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-network-file-system-nfs-on-a-linux-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-network-file-system-nfs-on-a-linux-server\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/truehost.com\/support\/knowledge-base\/how-to-set-up-network-file-system-nfs-on-a-linux-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/truehost.com\/support\/"},{"@type":"ListItem","position":2,"name":"How to Set Up Network File System (NFS) on a Linux Server"}]},{"@type":"WebSite","@id":"https:\/\/truehost.com\/support\/#website","url":"https:\/\/truehost.com\/support\/","name":"","description":"Help In a Click","publisher":{"@id":"https:\/\/truehost.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/truehost.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/truehost.com\/support\/#organization","name":"Truehost Kenya","url":"https:\/\/truehost.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/truehost.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","contentUrl":"https:\/\/truehost.com\/support\/wp-content\/uploads\/2026\/04\/cropped-image_2026-04-16_174808866.png","width":240,"height":48,"caption":"Truehost Kenya"},"image":{"@id":"https:\/\/truehost.com\/support\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/16569","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/comments?post=16569"}],"version-history":[{"count":1,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/16569\/revisions"}],"predecessor-version":[{"id":16570,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/docs\/16569\/revisions\/16570"}],"wp:attachment":[{"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/media?parent=16569"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_category?post=16569"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/truehost.com\/support\/wp-json\/wp\/v2\/doc_tag?post=16569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}