E: Unable to locate package

Hello friends, whenever i want to install a package with “apt-get install” command ,i will face with E: unable to locate package .
can anyone help me??

Hi @mohammadshd, to install software on Fedora (and other distributions using .rpm packages), use dnf install <packagename>.
apt-get is for Debian/Ubuntu/etc .deb packages, it can’t manage your software on Fedora.


Well, you can install the apt package which brings the apt-get command to your Fedora (see APT command equivalents on Fedora with DNF :: Fedora Docs), however I have never tried to use it, so I am not aware how that works exactly, however according to that article apt-get should be ported to deal with rpms, so I believe it works over the same packages and package database as dnf.

@mohammadshd, you can try to install the package using dnf install <package> as suggested to see if it works, but I believe that your problem is somewhere here:

  • a wrong package name
  • a missing repository

To search for packages, try using dnf search <package> and you will see if a package with such name exists. Sometimes, when you want to apply an internet how-to, the name of the packages might refer to another distro and the package has a different name on Fedora.

The good thing is that you can search for keywords, too. So, if you need some package that is related to ssh, you can try dnf search ssh and it spits out a bunch of packages that have ssh in the description.

To see that you have the repository enabled, try dnf repolist.

Note: There might be some apt-get equivalents for the above commands, but I do not know them. dnf should be the primary way to deal with packages on Fedora.


Unfortunately, that wiki entry is no longer accurate, due to a change in Fedora 32.

Long story short(-ish), apt in Fedora used to actually be apt-rpm, which basically mapped normal apt commands so that they worked with Fedora’s rpm package-management system.
However, apt-rpm is unmaintained, broken & insecure, and so was dropped in favour of shipping the actual Debian apt package. Since apt exclusively deals with .deb packages, and installing those on your system would seriously mess things up, it can’t (and by default, won’t be able to) be used to manage your packages. It’s purpose is now purely as a tool for people trying to build Debian packages on Fedora system.

Long story actually short: Unless you’re trying to create Debian packages, don’t use apt.

Here’s how typical apt commands map to Fedora’s dnf:

apt dnf notes
apt update dnf check-update Unneccesary, dnf does this automatically when its cache gets old. You can force a cache update by appending --refresh to commands, e.g. dnf upgrade --refresh
apt upgrade dnf upgrade -
apt dist-upgrade dnf system-upgrade Multi-step process, see here. More direct equivalent is dnf distro-sync, see man page for details
apt install dnf install -
apt remove dnf remove -
apt autoremove dnf autoremove -
apt-cache search dnf search -

As you can see, it is mostly the same, with the exception of the dist-upgrade process working differently and dnf updating the cache automatically if needed. See also here for more info.

[note to self: we should really update that wiki page]


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.