Monday, April 17, 2017

RHEL7 - NFS server share and mounting at client

RHEL7 - NFS server share and mounting at client



On NFS server
1. Install nfs server package
# yum install nfs-utils

2. Start nfs server service
# systemctl enable nfs-server.service
# systemctl start nfs-server.service

3. Disable to add nfs service to firewall
# systemctl stop firewalld
or
# firewall-cmd --permanent --zone=public --add-service=nfs
# firewall-cmd --reload

4. Now, Specify the share and add entry to config file
# mkdir /opt/myshare && chmod 777 /opt/myshare
# vi /etc/exports
/opt/myshare *(rw,sync)

5. Re-read the config
# exportfs -r

6. Verify the share
# exportfs


On client

1. Install the package if not installed
# yum install nfs-utils

2. Create a mount point
# mkdir /opt/www

3. Add entry to /etc/fstab
# vi /etc/fstab
nfsserver:/the_share /opt/www nfs defaults 0 0

4. Mount the share on the client
# mount -a
or
# mount /opt/www
or
# mount nfsserver:/shared_path /mountpoint
# mount 192.168.10.20:/opt/myshare /opt/www

Verify the mount
# df -h /opt/www
#


Troubleshooting steps
- most importantly the issue is because of firewall. Add nfs service to allow the connection to server or port 2049.
- Make sure both servers can ping each other.
- verify all the configuration files that there is no typo.

No comments:

Post a Comment