Connecting Clients Via NFS
Setting
up a client to use NFS is relatively simple when you have the NFS server in place.
Let’s set up the Client01 system to use a share on the RHEL01 NFS server.
Step 1. To start, you need to install the required packages:
#
yum install -y nfs-utils nfs4-acl-tools
These
two packages include the necessary files for you to connect to the NFS server
and use the exported resources. On the client side, you need only the rpcbind
service running to mount NFS resources on the server.
Step 2. Ensure that the required service is set to start on boot:
#
chkconfig rpcbind on
You
can now create some directories to hold the NFS shares on the local system.
Step 3. Create two local directories:
#
mkdir /mnt/{company_data,temp}
Step 4. Mount the company_data NFS share:
#
mount –t nfs 172.168.1.1:/opt/company_data /mnt/company_data
Assuming
your permissions and security restrictions are correctly in place, you should
now be able to move into the /mnt/company_data directory and actually access
the NFS share on the server. If you don’t want to always mount NFS shares after
your system has booted, you can, of course, add an entry to the /etc/fstab file
to have them mounted automatically at system boot.
Step 1. In the /etc/fstab, add the following line:
#
nano /etc/fstab
rhel01:/opt/company_data /opt/company_data nfs
rw,sync
0 0
It
mounts the remote /opt/company_data to the local /mnt/company_data directory.
Step 2. Save your file and exit.
Step 3. Using the mount command, you can verify that the resource was
mounted
properly:
#
mount | grep nfs
sunrpc
on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd
on /proc/fs/nfsd type nfsd (rw)
172.168.1.1:/home
on /mnt/temp type nfs
(rw,vers=4,addr=172.168.1.1,clientaddr=172.168.1.10)
172.168.1.1:/opt/company_data
on /mnt/company_data type nfs
(rw,vers=4,addr=172.168.1.1,clientaddr=172.168.1.10)
The
remote resource should now be available just as if it were a local resource.
0 comments:
Post a Comment