4 февр. 2012 г.

How to export NFS share on Linux

To export a directory/NFS share from Linux you need to have nfs server installed and have nfs services running on your linux (Fedora/CentOS/RHEL) machine.

Checking NFS server status:
Check to see if you have NFS services running on your Linux machine: # ps -aef | grep nfsd
# root 13397 7 0 08:21 ? 00:00:00 [nfsd4]
# root 13398 1 0 08:21 ? 00:00:00 [nfsd]
# root 13399 1 0 08:21 ? 00:00:00 [nfsd]
# root 13400 1 0 08:21 ? 00:00:00 [nfsd]
# root 13401 1 0 08:21 ? 00:00:00 [nfsd]
# root 13402 1 0 08:21 ? 00:00:00 [nfsd]
# root 13403 1 0 08:21 ? 00:00:00 [nfsd]
# root 13404 1 0 08:21 ? 00:00:00 [nfsd]
# root 13405 1 0 08:21 ? 00:00:00 [nfsd]
If you notice nfsd process' running then you have NFS server turned on your Linux machine. If NFS is not running you can start nfs services by running following command on your Linux box where you want to export directory (nfs share): # /etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
Linux uses access control list file called exports to share directory from Linux for NFS clients. Add an entry for directory you want to share in /etc/exports using your favorite editor like vi or pico. In this case nfs export directory will be directory containing Fedora installable media/CD images. Let's say directory to be exported named as /install.Here is your /etc/exports file should look like: # cat /etc/exports
/install *(rw)
The file format is similar to the SunOS exports file used in Solaris. Each line contains an export point and a whitespace-separated list of clients allowed mounting the file system at that point. Each listed client may be immediately followed by a parenthesized, comma-separated list of export options for that client. Make sure that no whitespace is permitted between a client and its option list.

I have used * to allow this share to be mounted by any nfs client on the network and used options as (rw) read and writable , since this is going to be used for Kickstart installation you can use options as read only. Note there is no space between * and (rw).After adding nfs share entry save the file and run following command to export the share # exportfs

Комментариев нет: