[CentOS 8] A guide to switching to dnf for yum lovers

table of contents
Hello.
I'm Mandai, the Wild team member in charge of development.
A while ago, CentOS 8 was released
Beyond Inc. is generally an MSP (Managed Service Provider) company (although they also have other businesses! Beyond's Services | Beyond Inc. Please see
This time, I will talk about how if you use CentOS, the yum command that everyone uses will no longer be available
The yum command is deprecated
For those of you who are already aware, this might be a "finally" moment, but the yum command is being deprecated.
You might be worried about how packages will be managed, but don't worry. A
successor package management system is already in place!
Its successor is dnf
Some of you may not be familiar with dnf.
But let me assure you that it's not a newly developed tool.
dnf is a package management system that has been used in the same Redhat-compatible distribution called Fedora, and has now been introduced to CentOS as well
Why the change?
The problem is that yum uses Python 2, so it can't be used indefinitely.
Since dnf runs on Python 3, the version of Python used by the system in CentOS 8 has also been upgraded to Python 3
Immediately after installing the OS, only the system-use Python called platform-python is installed, so it seems that the Python used by users will need to be installed separately
I want to understand the dnf command, so I tried using dnf to execute some common yum commands
I tried using the dnf command to perform some common package management tasks
See the list of packages
When searching for a package, I always use yum list | grep [package name]
What happens when you run yum list with dnf?
dnf list
It's just a name change for yum
By the way, to see the list of installed packages,
dnf list installed
You can check it here
Install the package
So what if you want to install a package?
What happens when you run yum install with dnf is:
dnf install [package name]
Here too, yum has simply become dnf
Uninstall a package
You may be starting to understand this, but what happens when you run yum remove with dnf is
dnf remove [package name]
It turns out that the basic usage hasn't changed that much!
I want to use the epel repository
What if you use the epel repository?
To install the epel repository, run the following command:
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm # or dnf install epel-release
As for the epel.repo file, which contains the repository settings, based on the flow so far, it seems that the directory for dnf is located under /etc
ls -al /etc/dnf total 16 drwxr-xr-x. 8 root root 128 Nov 17 05:03 . drwxr-xr-x. 80 root root 8192 Nov 25 01:18 .. drwxr-xr-x. 2 root root 6 May 13 2019 aliases.d -rw-r--r--. 1 root root 82 May 13 2019 dnf.conf drwxr-xr-x. 2 root root 59 Nov 25 01:18 modules.d drwxr-xr-x. 2 root root 6 May 13 2019 modules.defaults.d drwxr-xr-x. 3 root root 89 Nov 17 05:04 plugins drwxr-xr-x. 2 root root 59 Nov 17 05:04 protected.d drwxr-xr-x. 2 root root 37 Nov 17 05:03 vars
Hmm? I can't find a directory like repos.d.
That's not surprising.
Surprisingly, the directory for the repo file is still /etc/yum.repos.d.
How confusing!
ls -al /etc/yum.repos.d/ total 84 drwxr-xr-x. 2 root root 4096 Nov 17 05:15 . drwxr-xr-x. 80 root root 8192 Nov 25 01:18 .. -rw-r--r--. 1 root root 731 Nov 17 05:15 CentOS-AppStream.repo -rw-r--r--. 1 root root 712 Nov 17 05:15 CentOS-Base.repo -rw-r--r--. 1 root root 798 Nov 17 05:15 CentOS-centosplus.repo -rw-r--r--. 1 root root 1357 Nov 17 05:08 CentOS-CR.repo -rw-r--r--. 1 root root 668 Aug 14 06:42 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 756 Nov 17 05:15 CentOS-Extras.repo -rw-r--r--. 1 root root 356 Nov 17 05:08 CentOS-fasttrack.repo -rw-r--r--. 1 root root 976 Nov 17 05:08 CentOS-Media.repo -rw-r--r--. 1 root root 736 Nov 17 05:15 CentOS-PowerTools.repo -rw-r--r--. 1 root root 1382 Aug 14 06:42 CentOS-Sources.repo -rw-r--r--. 1 root root 78 Nov 17 05:08 CentOS-Vault.repo -rw-r--r--. 1 root root 1400 Nov 17 05:08 epel-playground.repo -rw-r--r--. 1 root root 1249 Oct 10 16:15 epel-playground.repo.rpmnew -rw-r--r--. 1 root root 1206 Nov 17 05:15 epel.repo -rw-r--r--. 1 root root 1104 Oct 10 16:15 epel.repo.rpmnew -rw-r--r--. 1 root root 1354 Nov 17 05:08 epel-testing.repo -rw-r--r--. 1 root root 1203 Oct 10 16:15 epel-testing.repo.rpmnew
That's how I was able to find the repo file
The contents of the file appear to be the same as before
By the way, when specifying whether to enable or disable a repository using a command, the usage of the --enablerepo / --disablerepo options seems to be the same as with yum
The remi repository, which I think PHPers love, can be installed with the following command after installing the epel repository
dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
According to the remi repository website, it seems that there is an installation method that is slightly different from yum
The concept of modules has been added to dnf, and by simply specifying PHP, the basic packages php-cli, php-common, php-fpm, php-json, php-mbstring, and php-xml were installed
This is common knowledge for those of us living in a multi-byte world, but it's a bit surprising that php-mbstring is now installed by default
One benefit of introducing this module is that it makes it easier to switch between multiple versions of packages
dnf module reset php:remi-7.3 dnf module install php:remi-7.2
This means the version changes quickly. You
probably won't use this often, but knowing about it might come in handy in a pinch.
Also, the version of PHP registered in the AppStream repository for CentOS8 has been upgraded to 7.2, so it doesn't seem like it will be used that often
However, security updates for PHP 7.2 will only be available until the end of November 2020, so you won't be able to use it for very long
summary
This time, we introduced a package management tool called dnf, which was first installed in CentOS 8
The impression I got was generally the same as yum, and I hope it helps to lower the psychological barriers of those who read it, even just a little
I remember the horror I felt when systemd was introduced in CentOS 7, but dnf is easy to get started with and is great
Finally, yum will not become unusable immediately; the yum command is still available in CentOS 8
However, yum in CentOS 8 is like a wrapper command for dnf, and even within /usr/bin/yum it only processes keyboard input and calls dnf modules
Given the current situation, it's almost certain that the yum command will disappear in the near future.
When that happens, I'd like to write an article commemorating the package management system that vanished from the world.
That's all
2
