In the next task, you have configured repository access.
Let's have a look at it.
So the purpose was on server 1 to create an ISO file with the name rel10.iso based on
the installation DVD and mount this ISO persistently on the directory slash repo and provide access
to this directory contents using the Apache web server, such as it can be used as a repository.
And configure both servers as a repository client to this server and after successfully
completing the task, you should be able to install software on both servers.
Did you find the nice little catch in this one?
How are you going to install HTTPD if you don't have access to a repository?
Well, maybe the solution is to provide an in-between repository client that you are
going to delete after that.
Let me show you.
So now we are going to make sure that the installation disk is connected.
So I need to do that in the virtual machine controls.
This depends on your virtualization software, so I cannot give you a solution for everything,
but you need to make sure that you connect the installation disk.
As you could see, it was grayed out, so it was not connected on the system.
And now I can use dd if is slash dev slash sr0, which is a typical name for your optical
disk.
In case of doubt, use lsblk to find it.
And of is slash rel10.iso with bs is 1M for one megabyte blocks.
That will speed it up a little bit.
And depending on the speed of your hardware, this may take between a couple of seconds
or even a few minutes.
So here we can see that it just copied the ISO file, and that's OK.
So mkdir slash repo, that's where we are going to mount it.
And I might as well put it in etcfs step, because the mount needs to be persistent.
And oh boy, here it goes, no vim.
Yeah, that's right.
And I can't install it, so I need to use vi.
Well, fortunately, vi is pretty much the same as vim.
So let's go for it and mount rel10.iso on the directory slash repo.
The file system ISO 9660, and the mount options, defaults, and 0 and 0.
And that should be doing it.
And then mount minus a is going to mount it, and a quick check ls on slash repo is showing
the contents of this slash repo directory.
So far, so good.
But now I need to install the HTTP server.
In order to install the HTTP server, I need access to a repository, and how am I going
to do that?
Well, I think the only way is to do an in-between repository.
So I'm going into etc yum.repos.d, and I'm creating my base os.repo in which we have
base os, and name is base os, and base URL is file colon slash slash slash repo slash
base os, and GPG check is 0, and that should be doing it.
Obviously, you are free to use the dnf command to create the repository as well.
I'm going to continue with this etc yum.repos.d, and we create AppStream.repo, likewise AppStream
between square brackets, and then name is AppStream, and base URL is file colon slash
slash slash repo slash AppStream, and GPG check is 0, and that should be doing it, and
now it's time to do a test.
So what is the test?
Well, dnf.repo list would do well, and we can see the repositories, and that's good.
So how about dnf install minus y vim as well as HTTP?
Of course, I need vim for easy editing, and that seems to be running all right.
Okay, so what are we going to do next?
Well, next we need to set up this HTTP server to service the content of the slash repo directory.
So what does that mean?
Well, that means that we are going to use vim on etc.httpd.conf, and there we get
httpd.conf, and in the httpd.conf, we go for the document route, and the document route is going
to be slash repo.
That's what the question was all about, so slash repo, and the directory, well, that is going to
be slash repo as well to ensure that the HTTP server has access to it.
Now, do you remember this little thing about SE Linux?
Hopefully, you do.
So semanage fcontext minus a minus t httpd syscontent t on slash repo with the
regular expression that refers to anything that you might find beyond the slash repo directory.
So there we are getting some kernel messages.
That is what you get in multi-user mode, and now I can use a restore-con minus rv slash repo,
and next systemctl enable minus minus now httpd, and let's not forget about firewall
d, so firewall cmd minus minus add service http, and that was a success, and let's also
make it permanent because otherwise firewall d is not going to remember this after a reboot.
So as the httpd service is now configured all right, let me check if it is running,
and yeah, there we go.
Seems to be good.
So next thing that we need to do is to set up the repository client.
So I need to get back to etc yum.repos.d and my baseos.repo, and I'm changing the baseos to
http colon slash slash, and there I make it server1.example.com slash baseos,
and likewise I'm going to reconfigure the fstream repo,
and the base url is going to be changed likewise.
So http colon slash slash server1.example.com slash fstream,
and now dnf clean all to clean all caches, and let's do a dnf repo list,
and there we can see the repositories and a quick test dnf install nmap,
and as you can see, it can find the nmap packages.
I would always advise you proceed with it to make sure that it is working out all right.
So here we're done on server1.
We're not yet done on server2, so here we are on server2,
and on server2, I'm going to start by setting up etc host.
I never did that before, and let's configure it to 192.168.29.1.33,
which is server1.example.com, and 192.168.29.1.38, which is server2.example.com.
Always good to have short names as well.
So that makes that we can read the host by name.
As you can see, it's pingable, so that's good,
and let's use vi on the etc yum.repos.d and call it baseOS.repo,
and in there, baseOS as the label and name is baseOS,
and baseURL is http://server1.example.com.baseOS.
After all, the slash repo directory is a document root,
so we can plunge directly into the slash repo directory, and gpg check is zero,
and likewise, we need to create etc yum.repos.d appstream.repo.
So between square brackets, appstream, and name is appstream,
and baseURL is http://server1.example.com.appstream, and gpg check is zero.
And now, the final test, dnf install nmap.
And as you can see, this seems to be working all right,
and well, there we go, it was working all right.
So that means that this task has been completed.