Run sudo yum install nfs-utils to install the necessary NFS package.
Enable and Start NFS Service:
Enable the NFS server to start on boot with the command: sudo systemctl enable nfs-server.
Start the NFS service with the command: sudo systemctl start nfs-server.
Configure NFS Exports:
Decide which directories you want to share over NFS and create them if they don't already exist, e.g., sudo mkdir /var/nfs.
Edit the /etc/exports file to specify the directories to share and their permissions. You can do this with a text editor like vi or nano.
For example, to share /var/nfs with a client machine 192.168.1.100 with read-write access, add this line to /etc/exports:
/var/nfs 192.168.1.100(rw,sync,no_subtree_check)
Apply the configuration by running sudo exportfs -a.
Adjust Firewall Settings (if applicable):
If you're running a firewall, you'll need to allow NFS traffic:
Run sudo firewall-cmd --permanent --zone=public --add-service=nfs
Run sudo firewall-cmd --permanent --zone=public --add-service=mountd
Run sudo firewall-cmd --permanent --zone=public --add-service=rpc-bind
Reload the firewall settings with sudo firewall-cmd --reload.
Verify the NFS Server Configuration:
Check the status of the NFS server with sudo systemctl status nfs-server.
Show the shares available on the server with showmount -e.
After following these steps, your NFS server should be set up and sharing directories with the specified clients. Clients will then need to mount these directories to access them. Please replace IP addresses and directory paths with ones that are appropriate for your network configuration.
Then go do mount
sudo mkdir /mnt/nfs
sudo mount -t nfs 10.146.0.74:/var/nfs /mnt/nfs
Install NFS Server Package:
sudo yum install nfs-utils
to install the necessary NFS package.Enable and Start NFS Service:
sudo systemctl enable nfs-server
.sudo systemctl start nfs-server
.Configure NFS Exports:
Decide which directories you want to share over NFS and create them if they don't already exist, e.g.,
sudo mkdir /var/nfs
.Edit the
/etc/exports
file to specify the directories to share and their permissions. You can do this with a text editor likevi
ornano
.For example, to share
/var/nfs
with a client machine192.168.1.100
with read-write access, add this line to/etc/exports
:Apply the configuration by running
sudo exportfs -a
.Adjust Firewall Settings (if applicable):
sudo firewall-cmd --permanent --zone=public --add-service=nfs
sudo firewall-cmd --permanent --zone=public --add-service=mountd
sudo firewall-cmd --permanent --zone=public --add-service=rpc-bind
sudo firewall-cmd --reload
.Verify the NFS Server Configuration:
sudo systemctl status nfs-server
.showmount -e
.After following these steps, your NFS server should be set up and sharing directories with the specified clients. Clients will then need to mount these directories to access them. Please replace IP addresses and directory paths with ones that are appropriate for your network configuration.
Then go do mount
sudo mkdir /mnt/nfs sudo mount -t nfs 10.146.0.74:/var/nfs /mnt/nfs