Let me start by showing you something that is required for this lesson, but which you
don't have to do for the RHCSA exam.
I'm going to configure a base NFS server.
An NFS server allows you to share directories from the NFS server, and next you can access
the directories from an NFS client.
And if you want to set up AutoFS, well, AutoFS is always about NFS, so that doesn't make
sense if you have no clue what is going on with the NFS.
Here we have all the steps presented on the slide for you.
I'm going to show you these steps and tell you what exactly is going on.
So for this demo, I'm using a second RL10 machine, which I've called NFS server.
The purpose is to make sure that we have a remote NFS server, and that makes it easier
to understand than if you are going to run everything on the same host.
Of course, you can also run it on the same host and just use local host, but I'm going
to connect to NFS server.
So to start with, you need to DNF install the NFS utils.
There you can see that it's asking, is this okay?
Yes, this is okay, and then it should continue.
Now as this is the first time that on this server I'm accessing this repository, it's
prompting for the GPG key, and you need to tell it that that is okay.
So answer yes twice, and you can continue.
Did you notice that it took a while?
If something like that happens while you are doing NFS or web-based or anything network-based,
check host name resolution.
And here we can see what is going on.
In the host name resolution, I have local host.
Well, local host is not the only host name.
I just called it NFS server, and you should always make sure that the local host name
resolves to the loopback IP address, particularly if you notice that it's all so slow.
This will help.
Right.
Let me continue.
I need to create a couple of directories that I want to share, so I'm using mkdir minus
p slash NFS data and as well slash home slash LDAP slash LDAP user kernel braces 1.9.
So that allows two directories or the two directory structures for you.
Now I want to share it, and in order to share it, I'm using echo slash NFS data.
That is what I want to share.
And then where I want to share it, well, that will be star slash RW, no root squash.
Now if you know NFS, then probably you are going to think that it's terrible what I'm
doing, and you are completely right, because this is opening the share for everybody.
Welcome everybody.
But hey, the thing is for RHCSA, you don't have to set up an NFS server, so we just want
something to work.
Star means that all IP addresses get access in a read-write mode, and even if the root
user wants to access this share, that is okay.
I'm writing that to the file etc exports.
Etc exports is where you define your NFS exports by default.
Next, let me also use echo on slash home slash LDAP, star RW, no root squash.
Closing quotes for the echo, and this is what we want to write to etc exports.
And now let me verify the contents of etc exports, where we can see that the two shares
have been added.
So now I need to systemctl enable minus minus now NFS server, and I need to take care of
the firewall.
In order to do so, I use a small bash scripting loop.
So for in NFS mountd RPC bind do firewall cmd minus minus add service $i minus minus
permanent semicolon ton.
That allows us to iterate over the list NFS and mountd and RPC bind and add all of these
to the firewall in a permanent way.
Now after adding this with the permanent option, I do need firewall cmd minus minus reload.
Then I need to check my IP address on this machine that is 143 in the last byte, and
I can get back to the client machine.
So now I'm on the client machine, and first I want to set up my etc hosts.
And in etc hosts, I'm using 192.168.29.143, and I'm calling it NFS server.
No FQDN, just a short name is good enough for this demo.
But we want to be able to ping the NFS server.
So that's all that you need to do to set up an NFS server.