Contents...
UNFS3 is a user-space implementation of the NFS (Network File System) version 3 server specification. It provides a daemon for the MOUNT and NFS protocols, which are used by NFS clients for accessing files on the server.
In this article I will how you how to install unfs3 on CentOS 6.x machine.
Install unfs3
First of all you have to add the required repository to install unfs3 you can also installed it via source package but in this article I will use yum command to install. Follow the below command to add the RPMFrge repository on system.
1. Download the latest rpmforge-release rpm from below url.
http://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el6/en/i386/rpmforge/RPMS/
For example:
# wget http://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
2. Install rpmforge-release rpm using below command
# rpm -Uvh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
3. Install unfs3 rpm package using below command
# yum install unfs3
UNFSD Sever Side Configuration
Now it’s time to edit/create the exports file. This file tells unfsd what to share, with what rules.
# touch /etc/exports # nano /etc/exports
You should be presented with an empty file. You should insert the following line, but edit it for your situation:
/opt/data 192.168.65.52(rw,no_root_squash) /opt/backup 192.168.65.52(rw,no_root_squash)
Start unfsd listening to default tcp port 2049:
#/usr/sbin/unfsd -t -p
Or run unfsd command for default start
# unfsd
Start another instance of unfsd listening on port 2050 and registered to ortmap for RHEL-6.
# /usr/sbin/unfsd -t -n2050 -m2050
So, the server that listens on 2049 is used by older CentOS-5 servers and clients need to be told to connect to the respective tcp ports directly. While CentOS-6 servers will query portmap for the port to connect to.
Now run the below command to check unfsd running successful on sytem.
# netstat -tunlp | grep unfsd tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN 8702/unfsd tcp 0 0 0.0.0.0:2050 0.0.0.0:* LISTEN 9381/unfsd
Type the below command to show the exported directory on system.
# showmount -e Export list for app.looklinux.com: /opt/data 192.168.65.52 /opt/backup 192.168.65.52
UNFSD is running successfully on your system. Now lets go to client side configuration.
UNFSD Client Side Configuration
Now mount exported directory on client side. Mounting NFS directory on client side is very easy created a directory where you want to mount NFS directory and edit /etc/fstab file and put the below line.
# mkdir /mnt/data # mkdir /mnt/backup
# vim /etc/fstab # mount nfs 192.168.65.52:/opt/data /mnt/data nfs port=2050,mountport=2050,mountvers=3,nfsvers=3,tcp,nolock,intr 0 0 192.168.65.52:/opt/backup /mnt/backup nfs port=2050,mountport=2050,mountvers=3,nfsvers=3,tcp,nolock,intr 0 0
Save and close file and run the below command to apply the /etc/fstab file changes.
# mount -a
Verify the nfs directory mounted successfully using below command.
# df -h 192.168.65.52:/opt/data 120G 113G 7.2G 95% /mnt/data 192.168.65.52:/opt/backup 8.0G 4.2G 3.9G 52% /mnt/backup
Configuration! your NFS directory mounted successfully on your system.
If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.
Leave a Comment