install nfs
install nfs
com/nfs-server-and-client-on-centos-7
https://www.golinuxcloud.com/show-nfs-shares-list-nfs-client-mount-points/
1 Preliminary Note
I have fresh installed CentOS 7 server, on which I am going to install the NFS
server. My CentOS server have hostname server1.example.com and IP as 192.168.0.100
If you don't have a CentOS server installed yet, use this tutorial for the basic
operating system installation. Additionally to the server, we need a CentOS 7
client machine, this can be either a server or desktop system. In my case, I will
use a CentOS 7 desktop with hostname client1.example.com and IP 192.168.0.101 as
a client. I will run all the commands in this tutorial as the root user.
mkdir /var/nfsshare
Change the permissions of the folder as follows:
/var/nfsshare 192.168.0.101(rw,sync,no_root_squash,no_all_squash)
/home 192.168.0.101(rw,sync,no_root_squash,no_all_squash)
Note 192.168.0.101 is the IP of the client machine, if you wish that any other
client should access it you need to add it IP wise otherwise you can add "*"
instead of IP for all IP access.
mkdir -p /mnt/nfs/home
mkdir -p /mnt/nfs/var/nfsshare
Next, we will mount the NFS shared home directory in the client machine as shown
below:
df -kh
[root@client1 ~]# df -kh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 39G 1.1G 38G 3% /
devtmpfs 488M 0 488M 0% /dev
tmpfs 494M 0 494M 0% /dev/shm
tmpfs 494M 6.7M 487M 2% /run
tmpfs 494M 0 494M 0% /sys/fs/cgroup
/dev/mapper/centos-home 19G 33M 19G 1% /home
/dev/sda1 497M 126M 372M 26% /boot
192.168.0.100:/var/nfsshare 39G 980M 38G 3% /mnt/nfs/var/nfsshare
192.168.0.100:/home 19G 33M 19G 1% /mnt/nfs/home
[root@client1 ~]#
So we are connected with the NFS share.
Now we will check the read/write permissions in the shared path. At client enter
the command:
touch /mnt/nfs/var/nfsshare/test_nfs
So we successfully configured an NFS-share.
nano /etc/fstab
Add the entries like this:
[...]
erpdb:/backup /backup_sap nfs vers=3,rsize=8192,wsize=8192,timeo=14,intr
0 0
192.168.0.100:/home /mnt/nfs/home nfs defaults 0 0
192.168.0.100:/var/nfsshare /mnt/nfs/var/nfsshare nfs defaults 0 0
Note 192.168.0.100 is the server NFS-share IP address, it will vary in your case.
This will make the permanent mount of the NFS-share. Now you can reboot the machine
and mount points will be permanent even after the reboot.