dnf exercise
(In this exercise, run commands as root. However, when in a graphical environment, run your GUI as a non-root user. Within the GUI run a terminal window and, in there, become root ( su - ) for the command line operations.)
dnf is the successor to yum (Yellow Dog updater Modified). yum, in turn, is/was a response to the difficulty of locating and reconciling interdependent
rpm packages. rpm is a local solution, yum a
global one superimposed on rpm in network environments. Recent versions of the
Fedora distribution have replaced yum with "dnf" which, though
rewritten, is syntax compabible with yum. dnf stands for "dandified
[improved] yum."
Examine dnf's configuration file:
cat /etc/dnf/dnf.conf
Change the value of "keepcache" from 0 to 1 with an editor (or add the line "keepcache=1" if not already there). dnf keeps a directory for caching the rpm package files and related information it downloads and installs for you in the course of operation. Examine what's in there currently:
ls -lR /var/cache/dnf/fedora-[long
code number here]/
Find out which repositories dnf is "pointing" to, by looking into
/etc/yum.repos.d which contains effectively a repository list:
ls /etc/yum.repos.d
one repository per file. "Teach" your system another, new repository for its use by placement of another, new repository file in /etc/yum.repos.d. As a model of what a repository file must contain, look at one.
more /etc/yum.repos.d/fedora.repo
The central item is the URL that tells dnf where it can find the indicated repository, with its treasure of collected rpm packages.
The repositories to which dnf points by default on a fedora system are fedora's. fedora is the one who maintains them. However, anybody can set up a dnf repository server. There is a community of such 3rd-party repositories that are independently offered and maintained. The 3rd-party repository population changes over time. A few years ago I found this list:
Fedora Third Party YUM Repositories
* DAG - http://dag.wieers.com/home-made/apt/
* Dries - http://dries.ulyssis.org/rpm/
* FreshRPMS - http://freshrpms.net/
* NewRPMS - http://newrpms.sunsite.dk/
* ATrpms - http://atrpms.net/
* RPM Fusion - http://rpmfusion.org/
However consolidation has resulted in the combination of several of these under the umbrella of RPM Fusion. Briefly visit their website http://rpmfusion.org/ for example:
"RPM Fusion provides software that the Fedora Project or Red Hat doesn't want to ship. That software is provided as precompiled RPMs for all current Fedora versions and Red Hat Enterprise Linux 5; you can use the RPM Fusion repositories with tools like yum and
PackageKit.
"RPM Fusion is a merger of Dribble, Freshrpms, and Livna; our goal is to simplify end-user experience by grouping as much add-on software as possible in a single location."
There have also been other consolidations, births, and deaths along the way.
To add a third-party repository (not maintained by the Fedora project), you must add the corresponding information for it to /etc/dnf/dnf.conf or to a stand-alone configuration file with the same contents placed in /etc/yum.repos.d/. This can be done by manual typing or cut-and-paste. Alternatively nowadays, many 3rd-party repository sites deliver the new, pre-written configuration file via the rpm/dnf mechanism itself (rpm after all is just a file deployment mechanism so why not).
Let's install the RPM Fusion repository on your system. That repository offers the vlc media player, which fedora's repositories do not. Please verify:
dnf list available firefox
anddnf list available vlc
Visit rpmfusion.org. Click the link "Enable RPM Fusion on your system" then on the ensuing page click the link "RPM Fusion free for Fedora 15, 16, and 17". Save the file rpmfusion-free-release-stable.noarch.rpm when offered. Alternatively, get that file directly, by command line:
wget http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
Find out about what this package file offers:rpm -qip rpmfusion-free-release-stable.noarch.rpm
in particular read the narrative description at the bottom. Find out what files it contains:rpm -qlp rpmfusion-free-release-stable.noarch.rpm
In particular note the repo files at the bottom. Install it:rpm -Uvh rpmfusion-free-release-stable.noarch.rpm
and note that the new repo files have appeared in the directory that dnf consults:ls -l /etc/yum.repos.d
That means dnf is now RPM-Fusion-aware, because the URLs for RPM-Fusion's dnf servers appear in these new repo files. dnf's aggregate content awareness has just been augmented by whatever packages RPM Fusion keeps on its servers. Verify that dnf is now RPM-Fusion-repository-aware:dnf -v repolist
Re-inquire whether vlc is available:dnf list available vlc
This time, it is. It was not available within the scope of the fedora servers. It still isn't. But your system's scope has expanded to additionally encompass the servers of RPM Fusion.Another 3rd-party repository maintainer nowadays is Google. Their approach is interesting. You don't install their repository explicitly, but as an automatic side-effect when you install one of their applications. Visit http://www.google.com/linuxrepositories Note you could do a web-based install of one or another Google product. If you did, in the course of doing so they would drop their repo files into your dnf/yum configuration automatically. Once they're there, your horizons expand to include Google just as before for RPM Fusion.
You have used dnf as a command-line tool. Not surprisingly, there are graphical front-ends to it. One of them is yumex. Use dnf to install it:
dnf install yumex
(this might complain about a conflict with an automatic update-checker that periodically runs in the background utilizing dnf; if so either wait or figure out how to disable automatic software updates in the menu system, which varies in how to do this). Now that it's installed, run yumex. You will probably find it installed an option somewhere in your menu system that will launch it (look for "Yum Extender"). Alternatively "yumex &" will launch it from the terminal window command line. Take a quick look around and exit.
Another graphical front-end to dnf is probably also installed on your system, already. If there is a "Add/remove programs" menu item or similar, that's it. Run it, take a quick look around, and exit.
You can use dnf to update an already-installed application. Assuming you have firefox installed, try:
firefox --version
dnf check-update firefox
and assuming it reports an available update, install that update:
dnf update firefox
(you could also do "dnf install firefox" instead, which will figure out firefox is already installed and update it). Now that yumex and firefox are installed and up-to-date,
dnf install yumex firefox
This time it should report that there's nothing to do. Because dnf has just done it. Re-examine the cache
ls -lR /var/cache/dnf/fedora-[long code number here]/
You should see residual files there from having installed yumex and firefox, because you earlier set "keepcache" to 1 in dnf.conf. Otherwise, dnf would, after using a file it downloaded, clean up after itself by deleting it.
From among the repositories dnf knows, find out for which packages updates are available:
dnf check-update
This command checks for updates of all packages that are installed on your system (recorded by rpm and revealed by "rpm -qa") on all repositories of which dnf is aware. If your installation is late in the version cycle and you have not updated it, there will be updates for just about every package. If you installed a version of Fedora yesterday that was released the day before, there may be none.
If you want a complete list of all the packages available on the servers dnf uses (not just among those already installed on your machine):
dnf list available