From 818f58dd1929990d11a511aa84d17ad61c836e64 Mon Sep 17 00:00:00 2001 From: Mo8it Date: Tue, 23 Aug 2022 00:23:24 +0200 Subject: [PATCH] Add more info about package managers --- src/day_1/packages.md | 90 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 1 deletion(-) diff --git a/src/day_1/packages.md b/src/day_1/packages.md index c059cb1..a20f340 100644 --- a/src/day_1/packages.md +++ b/src/day_1/packages.md @@ -34,7 +34,7 @@ After the installation is done, you can enter `cmatrix`. Congratulations, you ar To exit the matrix, press `q`. -What if you don't like the matrix and want to remove it? You can uninstall packages using `sudo dnf uninstall PACKAGENAME`. In this case: `sudo dnf uninstall cmatrix`. You have to confirm again with `y`. +What if you don't like the matrix and want to remove it? You can uninstall packages using `sudo dnf remove PACKAGENAME`. In this case: `sudo dnf remove cmatrix`. You have to confirm again with `y`. Why do we speak about _packages_ instead of programs when installing software on Linux? Because packages can contain more than one binary (the actual programs) and extra files. Take a look at [the files that are installed with `cmatrix` on Fedora](https://packages.fedoraproject.org/pkgs/cmatrix/cmatrix/fedora-rawhide.html#files) for example. @@ -76,3 +76,91 @@ If you don't have access to `sudo` and try to use it, then you get an output lik > You might find a "meme" in the internet that tells you to run something like `sudo rm -rf /`. This command will delete EVERYTHING on your machine. It is like delete the `C` and all other drives at the same time on Windows. > > Linux assumes that you know what you are doing when you use `sudo`. With great power comes great responsibility! + +### Looking for a package + +If you don't exactly know the name of a package you are looking for, then you can use `dnf search PATTERN`. DNF will then return packages that match the pattern in their name or description. + +For example, if you search for Julia (which is a programming language, you get the following results): + +```console +$ dnf search julia +============================ Name Exactly Matched: julia ============================ +julia.i686 : High-level, high-performance dynamic language for technical computing +julia.x86_64 : High-level, high-performance dynamic language for technical computing +=========================== Name & Summary Matched: julia =========================== +cantor-julia.i686 : julia backend for cantor +cantor-julia.x86_64 : julia backend for cantor +julia-common.noarch : Julia architecture-independent files +julia-devel.i686 : Julia development, debugging and testing files +julia-devel.x86_64 : Julia development, debugging and testing files +julia-doc.noarch : Julia documentation and code examples +perl-DateTime-Calendar-Julian.noarch : Julian Calendar support for DateTime.pm +vim-syntastic-julia.noarch : A syntax checker for julia programming language +============================== Summary Matched: julia =============================== +jday.i686 : A simple command to convert calendar dates to julian dates +jday.x86_64 : A simple command to convert calendar dates to julian dates +perl-Date-JD.noarch : Conversion between flavors of Julian Date +python3-jdcal.noarch : Julian dates from proleptic Gregorian and Julian calendars +``` + +If you know the name of the program but you don't know the name of the package that contains this program, use `dnf provides PROGRAMNAME`. + +If you want to install the program `trash` (no joke) that provides you with the functionality of a system trash (instead of completely deleting), then you can run this: + +```console +$ dnf provides trash +trash-cli-0.21.10.24-2.fc36.noarch : Command line interface to the freedesktop.org trashcan +Repo : fedora +Matched from: +Filename : /usr/bin/trash + +trash-cli-0.22.4.16-1.fc36.noarch : Command line interface to the freedesktop.org trashcan +Repo : updates +Matched from: +Filename : /usr/bin/trash +``` + +You can see that the name of the package is not the same as the name of the program. Using `provides` makes your life easier while looking for the package to install. + +If you did find a package but you want to get more information about it, you can use `dnf info PACKAGENAME`: + +```console +$ dnf info julia +Available Packages +Name : julia +Version : 1.7.3 +Release : 1.fc36 +Architecture : i686 +Size : 45 M +Source : julia-1.7.3-1.fc36.src.rpm +Repository : updates +Summary : High-level, high-performance dynamic language for technical computing +URL : http://julialang.org/ +License : MIT and LGPLv2+ and GPLv2+ +Description : Julia is a high-level, high-performance dynamic programming language + : for technical computing, with syntax that is familiar to users of + : other technical computing environments. It provides a sophisticated + : compiler, distributed parallel execution, numerical accuracy, and an + : extensive mathematical function library. The library, largely written + : in Julia itself, also integrates mature, best-of-breed C and Fortran + : libraries for linear algebra, random number generation, signal processing, + : and string processing. + : + : This package only contains the essential parts of the Julia environment: + : the julia executable and the standard library. + +Name : julia +Version : 1.7.3 +Release : 1.fc36 +Architecture : x86_64 +(...) +``` + +You get too results for Julia that seem to be identical. The difference is the _architecture_. Normal computers usually have the `x86_64` architecture, so you should look for it. But it is nice to know that other architectures are also supported. + +If you have a problem with a package after an update, then you can try to use an older version. To do so, refer to the documentation of `dnf downgrade`. + +To run updates on your system, use `dnf upgrade`. + +For security reasons, it is important to run updates frequently! The updates installed using a package manager in Linux update the whole system and its programs. This means that you don't have to update your packages separately.