[[package-management-in-fedora]]
= Package management in Fedora

Like most modern Linux distributions, Fedora uses a _package management_ system. Package management tools automate installation, upgrading, and removing of software applications and components. 

Each application or component is defined as a _package_. When the package is installed, all code, configuration, and other files are deployed on the system. 

IMPORTANT: A single package is not necessarily the same as an application. Some applications can be shipped as several packages. Moreover, shared code (libraries) in Linux is normally shipped as separate packages, while in other systems applications often ship their own versions of required libraries and install them if necessary.


== File placement

The package management tools track which files on your Fedora installation belong to each package; normally, every file that is installed in the `/usr` tree as well as most configuration files under `/etc` are installed by one of the packages. When installing a package, the package management system verifies its integrity; if any files are missing or corrupted, the package is not installed.


== Resolving dependencies

The package management system also tracks all _dependencies_ between the packages. For example, if an application requires some libraries, the package for this application lists the libraries as dependencies. When you install the application package, the package management tools automatically install the library packages. If a dependency is not available, the tools do not install the package, so you can avoid a sudden malfunction.

When you want to remove a package, package management tools cleanly delete all code files for this package without affecting other packages. By default, configuration files are not removed, so you can install the package again and keep the configuration that you have set up earlier.


== Updating packages

Updating any package is entirely automatic with the package management system. The system replaces all the necessary code files and preserves existing configuration. 

In fact, for most Linux distributions, including Fedora, all of the system installation except the earliest part is performed by installing various packages. Security updates and upgrades to a next release are performed entirely by package management tools.


== RPM

Fedora's package management system uses the http://rpm.org[RPM] package format. The application that manages packages in Fedora (since version 22) is https://fedoraproject.org/wiki/DNF[DNF]. Graphical package management is provided by the Gnome Software utility. For automatic updates, Fedora uses the PackageKit utility. Command-line and graphical tools provide the same results.


== Repositories

To get packages, DNF uses _repositories_. A repository is an organized collection of packages. Repositories can be kept on any data media; notably, the Fedora installation image contains a repository. However, most up-to-date repositories are normally maintained online. 

Each Fedora release has an official _fedora_ repository and an _updates_ repository (which contains critical updates since the release). In these repositories, you can find most common Linux open-source software. You can also install packages from other repositories, not maintained by the Fedora project and known as _third-party repositories_.

Most of the time, it is best practice to install software on your Fedora Linux system using only the Fedora package management system. In this case, packages are installed in the most reliable way and automatic updates can be provided.


== Installing from source code

While many Linux applications can be built and installed from from source code, using such builds can make your system much harder to manage. For example, automatic updates to system packages (especially when updating to the next release) might impact an application that was installed from source. And, of course, no automatic security updates are available for the application. 


== Other installation methods

Sometimes you might need to install software using other package management systems. Notably:
 
* https://www.cpan.org/[CPAN] for libraries for the Perl language
* https://pypi.python.org/pypi[PyPI] for libraries (and sometimes applications) for the Python language
* Commercial repositories for games

However, installing applications using the Fedora package management systems is the preferred option.
