Mastering Linux System Administration. Richard Blum

Чтение книги онлайн.

Читать онлайн книгу Mastering Linux System Administration - Richard Blum страница 35

Mastering Linux System Administration - Richard Blum

Скачать книгу

resolved. ============================================================================== Package Architecture Version Repository Size ============================================================================== Removing: zsh x86_64 5.5.1-6.el8_1.2 @BaseOS 7.2 M Transaction Summary ============================================================================== Remove 1 Package Freed space: 7.2 M Is this ok [y/N]: y Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: zsh-5.5.1-6.el8_1.2.x86_64 1/1 Erasing : zsh-5.5.1-6.el8_1.2.x86_64 1/1 Running scriptlet: zsh-5.5.1-6.el8_1.2.x86_64 1/1 Verifying : zsh-5.5.1-6.el8_1.2.x86_64 1/1 Installed products updated. Removed: zsh-5.5.1-6.el8_1.2.x86_64 Complete! #

      Unlike the Ubuntu apt tool, dnf doesn't provide an option to remove the application files but keeps any configuration or data files. When you remove a package, everything associated with that package is removed.

      Handling Broken Dependencies

      Sometimes as multiple software packages get loaded, a software dependency for one package can get overwritten by the installation of another package. This is called a broken dependency.

      If this should happen on your system, first try the following command:

      dnf clean all

      Then try to use the upgrade option in the dnf command. Sometimes, just cleaning up any misplaced files can help.

      If that doesn't solve the problem, try the following command:

      dnf repoquery --deplist package_name

      This command displays all the package's library dependencies and what software package provides them. Once you know the libraries required for a package, you can then install them. Here's an example of determining the dependencies for the zsh package:

      As you can see from the output, there are lots of different packages that must be installed for the Z shell to work properly. Good thing dnf ensured they were all installed for us!

      Working with RPM Repositories

      Just like the apt systems, dnf has its software repositories set up at installation. For most purposes, these preinstalled repositories will work just fine for your needs. But if and when the time comes that you need to install software from a different repository, here are some things you will need to know.

      ROGUE REPOSITORIES

      These days, it's always a good idea to stick with approved repositories. An approved repository is one that is sanctioned by the distribution's official site. If you start adding unapproved repositories, you lose the guarantee of stability. And you will be heading into broken dependencies territory.

      To see what repositories you are currently pulling software from, use the repolist option.

      If you don't find a repository you need software from, then you will need to do a little configuration file editing. There are two places where the dnf repository definitions can be located.

       In the /etc/dnf/dnf.conf configuration file

       As separate files in the /etc/yum.repos.d directory

      Good repository sites such as rpmfusion.org will lay out all the steps necessary to use them. Sometimes these repository sites will offer an RPM file that you can download and install. The installation of the RPM file will do all the repository setup work for you!

      There may be some environments where your Linux server won't have Internet access to contact the repository to automatically download packages. For example, often high‐security environments block all network traffic except internal traffic. In these environments, you'll need a way to manually install or update software packages.

      The main tool for working with .rpm files is the rpm program. The rpm utility is a command‐line program to install, modify, and remove .rpm software packages. Its basic format is as follows:

      rpm action [OPTION] package

SHORT LONG DESCRIPTION
‐e ‐‐erase Removes the specified package
‐F ‐‐freshen Upgrades a package only if an earlier version already exists
‐i ‐‐install Installs the specified package
‐q ‐‐query Queries if the specified package is installed
‐U ‐‐upgrade Installs or upgrades the specified package
‐V

Скачать книгу