In Redhat Linux, to share NFS, we need to configure /etc/exports, the format of exports is:
For example, if we want to share directory /data/forhost1 to host1, we can configure my /etc/exports like this:<directory to share> <host>(<option>)
if we only want to grant read permission to /data/forhost1, we can add the ro option, ro stands for read-only/data/forhost1 host1
Solaris uses a different configuration file /etc/dfs/dfstab for NFS./data/forhost1 host1(ro)
If we want to share directory /data/forhost1 to host1, we can configure my /etc/dfs/dfstab like this:
For both RedHat Linux and Solaris, we need to restart the nfs service to make our configuration take effect, this can be done by using service or svcadm.share -F nfs -o ro=host1 -d "Readonly" /data/forhost1
After we share /data/forhost1, we can mount it on host1:
if host1 is Redhat Linux
if host1 is Solaris:mount -t nfs server:/data/forhost1 /mnt/mynfs
mount -F nfs server:/data/forhost1 /mnt/mynfs
To make the nfs mount permanent, we can configure /etc/fstab or /etc/vfstab to mount nfs on system start.