How to set up smartphones and PCs. Informational portal

Material from the Russian Fedora Project Knowledge Base. Display information about all available and installed packages

|

Most modern Unix-like operating systems offer centralized mechanisms for finding and installing packages. Software is usually distributed in the form of packages that are stored in repositories. Packages contain the main components operating system, as well as shared libraries, applications, services, and documentation.

Package management system beyond installation software, provides many other features and tools for upgrading already installed packages. Package repositories ensure code gets through necessary verification for use in the system, and that installed versions software have been approved by the developers.

When setting up a server or development environment, it's best to look for packages in the official repositories. Packages in stable version distribution may be out of date, especially if the software is updated quickly.

Package management is a vital skill for system administrators and developers.

This guide covers the basics of package management: finding, installing, and updating packages for various distributions.

Package Management Systems: A Brief Overview

Most package management systems are built around sets of package files. A package file is typically an archive that contains compiled binaries, installation scripts, and other resources that make up a program. Packages also contain valuable metadata, including their dependencies (the list of packages needed to run the program).

Operating system Format
Debian .deb
ubuntu .deb
CentOS .rpm
Fedora .rpm
FreeBSD ports, .txz

CentOS, Fedora, and other Red Hat systems use RPM files. CentOS uses the yum manager to interact with packages and repositories. AT latest versions Fedora yum has been replaced by a modernized dnf manager. On Debian and its based systems (Ubuntu, Linux Mint, Raspbian) uses the .deb format. The APT (Advanced Packaging Tool) package manager provides commands used for the most common operations: finding repositories, managing updates, installing a set of packages and their dependencies. APT commands work like a front-end utility lower level dpkg which handles the installation of individual .deb packages on local system; if necessary, this utility can be called explicitly.

system binary files FreeBSD is managed by the pkg command. In addition, FreeBSD provides a collection of ports, local structure directories and tools that allow you to extract, compile and install packages from source code with makefiles. It is usually more convenient to use the pkg manager, but sometimes precompiled packages are not available.

Updating the package list

Most systems maintain a local database of packages available from remote repositories. It is recommended that you update this database before installing or upgrading a package. Partial exceptions to this pattern are yum and DNF, which check for package updates before performing some operations.

Operating system Team
Debian/Ubuntu sudo apt-get update
CentOS yum check-update
Fedora dnf check-update
FreeBSD Packages sudo pkg update
FreeBSD Ports sudo portsnap fetch update

Upgrading Installed Packages

Keeping installed software up to date without the help of a package management system is a rather time-consuming task. You will have to track package updates and security notices for hundreds of different packages yourself. Of course, the package manager won't solve every problem you may encounter when updating software, but it will help keep most system components up to date with just a few commands.

AT FreeBSD system updating installed ports may require manual setting. It is recommended that you review /usr/ports/UPDATING before updating the portmaster.

System Team
Debian/Ubuntu sudo apt-get upgrade
sudo apt-get dist-upgrade
CentOS sudo yum update
Fedora sudo dnf upgrade
FreeBSD Packages sudo pkg upgrade
FreeBSD Ports less /usr/ports/UPDATING
cd /usr/ports/ports-mgmt/portmaster && sudo make install && sudo portmaster -a

Search for packages

Most distributions provide a graphical or menu-driven interface for collections of packages. It allows you to browse categories and search for new software. However, most often the fastest and most effective way package search is search using command line tools.

System Team
Debian/Ubuntu apt-cache search search_string
CentOS yum search search_string
yum search all search_string
Fedora dnf search search_string
dnf search all search_string
FreeBSD (packages) pkg search search_string
pkg search -f search_string
pkg search -D search_string
FreeBSD (ports) cd /usr/ports && make search name=package
cd /usr/ports && make search key=search_string

Package Information

When deciding how to install a package, ask for help from detailed description packages. This readable text often contains useful metadata such as version numbers, a list of dependencies, and so on.

System Team
Debian/Ubuntu apt-cache show package
dpkg -s package
CentOS yum info package
yum deplist package
Fedora dnf info package
dnf repoquery --requires package
FreeBSD (packages) pkg info package
FreeBSD (ports) cd /usr/ports/category/port && cat pkg-descr

Installing packages from repositories

Knowing the name of the required package, you can install it very quickly with a single command. You can also list all the packages that need to be installed in one command.

