Centos Wipe Out Server and Start Again
NFS Server and Customer Installation on CentOS 7
This guide explains how to configure an NFS server on CentOS vii. Network File System (NFS) is a popular distributed filesystem protocol that enables users to mount remote directories on their server. NFS lets you lot leverage storage space in a different location and allows you to write onto the same space from multiple servers or clients in an effortless manner. It, thus, works fairly well for directories that users need to access oftentimes. This tutorial explains the process of mounting an NFS share on a CentOS 7.vi server in simple and easy-to-follow steps.
1 Preliminary Note
I have fresh installed CentOS 7 server, on which I am going to install the NFS server. My CentOS server take hostname server1.case.com and IP every bit 192.168.0.100
If yous don't have a CentOS server installed yet, apply this tutorial for the bones operating organization installation. Additionally to the server, we need a CentOS seven client machine, this can be either a server or desktop system. In my instance, I volition use a CentOS 7 desktop with hostname client1.example.com and IP 192.168.0.101 every bit a client. I will run all the commands in this tutorial every bit the root user.
2 At NFS server end
As the starting time pace, we will install these packages on the CentOS server with yum:
yum install nfs-utils
Now create the directory that will be shared past NFS:
mkdir /var/nfsshare
Change the permissions of the folder equally follows:
chmod -R 755 /var/nfsshare
chown nfsnobody:nfsnobody/var/nfsshare
We utilize/var/nfsshare as a shared folder, if we utilise another drive such equally the/home directory, then the permission changes will cause a massive permissions problem and ruin the whole hierarchy. And then in instance, we want to share the /dwelling directory then permissions must not be changed.
Adjacent, we need to start the services and enable them to be started at kicking time.
systemctl enable rpcbind
systemctl enable nfs-server
systemctl enable nfs-lock
systemctl enable nfs-idmap
systemctl start rpcbind
systemctl start nfs-server
systemctl showtime nfs-lock
systemctl offset nfs-idmap
Now we volition share the NFS directory over the network a follows:
nano /etc/exports
We will make two sharing points /home and /var/nfsshare. Edit the exports file every bit follows:
/var/nfsshare 192.168.0.101(rw,sync,no_root_squash,no_all_squash) /dwelling house 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 y'all wish that any other client should admission it you need to add it IP wise otherwise you tin add together "*" instead of IP for all IP access.
Condition is that it must exist pingable at both ends.
Finally, start the NFS service:
systemctl restart nfs-server
Again we need to add together the NFS service override in CentOS 7 firewall-cmd public zone service as:
firewall-cmd --permanent --zone=public --add-service=nfs
firewall-cmd --permanent --zone=public --add together-service=mountd
firewall-cmd --permanent --zone=public --add-service=rpc-bind
firewall-cmd --reload
Note: If information technology will be not done, and then information technology will give mistake for Connection Time Out at client side.
At present we are ready with the NFS server function.
3 NFS client end
In my instance, I take a CentOS 7 desktop as customer. Other CentOS versions will also work the aforementioned mode. Install the nfs-utild package equally follows:
yum install nfs-utils
Now create the NFS directory mount points:
mkdir -p /mnt/nfs/home
mkdir -p /mnt/nfs/var/nfsshare
Next, we will mount the NFS shared home directory in the customer machine every bit shown beneath:
mount -t nfs 192.168.0.100:/home /mnt/nfs/home/
It will mount /dwelling house of NFS server. Next we will mount the/var/nfsshare directory:
mountain -t nfs 192.168.0.100:/var/nfsshare /mnt/nfs/var/nfsshare/
At present we are continued with the NFS share, we will crosscheck information technology as follows:
df -kh
[[email protected] ~]# 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 six.7M 487M 2% /run
tmpfs 494M 0 494M 0% /sys/fs/cgroup
/dev/mapper/centos-domicile 19G 33M 19G i% /dwelling house
/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 ane% /mnt/nfs/home
[[email protected] ~]#
So we are continued with the NFS share.
Now we will cheque the read/write permissions in the shared path. At client enter the command:
touch on /mnt/nfs/var/nfsshare/test_nfs
And so we successfully configured an NFS-share.
4 Permanent NFS mounting
Nosotros have to re-mount the NFS share at the client after every reboot. Here are the steps to mount it permanently by adding the NFS-share in /etc/fstab file of customer machine:
nano /etc/fstab
Add the entries similar this:
[...]
192.168.0.100:/habitation /mnt/nfs/home nfs defaults 0 0 192.168.0.100:/var/nfsshare /mnt/nfs/var/nfsshare nfs defaults 0 0
Notation 192.168.0.100 is the server NFS-share IP accost, it volition vary in your case.
This will make the permanent mount of the NFS-share. Now you can reboot the car and mount points will exist permanent even after the reboot.
Cheers, now we accept a successfully configured NFS-server over CentOS 7 :)
five Links
- CentOS: http://www.centos.org/
Suggested articles
This feature is but bachelor to subscribers. Get your subscription here.
Source: https://www.howtoforge.com/nfs-server-and-client-on-centos-7
0 Response to "Centos Wipe Out Server and Start Again"
Publicar un comentario