Data Networking/Fall 2014/Priya/NFS Configuration

From Wikiversity
Jump to navigation Jump to search

In this article, we will describe the steps and procedures required to install and configure NFS on a Linux machine, (specifically Ubuntu 14.04).

Step 1
Installing NFS server

To install NFS server on Ubuntu 14.04, use the following commands Update Linux files

    apt-get install nfs-kernel-server

Create a directory to be shared with our network users (for example, /home/shared_users directory). Also, modify the directory and file permissions to allow users to mount and access these files.

    mkdir -p /export/users
    chmod 777 /export
    chmod 777 /export/users

Next step is to mount the /export/users directory to /home/shared_peter directory

    mount --bind /home/shared_users /export/users

Append the following line to /etc/fstab, to avoid mounting the directory for every system reboot

    /home/shared_users    /export/users   none    bind  0  0

Now add the following line to /etc/exports (notice that our networks has the Network IP address 192.168.3.0/24)

    /export/users 192.168.3.0/24(rw,nohide,insecure,no_subtree_check,async)

Reboot the NFS server

    service nfs-kernel-server restart

After successfully installing and configuring NFS server, we need to install NFS client for our network clients



Step 2
Installing NFS client (NFSv4)

To install NFS client on Ubuntu 14.04, use the following commands Update Linux files

    apt-get install nfs-common

After installing NFSv4, simply mount a directory on the client machine (/mnt) to the shared directory on the NFS server

    mount -t nfs -o proto=tcp,port=2049 192.168.3.50:/export/users /mnt

Append the following line to /etc/fstab, to avoid mounting the directory for every system reboot

    nfs-server:/   /mnt   nfs    auto  0  0

Congratulation! NFS server and client has been successfully installed and configured in your network.