Install and Configure NFS Server Kodekloud

 


Solution:

At first configure the storage server

Login to storage server

ssh natasha@ststor01

sudo su

Set up nfs server

yum install -y nfs-utils nfs-utils-lib

Read the question and find the directory. My directory is /code . You can find different directory.

Edit the /etc/exports

vi /etc/exports
/code 172.16.238.10(rw,sync,no_root_squash)
/code 172.16.238.11(rw,sync,no_root_squash)
/code 172.16.238.12(rw,sync,no_root_squash)

Enable, start and check status


systemctl enable nfs-server && sudo systemctl start nfs-server && sudo systemctl status nfs-server

Check the export and mount configuration

exportfs  -av

sudo showmount -e ststor01

Install open ssh client

yum install -y openssh-clients openssh

Now open another terminal and go to jump server

Copy index.html from jump server to storage server

scp /tmp/index.html natasha@ststor01:/tmp

Now, Back to storage server and copy index.html from /tmp to /code folder

cp /tmp/index.html /code

Now go to stapp01, stapp02, and stapp03 server and do the followings in every appserver

Set nfs in all appservers

yum install nfs-utils nfs-utils-lib

Create the mentioned directory in the question and mount the nfs server on this newly created directory

mkdir -p /var/www/app

sudo mount -t nfs 172.16.238.15:/code /var/www/app

Enable, Start, and Show status

systemctl enable nfs-server && sudo systemctl start nfs-server && sudo systemctl status nfs-server

Add the mount point permanently

vi /etc/fstab
echo 172.16.238.15:/code /var/www/app nfs defaults 0 0 > /etc/fstab

Now check the /var/www/app directory in all app servers. You can find the index.html file which is originally located in storage server.


 

Download Coding Interview Book and Get More Tutorials for Coding and Interview Solution: Click Here

Download System Design Interview Book and Get More Tutorials and Interview Solution: Click Here

Do you need more Guidance or Help? Then Book 1:1 Quick Call with Me: Click Here

Share on Google Plus

About Ashadullah Shawon

I am Ashadullah Shawon. I am a Software Engineer. I studied Computer Science and Engineering (CSE) at RUET. I Like To Share Knowledge. Learn More: Click Here
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment