Installing and Configring NFS Server step by
step
Follow
these steps to install an NFS server.
Step 1. To begin the NFS server setup, install the required packages:
#
yum install -y nfs-utils nfs4-acl-tools
Step 2. Verify the package installation:
#
rpm -qa | grep nfs
nfs4-acl-tools-0.3.3-5.el6.x86_64
nfs-utils-1.2.2-7.el6.x86_64
Step 3. The NFS server uses three different services to function
properly. You need to enable them all at boot for the NFS server to function
the way
it
should:
#
chkconfig nfs on
#
chkconfig nfslock on
#
chkconfig rpcbind on
Step 4. Verify that all three services are set to start on system boot:
#
chkconfig --list nfs
nfs
0:off 1:off 2:on 3:on 4:on 5:on 6:off
#
chkconfig --list nfslock
nfslock
0:off 1:off 2:on 3:on 4:on 5:on 6:off
#
chkconfig --list rpcbind
netfs
0:off 1:off 2:on 3:on 4:on 5:on 6:off
You
should also verify that the NFS service is currently stopped because you need
to make some configuration changes before you can start it.
Step 5. Verify that the service is off:
#
service nfs status
rpc.mountd
is stopped
nfsd
is stopped
rpc.rquotad
is stopped
Configuring NFS
For
the first configuration step, you need to make a few changes to the main config
file.
Step 1. Open the main config file for editing:
#
nano /etc/sysconfig/nfs
Step 2. Uncomment the following lines:
MOUNTD_NFS_V1=”no”
MOUNTD_NFS_V2=”no”
MOUNTD_NFS_V3=”no”
RPCNFSDARGS=”-N
2 -N 3”
The
first three lines disable the mountd daemon from accepting anything below
version 4. The last line disables the NFS service from even advertising
anything but version 4 as well.
Step 3. Save the file and exit.
Next,
let’s work with the /etc/exports file because this defines what resources will
be available to your clients. If the file doesn’t exist already, you can create
it. The syntax of the /etc/exports file is <mountpoint> <host><permissions/options>
Step 4. Set up your exports in the /etc/exports files to be available to
any client on the network:
#
nano /etc/exports
/home *(ro,sync)
/opt/company_data *(rw,sync)
Here,
you define two resources that you will make available. The first line defines
the /home directory to be exported and allows read-only access to all clients.
The second line provides the /opt/company_data directory to all of your clients
with read and write permissions. After you finish defining all the resources
you want to export, save and close the file.
Step 5. Start the two NFS services (rpcbindshould be running already by
default):
#
service nfslock start
Starting
NFS statd: [ OK ]
#
service nfs start
Starting
NFS services: [ OK ]
Starting
NFS quotas: [ OK ]
Starting
NFS daemon: [ OK ]
Starting
NFS mountd: [ OK ]
Step 6: Verify that the services have started successfully:
#
service rpcbind status
rpcbind
(pid 25068) is running...
#
service nfslock status
rpc.statd
(pid 17726) is running...
#
service nfs status
rpc.svcgssd
is stopped
rpc.mountd
(pid 17780) is running...
nfsd
(pid 17777 17776 17775 17774 17773 17772 17771 17770) is
running...
0 comments:
Post a Comment