Monday, July 13, 2015

How To Set Up an NFS Mount (Network File System) on AWS Linux

How To Set Up an NFS Mount (Network File System) on AWS Linux


Setup

An NFS mount is set up between at least two servers. The machine hosting the shared network is called the server, while the ones that connect to it are called ‘clients’.

Setting Up the NFS Server
1. Use yum to install nfs-utils

yum install nfs-utils nfs-utils-lib


2. run following commands to configure NFS server

sudo chkconfig nfs on
sudo service rpcbind start
sudo service nfs start

3. Export directory
sudo vi /etc/exports

add the following line (eg. for sharing /var/www/html)
/var/www/html *(rw,sync)

save

run the following command
sudo exportfs -a

Setting Up the NFS Client
1. Use yum to install nfs-utils

yum install nfs-utils nfs-utils-lib

2.create directory

mkdir -p /var/www/shared

3. mount folder
run the following command
sudo mount :/var/www/html /var/www/shared

4. verify mount worked
df -h

5.Ensure the mount is always active by adding the directory to the fstab file

vi /etc/fstab

add the following entry

:/var/www/html  /var/www/shared nfs rw,suid,dev,exec,auto,nouser,async    0 0

save