Guide Creating NFS Server on Linux

Boot up servers and check hosts name using these commands.
#Hostname -> Hit enter and you will see hosts name and you should change names. (#hostnamectl these command useful.)
Try to change hostnames using these commands.
#Nmtui -> Hit enter if it is not found you can install it then change hostname or try to change host name again using and (#sudo hostnamectl set-hostname nfsserver and repeat it second server #sudo hostnamectl set-hostname nfsclient) or (#sudo nano /etc/hostname or #sudo nano /etc/hosts after chages name try to #sudo reboot -> hit enter. The changes take effect immediately after System reboot.)

Check IP address #ip addr.
If you see the same IP, try to renew it using #sudo dhclient and then #ip addr-> hit enter-> you will see New IP.

1) NFS Client Configuration - #sudo apt install NFS-common
2) Create any folder with any name - #sudo mkdir /data
3) Try to check file server if it is shared for NFS Client #showmount -e 192.168.234.132

Mount shared folder on NFS server folder to NFS Client. There are 2 ways.
1- Mount
#Sudo mkdir /data (creting directory)
# Sudo Mount -t NFS 192.168.234.132:/data /data (mounting nfsserver IP to NFS Client) second data folder on nfscleint.
#Mount (shows us )
2-fstab
#Sudo umount -t NFS 192.168.234.132:/data /data -> hit neter for unmount then #mount -> to see are there mounted somesing.
Output (this command unmount the first mounting)
Adding shared folders path into fstab.
#Sudo nano /etc/fstab -> hit enter.
Add this string into fstab file and see and close.
192.168.234.132:/data /data NFS defaults, _netdev 0 0
You should check again if there is mounted path. - #sudo Mount (shows us)

Last Action is activate fstab Mount string. - #sudo Mount -a -> it will Mount path.

Try create file in Client server to see if file replicated with NFS server:
#Cd /data
#Data$ touch test. 1 -> this is creates 1 file.
Then GO folder /data on nfsclient.
And GO to nfsserver -> data folder to see it is exists

Thanks for attention.
 
Son düzenleyen: Moderatör:

Yeni konular

Geri
Yukarı