- In this video,
we are going to explore how to work with packages
using YUM and DNF.
YUM and DNF are specific for Red Hat.
And YUM is using all the versions of Red Hat and family.
The YUM backend recently has been replaced with DNF.
DNF is a preferred tool in current RHEL versions.
But as of now, DNF, as well as YUM,
are basically providing the same functionality.
And that is because both commands
are using a symbolic link to the same binary.
So if you wanna be cool,
you should use DNF utility, but really it doesn't matter.
Now DNF uses repositories.
And the repositories by default
are in the directory /etc/yum.repos.d.
These are text based configuration files
in which you configure your repositories.
The dnf command was really written to be intuitive.
Like you want to install a package, dnf install.
You want to look up a package, dnf search.
You want to remove it, dnf remove.
DNF also allows working with package groups
to make installation of specific functionality easier.
So if you work with a package group,
you don't have to focus on individual packages.
You focus more on functionality.
So you would use dnf groups list for a list of groups.
and then you can install the complete group
using dnf groups install.
There is also yum modules.
yum modules provide a way
to install different versions of packages,
including all of the required dependencies.
In order to work with modules, you use yum module install
like yum module install container-tools.
And the cool thing about these modules
is that the Red Hat family distribution, by using modules,
is capable of providing different versions of vital packages
like Python and Pearl, for instance.
You wanna use Python 3.6?
Use the yum module for Python 3.6.
You wanna use 3.8?
Use the yum module for Python 3.8.
Now, if you are working with YUM and DNF,
then it might be convenient to find the right package.
Sometimes that's not that easy.
Sometimes dnf search
doesn't give you the package that you need.
Then it's good to know, that as an alternative,
you can use dnf provides.
dnf provides allows you to search on a file name.
That can be any file name.
Specify the file name using */, name of the file.
And you will see the matching package.
And also nice is dnf history.
That allows you to undo changes recently applied
by using these packages.
Let me show you how to work with YUM.
All right.
Let me use sudo yum search, search what?
Well, let's do nmap for instance, and there we go.
If you do sudo yum search, we get a result like this.
So nmap, this is the nmap that was found.
Network exploration tool and security scanner.
That's a description that we've got about nmap.
Then we have nmap-ncat.
What is that?
That is another package that was found.
So we have a name, exact match,
and we have a name and summary match.
So the exact match is the most likely,
the name and summary is a little bit less likely.
So use this on anything,
but sometimes if you use yum search,
I'm using yum search seinfo, for instance.
Now, what do we get?
We get a No matches found.
That is because yum search
is not doing a deep inspection of your packages.
If I want to search for packages containing a file
then I should do two things.
First, I need to replace the seinfo with */seinfo.
That's a mandatory pattern.
And next I can use provides.
So sudo yum provides or dnf provides if you want to.
And then we see that setools-console
is the package that we want to install.
So I can use sudo yum info on setools-console
to get more information.
And there we go, a little bit more information.
And if I decide that this is really what I want,
then I'm going to use sudo yum install -y setools-console.
So what is this -y about?
Well, let me show you.
I'm just going to not include the -y option.
If you do not include the -y,
then the command is prompting you
about what it's going to do.
And then it's asking you, is that okay?
If you wanted to immediately install,
then you can use the -y.
It won't prompt, it'll just do the installation.
And there we go, the package is installed.
Let me do a sudo yum history
to see what has recently happened.
And there, we can see the history of packages
that recently has been applied.
Now with YUM, you can also do things like sudo yum upgrade.
And yum upgrade is doing what?
It's checking on all the packages currently installed.
And, wow, we can see 681,
and we can upgrade them if we want to.
Do I really want that?
No, I don't think so.
681 megabytes, too much data traffic.
I don't wanna do that right now.
Now how about these yum groups?
sudo yum groups list.
There we go.
We have the different yum groups.
So if I wanted to install System Tools for instance,
sudo yum groups install system,
oh, system tools,
what do you think, is that going to work?
Well, I have my opinion about it,
but let's just have a look.
And what do we see?
We see module or group system is not available.
Module or group tools is not available.
We are having a problem here because of the space.
In these yum groups,
if you want to install a yum group
that has a space in the name, use double quotes.
And there we go.
And you can see that everything
that is a part of this yum group is now installed.
That just takes a minute and should not take too long.
There is one more thing that I want to show you
and that is the repository.
So repositories on a YUM based system
are in /etc/yum.repos.d/.
And in /etc/yum.repos.d/,
we see the repositories.
So I'm on CentOS.
And the CentOS repository is defined in centos.repo.
And here we can see an exact reference
to the repositories which are online
that are going to be used by this CentOS system.
I think this is enough about YUM,
should be enough to get you started.
Let's go check out APT.