System Team
Debian/Ubuntu sudo apt-get install package
sudo apt-get install package1 package2 ...
sudo apt-get install -y package
CentOS sudo yum install package
sudo yum install package1 package2 ...
sudo yum install -y package
Fedora sudo dnf install package
sudo dnf install package1 package2 ...
sudo dnf install -y package
FreeBSD (packages) sudo pkg install package
sudo pkg install package1 package2 ...
FreeBSD (ports) cd /usr/ports/category/port && sudo make install

Installing a package from the local file system

Sometimes developers or vendors offer batch files for download, even if the application is not officially packaged for this operating system.

Typically, these packages can be downloaded using a web browser or curl utilities in command line. Once the package is downloaded, it can be installed with a single command.

On Debian-like systems, dpkg manages individual package files. If a package has dependencies that are not installed on the system, gdebi can download them from the official repository.

On CentOS and Fedora systems to install individual files and handling the necessary dependencies is used by yum and dnf.

System Team
Debian/Ubuntu sudo dpkg -i package.deb
sudo apt-get install -y gdebi&& sudo gdebi package.deb
CentOS sudo yum install package.rpm
Fedora sudo dnf install package.rpm
FreeBSD (packages) sudo pkg add package.txz
sudo pkg add -f package.txz

Removing packages

The package manager knows exactly what files each package provides, so it can be used to easily remove all unnecessary programs.

Today I would like to briefly describe the package manager commands yum- the official build of FreePBX is based on CentOS, which has yum installed by default. It is useful for installing, removing, updating packages.

Package installation

For example, to install a package mc you need to enter the command yum install mc . After entering the command, the system will ask for confirmation. For confirmation to be approved by default, you need to add a key -y, for example yum –y install mc:

# yum install mc Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.corbina.net * epel: mirror.datacenter.by * extras: mirror.corbina.net * updates: mirror.corbina.net Resolving Dependencies -- > Running transaction check ---> Package mc.x86_64 1:4.8.7-11.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================== ================================================= ============ Package Arch Version Repository Size ================================ ============================================= Installing: mc x86_64 1:4.8.7-11.el7 base 1.7 M Transaction Summary ================================= =========================================== Install 1 Package Total download size: 1.7 M Installed size: 5.6 M Is this ok : y Downloading packages: mc-4.8.7-11.el7.x86_64.rpm | 1.7 MB 00:00 Running transaction Running check transaction test Transaction test succeeded Running transaction Installing: 1:mc-4.8.7-11.el7.x86_64 1/1 Verifying: 1:mc-4.8.7-11.el7.x86_64 1 /1 Installed: mc.x86_64 1:4.8.7-11.el7 Complete!

Removing a package

To remove a package, respectively, you need to enter the command yum remove mc . Similarly, you can use the -y confirmation key:

# yum remove mc Loaded plugins: fastestmirror Resolving Dependencies --> Running transaction check ---> Package mc.x86_64 1:4.8.7-11.el7 will be erased --> Finished Dependency Resolution Dependencies Resolved ====== ================================================= ======================= Package Arch Version Repository Size ===================== ================================================= ========= Removing: mc x86_64 1:4.8.7-11.el7 @base 5.6 M Transaction Summary ====================== ================================================= ======== Remove 1 Package Installed size: 5.6 M Is this ok : y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Erasing: 1:mc-4.8.7-11.el7.x86_64 1/1 Verifying: 1:mc-4.8.7-11.el7.x86_64 1/1 Removed: mc.x86_64 1:4.8.7-11.el7 Complete!

Package update

Suppose you have old version mysql and you need to update it - here the command is used update. The whole command will look like this: yum update mysql .

Package Search

If you want to check if a specific package is installed on the server and available for installation, use the command list. The whole command will look like this: yum list mysql . You can also specify the exact version of the package if you need a more granular search.

Displaying information about a package

If you want to display information about a package, use the command info. The whole command will look like this: yum info mc .

Display information about all available and installed packages

For this, the command is used list with modifiers. For output available packages: yum list | less , and yum list installed | less

Examination available updates for packages and the update itself

The command to check is check-update, and for update - update. Below are three examples of command usage:

  • yum check-update mysql - check for mysql package updates;
  • yum list updates - display a list of updates;
  • yum update mc - Midnight Commander update;
  • yum -y update - update all installed packages;
Group packages and operations with them

In Linux, some packages are collected into so-called group packages - for example, DNS Name Server, editors, Java development etc. With yum, you can install bulk packages with the command groupinstall- example below yum groupinstall ‘Clustering . I will briefly describe the rest of the commands for manipulating group packages:

  • yum grouplist - display all group packages available for installation;
  • yum groupupdate 'Base' - update a specific group package, in this case– base;
  • yum groupremove 'Editors' - remove group package;
Repositories in yum

