INSTALL & CONFIGURE NFS SERVER & CLIENT ON CENTOS 7

Server: 10.10.1.30 (nfs)
Clients: 10.10.1.21 (Web1), 10.10.1.22 (Web2)

NFS SERVER (10.10.1.30)

install and start server

$ sudo yum update
$ sudo yum install net-tools
$ sudo yum install nfs-utils rpcbind
$ sudo mkdir -p /home/moodledata
$ sudo firewall-cmd –permanent –zone=public –add-port=2049/tcp
$ sudo firewall-cmd –reload
$ sudo vi /etc/exports
/var/moodledata 10.10.1.21(rw,no_root_squash)
/var/moodledata 10.10.1.22(rw,no_root_squash)
$ sudo systemctl start rpcbind nfs-server
$ sudo systemctl enable rpcbind nfs-server

 

NFS CLIENT WEB1 (10.10.1.21)

install and mount

$ sudo yum install nfs-utils rpcbind
$ sudo mkdir -p /var/moodledata
$ sudo systemctl start rpcbind
$ sudo systemctl enable rpcbind
$ sudo mount -t nfs nfs:/var/moodledata /var/moodledata

check out the filesystem

$ df -hT

Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/centos-root xfs 8.0G 3.4G 4.7G 42% /
devtmpfs devtmpfs 5.6G 0 5.6G 0% /dev
tmpfs tmpfs 5.6G 0 5.6G 0% /dev/shm
tmpfs tmpfs 5.6G 8.4M 5.6G 1% /run
tmpfs tmpfs 5.6G 0 5.6G 0% /sys/fs/cgroup
/dev/mapper/centos-home xfs 1014M 42M 973M 5% /home
/dev/sda1 xfs 497M 189M 309M 38% /boot
nfs:/home/moodledata nfs4 472G 32M 472G 1% /home/moodledata

if needed later, for unmount, for future reference

$ sudo umount /home/moodledata

configure mount when system boots, add additional line

$ sudo vi /etc/fstab
#added by Mehmet Sen
nfs:/home/moodledata /home/moodledata nfs defaults 0 0

TEST IT

on client:

$ sudo touch /var/moodledata/NFS.test

on server

$ ls -l /var/moodledata

or vice versa

Advertisements

One thought on “INSTALL & CONFIGURE NFS SERVER & CLIENT ON CENTOS 7

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s