User:Renich/HowTo/NFSv4

= Sharing files with NFSv4 on Fedora 12 (Server & Client configuration) =

Description
This HowTo explains how to set up the  on your LAN for multiple shares. It explains, also, how to mount the  on your client.

Applicable to Fedora Versions

 * Fedora 12

Requirements
The  package provides what's need for both then client and the server. Usually, it comes preinstalled on an "out-of-the-box" installation of Fedora. However, to make sure it's installed run the following command. Enter your  password when prompted:

su -c "yum install nfs-utils"

The following are only services.

Configuring the server
su -c "system-config-firewall"
 * Open up the necessary port on the firewall . Activate the Firewall tool. You will be asked for your  password. Please enter it:


 * Activate  and click OK.

su -c "gedit /etc/idmapd.conf"
 * Edit . Enter your   password when prompted:

[General] Domain = example.com
 * Configure your domain name and change the users to :

[Mapping] Nobody-User = nfsnobody Nobody-Group = nfsnobody

su -c "service rpcidmapd start" su -c "service nfslock start" su -c "service nfs start"
 * Start the  and   services, then start the   service. Alternatively, you can use System->Administration->Services GUI. Please enter the   password when prompted:

su -c "chkconfig --level 345 rpcidmapd on" su -c "chkconfig --level 345 nfslock on" su -c "chkconfig --level 345 nfs on"
 * Set,  , and   services to start on boot. Alternatively, you can use System->Administration->Services GUI. Please enter the   password when prompted:

su -c "mkdir -p /nfs4exports/{share1,share2,share3}"
 * Create the directories of the exports inside . Enter your   password when prompted:

su -c "gedit /etc/fstab"
 * Edit :

/path/to/share1		/nfs4exports/share1	none	bind	0 0 /path/to/share2		/nfs4exports/share2	none	bind	0 0 /path/to/share3		/nfs4exports/share3	none	bind	0 0
 * Bind the desired shares to the, recently created, directories; at :

su -c "mount -a"
 * Remount everything. Enter your  password when prompted:

su -c "gedit /etc/exports"
 * Edit . Enter your   password when prompted:

/nfs4exports			192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide,fsid=0) /nfs4exports/share1		192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide) /nfs4exports/share2            192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide) /nfs4exports/share3            192.168.1.0/255.255.255.0(rw,insecure,no_subtree_check,nohide)
 * Add your shares here (available to your home network) If you want your shares to be read only, change  to   from these statements:

su -c "/usr/sbin/exportfs -rv"
 * Reload your exports. Please enter your  password when prompted:

su -c "gedit /etc/hosts.allow"
 * Edit your  file, so your clients are allowed to access your nfs. Please enter your   password when prompted:

rpcbind: 192.168.1.0/255.255.255.0
 * Allow your LAN to access your services:

su -c "/sbin/shutdown -r now"

Configuring the clients
su -c "gedit /etc/idmapd.conf"
 * Edit . Enter your   password when prompted:

[General] Domain = example.com
 * Configure your domain name and change the users to :

[Mapping] Nobody-User = nfsnobody Nobody-Group = nfsnobody

su -c "gedit /etc/fstab"
 * Edit . Please enter your   password when prompted:

su -c "mkdir /mnt/shares /home/me/share1 /home/he/share2 /home/it/share3"
 * Create the mounting directories:

:/	/mnt/shares	nfs4	rsize=8192,wsize=8192,timeo=14,soft :/share1	/home/me/share1	nfs4	rsize=8192,wsize=8192,timeo=14,soft :/share2	/home/he/share2	nfs4	rsize=8192,wsize=8192,timeo=14,soft :/share3	/home/it/share3	nfs4	rsize=8192,wsize=8192,timeo=14,soft
 * Add the desired shares:

su -c "mount -a"
 * Remount everything:

How to test
Next time...

Exported subdirectory appears empty
If  appears empty on the client make sure it's exported with the   parameter. Because  was mounted under , the client can't see it unless the   parameter is used.

More Information
RedHat recommends, on RHEL5 Docs, that one should use automount instead of /etc/fstab; which saves resources when sharing to multiple workstations. I haven't had the time to try this configuration. This document will be modified/augmented once I've got the hang of it.

Disclaimer
I haven't had the opportunity to test this HowTo since I lack of a networked PC to do it, so you may run into problems, if you do, come to #fedora on irc.freenode.net or leave me messages so I know what's up. Feel free to propose changes and stuff.

Added Reading

 * http://www.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/5.4/html/Deployment_Guide/ch-nfs.html
 * http://www.brennan.id.au/19-Network_File_System.html