NFS Server and Client

My environment :

  1. Web server : 10.103.104.5
    • Directory : /var/www/html/web
  2. CMS/Image server : 10.103.104.10
    • Directory : /var/www/html/cms
  3. NFS server : 10.103.104.20
    • Directory backup : /backup/web and /backup/cms

Package needs :

  • portmap
  • CentOS 5

  • rpcbind
  • CentOS 6

  • rpcidmap
  • nfs

Start service

# service portmap start or service rpcbind start
# service rpcidmap start
# service nfs start

NFS server :

# mkdir -p /backup/web
# mkdir -p /backup/cms

Make owner of directory for backup to nfsnobody

# Chown -R nfsnobody:nfsnobody /backup

Give permission :

# chmod -R 755 /backup

Edit file export

# nano /etc/export

# exportfs -a

Web server :
Package needs same like NFS server
Start service same too.

Create directory anywhere you want, I suggest /mnt/…..

# mkdir -p /mnt/nfs/web
# mount 10.103.104.20:/backup/web mnt/nfs/web

If not add mount to fstab file, mount temporary only

# nano /etc/fstab

Add line at end of line

# mount -a

CMS server :
Package needs same like NFS server
Start service same too.

Create directory anywhere you want, I suggest /mnt/…..

# mkdir -p /mnt/nfs/web
# mount 10.103.104.20:/backup/web mnt/nfs/web

If not add mount to fstab file, mount temporary only

# nano /etc/fstab

Add line at end of line

# mount -a

Now you can test with write something from web server and CMS server.
Web server test

# touch /mnt/nfs/web/test_file.txt

CMS server test

# touch /mnt/nfs/cms/test_file.txt

Check in NFS server

# ls -la /backup/web/
total 8
drwxr-xr-x 2 nfsnobody nfsnobody 4096 Apr 20 23:37 .
drwxr-xr-x 7 nfsnobody nfsnobody 4096 Apr 20 23:29 ..
-rw-r–r– 1 nfsnobody nfsnobody 0 Apr 20 23:37 test_file.txt
# ls -la /backup/cms/
total 8
drwxr-xr-x 2 nfsnobody nfsnobody 4096 Apr 20 23:37 .
drwxr-xr-x 7 nfsnobody nfsnobody 4096 Apr 20 23:29 ..
-rw-r–r– 1 nfsnobody nfsnobody 0 Apr 20 23:37 test_file.txt

0 thoughts on “NFS Server and Client

  1. Pingback: how to rdiff-backup with list increments | PHP Developer Resource

  2. Pingback: Stephen

Leave a Reply