CentOS 8.x dnf basics

From Notes_Wiki

Home > CentOS > CentOS 8.x > System Administration > Package management > dnf or yum > dnf basics

Install package

We can install package from online repositories using:

dnf install -y <package-name>

We can also install a local rpm file using:

dnf install -y ./<local-rpm-file-name>

If we want to install while disabling gpg-check (Not recommended) use:

sudo dnf --nogpgcheck install java

See: https://medium.com/@madhav2code/how-to-disable-gpg-check-in-dnf-new-yum-334df398a908


Update system

We can update entire system using

dnf update -y --skip-broken


Download package rpm file

There is option to download package rpm file in current folder by using some dnf plugins. To enable that first install:

dnf install dnf-plugins-core

Then to download rpm file for a package use:

dnf download <package-name>


Remove package

To remove package use:

dnf remove <package-name>


List repositories

To list enabled repositories you can use

dnf repolist

To list all repositories use:

dnf repolist all


Search package

Search packages using:

dnf search <search-term>


Find package that provides given file

To see package that provides given file use:

dnf provides */<file-name>


See package information

To see package information use:

dnf info <package-name>


dnf history

To see dnf history information use:

dnf history

This should show information about all dnf invocations so far.

You can also see details of any particular listed item using:

dnf history info <id>

where <id> is taken from 'dnf history' output

There is also option of reversing transaction using:

dnf history undo <id>

After undo we can again perform same transaction again using:

dnf history redo <id>


Package groups

We can list package groups using:

dnf grouplist

Information about a group can be seen using:

dnf groupinfo "<group-name>"

Group can be installed using:

dnf groupinstall -y "<group-name>"



Refer:


Home > CentOS > CentOS 8.x > System Administration > Package management > dnf or yum > dnf basics