This mounting procedure is needed when you want to mount a directory between 2 Linux servers. In this example I created it in Linux Centos.

What you need?

Host Linux server ( where the source directory and its data exists ):    10.0.0.1

Client server ( where we create the mount to connect to the Hosted Linux server ):   10.0.0.2

Directory to share: /data/application-folder

U need root access in order to install the libraries and edit the Linux configuration.

NFS Server

The host Linux server must be setup for a NFS server.

yum install nfs-utils nfs-utils-lib

add the configuration to the startup and start them

chkconfig nfs on

service rpcbind start

service nfs start

Export Directory

Next we need to tell the Host server which directory he must share, and who has access to it and what are their access-rights.

vi /etc/exports

Add the line:

/data/application-folder       10.0.0.2(rw,sync,no_root_squash)

Now export them:

exportfs -a

Client Server

Now we can setup the other server and add the directory via a mount.

We have to install the same programs.

yum install nfs-utils nfs-utils-lib

Create and Mount

mkdir -p /data/application-folder

mount 10.0.0.1:/data/application-folder

You can check it by entering the command:

df -h

Add the mount to the system

vi /etc/fstab

Add the following line:

10.0.0.1:/data/application-folder /data/application-folder nfs auto,noatime,nolock,bg,nfsvers=3,intr,tcp,actimeo=1800 0 0

Visits: 517

By angioni

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.