Skip to content

How to make dnf faster in Fedora

Posted on:November 3, 2022 at 07:00 PM

Table of contents

Open Table of contents

Setup the config file

To make dnf (Dandified Yum) faster in Fedora, you can edit the [main] section in the file /etc/dnf/dnf.conf try the following optimization tips:

Enable Fastest Mirrors

Enable fastest mirrors so that dnf will check all mirrors for the fastest one:

[main]
...
fastestmirror=True

Enable DeltaRPM

Delta RPM (DRPM) lets you install packages using binary difference between old and new packages.

First install Delta RPM if it is not already installed:

sudo dnf install deltarpm

Now enable that in the dnf config file:

[main]
...
deltarpm=True

Optimise Package Download

Set the maximum number of parrallel downloads of packages in the dnf config file according to your internet connection speed.

[main]
...
max_parallel_downloads=10

Optimise MetaData Refresh Interval

Unlike package managers like apt, dnf periodically refreshes its metadata, which includes packages lists, their dependencies and other information. You can avoid excessive metadata refreshes by increasing the interval of metadata refresh to about 2 hours or more (7200 seconds) in the dnf config file:

[main]
...
metadata_timer_sync=7200

Rebuild DNF Cache

You can rebuild the DNF Cache and rebuilt it after configuring the dnf config file as mentioned above

First clean the DNF Cache:

sudo dnf clean all

Then predownload the package headers:

sudo dnf makecache