The search for packages takes place in the so-called repositories, below I will give a few commands for working with them - the principle is the same as with packages (list commands, for example). List all active repositories with yum repolist , and list inactive repositories with yum repolist all

To install a package from a specific repository, whether active or inactive, a key is used --enablerepo. As an example - phpmyadmin installation: yum --enablerepo=epel install phpmyadmin

Terminal in yum and history

If you are going to do a lot of operations with packages, then you can immediately enter the yum shell using the yum shell command and using the commands you already know (only without the first three letters, respectively), you can install\remove\upgrade\whatever packages. Another interesting feature is the ability to view the installation history in yum - using the yum history command.

Is this article helpful to you?

Please tell me why?

We are sorry that the article was not useful to you: (Please, if it’s not difficult, indicate for what reason? We will be very grateful for a detailed answer. Thank you for helping us become better!

Destination Yum

Yum was created to solve the following problems:

  • Finding packages in the repositories
  • Installing packages from repositories
  • Installing packages from .rpm files, resolving dependencies using repositories
  • System update
  • Removing unwanted packages
  • In fact, yum is a wrapper for rpm that provides work with repositories.

Basic Package Operations

Search in repositories

Three commands are used to search repositories with yum: list , search and provides .

The easiest way to search is to use the list command. The list command looks at package names and versions looking for matches. For example, to view packages named tsclient, use:

Yum list tsclient

The search command searches the package name and description for the specified string. For example, to search for PalmPilot related packages, type:

Yum search PalmPilot

The provides command allows you to search for packages containing specified file. For example, to search for packages containing libneon, type:

Yum provides libneon

Do all search commands support wildcards? and * (escaping them with \ for bash to parse them correctly). For example, when searching for packages starting with tsc, type:

Yum list tsc\*

to search for packages containing files in the /etc/httpd directory

Yum provides /etc/httpd\*

or to search for certain commands / programs, for example, to search for mc (midnight commander)

Yum provides \*/mc

as a result we get the following output

1:mc-4.7.4-1.fc14.i686: User-friendly text console file manager and visual shell Repository: base Matches: Filename: /usr/share/mc Filename: /usr/libexec/mc Filename: /etc/mc Filename: /usr/bin/mc

Installing packages with Yum

To install packages with yum, use the install option

To install tsclient type:

Yum install tsclient

Yum will automatically resolve (if it can) the dependencies and offer to install them:

================================================= =========================== Package Arch Version Repository Size ================== ================================================= ========= Installing: tsclient i386 0.132-6 base 247 k Installing for dependencies: rdesktop i386 1.4.0-2 base 107 k Transaction Summary =============== ================================================= ============ Install 2 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 355 k Is this ok :

Installing packages from .rpm files

To install an .rpm package with automatic dependency resolution, the localinstall command used to be used. Now you can use the usual install . So the command:

Yum install foo.rpm

will automatically find the dependencies of the foo.rpm package in the repositories (if it can) and offer to install them.
There may be a problem in the absence or unknown GPG signature of the RPM package, which will result in a failure to install and, as a result, the following error

Public key for foo.rpm not set

In order to get around this (in case you trust the source providing the package) you need to turn off checking GPG keys by adding the --nogpgcheck option to the end of the command

System update

Updating the system is done with a single command - update . Thus:

Yum update

will update your entire system. A team

Yum update foo

When using both methods, performance is preserved.

Using Yum with a proxy server

In order to make Yum work through a proxy server, you need to add the following parameter to /etc/yum.conf:

Proxy=http://yourproxy:8080/

where - yourproxy is the name of the proxy server and 8080 is the port of the proxy server. If the server requires authentication, you can specify the login as:

proxy=http://username: [email protected]:8080/

The RPM Package Manager allows you to use proxy environment variables. This can be set in /etc/profile or specific to specific user in file ~/.bash_profile::

Export http_proxy=http://yourproxy:8080/
export ftp_proxy=http://yourproxy:8080/

To use wget through a proxy, add following lines in /etc/wgetrc

Http_proxy = http://yourproxy:8080/
ftp_proxy = http://yourproxy:8080/

In both cases, login and password can be set as in the example above.

Using Yum to install a local package, automatically checking and satisfying dependencies

yum --nogpgcheck localinstall packagename.arch.rpm

Displaying priorities for all installed repositories

You can get a list of all repositories you have installed - yum repolist all. However, it does not show the priority index. Here is the line needed for this. If the number is not defined, it defaults to the lowest priority (99).

Cat /etc/yum.repos.d/*.repo | sed -n -e "/^\)

Top Related Articles