1. Introduction

PowerTools is a repository of software that adds more utilities and resources for programs and development. In other words, PowerTools expands the user choice by offering extra packages with tools.

In this tutorial, we’ll explore different ways to enable PowerTools in CentOS, RHEL, and other RPM-based distributions.

2. Using Repository Setting File

A repository is a centralized location with software packages, their metadata, and dependencies. The repository acts as a source or reference from which users can access and download the required software packages for installation or updates.

To leverage this, repository settings text files contain that source information for different repositories. Moreover, we can edit these files to enable, disable, or modify settings.

2.1. Add New Setting File

If we don’t have PowerTools settings in the repository configuration files of our distribution, we can add the settings manually.

Let’s create a file and add our settings:

$ cat myPowerTools.repo
[PowerTools]
name=CentOS-$releasever - PowerTools
baseurl=http://mirror.centos.org/centos/$releasever/PowerTools/$basearch/
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

In this example, we manually added the above code in the newly-created repository settings file myPowerTools.repo.

Finally, we’ll update the package lists with yum:

$ sudo yum check-update

Now, we can check the list of repositories again. Let’s get the details of the PowerTools repository:

$ yum info powertools
Name         : powertools
Version      : 1.2
Architecture : x86_64
Size         : 100 MB
Repository   : CentOS-8 - PowerTools
...
Enabled      : Yes
...

In this example, we can see the version and status of PowerTools with other details. As we can see, the PowerTools is enabled.

2.2. Using Current Setting File

Here, we assume that the PowerTools repository setting exists in at least one of our main files of the distributions.

First, let’s check the repository list via yum:

$ sudo yum repolist all
repo id                    repo name                                    status
appstream                  CentOS-8 - AppStream                  enabled
appstream-debuginfo        CentOS-8 - AppStream - Debug          disabled
appstream-source           CentOS-8 - AppStream - Source         disabled
baseos                     CentOS-8 - BaseOS                     enabled
...
nfv                        CentOS-8 - NFV                        disabled
nfv-debuginfo              CentOS-8 - NFV - Debug                disabled
powertools/x86_64          CentOS-8 - PowerTools                 disabled
...

The output displays information about each repository, including its ID, name, and status. Moreover, we got a wide view of all the configured software sources. As we can see, PowerTools is currently disabled.

First, we’ll search among the setting files via grep:

$ grep -rwl "PowerTools" /etc/yum.repos.d/
/etc/yum.repos.d/CentOS-Base.repo

In this example, we recursively searched for the whole word PowerTools and returned only files that contain it*.* In this case, the output shows that the CentOS-Base.repo file contains the PowerTools setting.

Here, we use several options:

  • -r – recursive search
  • -w – whole-word search
  • -l – list only matched files

Then, we can edit the setting with a text editor to enable the repository:

$ cat /etc/yum.repos.d/CentOS-Base.repo
...
[PowerTools]
...
gpgcheck=1
enabled=1
...

Here, we changed the enabled flag from 0 to 1.

3. Using yum-config-manager

yum-config-manager is a command-line tool that allows us to configure software sources for yum. Moreover, we can use yum-config-manager to enable PowerTools.

yum-config-manager is part of yum-utils. Let’s install yum-utils first:

$ sudo yum install -y yum-utils

Now, we can use yum-config-manager:

$ yum-config-manager --enable powertools

In this example, we enabled the PowerTools with the –enable option.

Finally, we’ll check the status of PowerTools:

$ sudo yum repolist all
repo id                    repo name                             status
...
nfv                        CentOS-8 - NFV                        disabled
nfv-debuginfo              CentOS-8 - NFV - Debug                disabled
powertools/x86_64          CentOS-8 - PowerTools                 enabled
...

As we can see, the status of PowerTools is now enabled.

4. Using dnf

dnf is a package management tool, so it can install, remove, and update software packages. Besides, we can use dnf to enable PowerTools. In fact, this method is only applicable to dnf and doesn’t affect yum.

Firstly, let’s update our source and upgrade the installed packages:

$ sudo yum update

Secondly, we’ll install dnf-plugins-core to enable the config-manager plugin:

$ sudo yum install dnf-plugins-core

Thirdly, we’ll enable PowerTools:

$ dnf config-manager --set-enabled powertools

In this example, we used config-manager to manage the settings of repositories in dnf. In particular, we used –set-enabled to enable the PowerTools. Notably, the config-manager option can only be used in CentOS 8 and newer versions.

Finally, we’ll verify PowerTools activation:

$ sudo dnf repolist all
repo id                              repo name                      status
PowerTools                           CentOS-8 - PowerTools          enabled
...

As we can see, PowerTools is now enabled.

5. Conclusion

In this article, we’ve explored various methods to enable PowerTools in CentOS, RHEL, and other RPM-based distributions.

Firstly, we manually edited settings files to enable PowerTools. Secondly, we used the yum-config-manager command to enable PowerTools conveniently. Finally, we used the dnf package manager with config-manager.