📜 ⬆️ ⬇️

Linux package managers almanac

Sometimes the question may arise: whose file is this, where did this library come from ? A convenient package manager solves a lot of OS problems. It is safe to say that if you make friends with the MP, you make friends with the distribution as such. Moreover, it is important to master the set of basic commands, and know where to find additional information.


Package management

The following is a gentleman's set of commands for basic Linux distributions necessary for the daily routine: install, update and remove a package, roll updates, check dependencies, set the file ownership of a package, etc.


Debian and related


The popularity and image of a Linux-friendly distribution played a trick on Ubuntu. It seems to some newbies that you can do anything on it without the help of the command line. This is a delusion and it is better to get rid of it as soon as possible.


The fact that in the examples aptitude does not mean that it is more correct than apt-get . For me, it's just a matter of habit.


 $ aptitude install package # ; $ aptitude safe-upgrade package # ; $ aptitude update #   ; $ aptitude remove package # ; $ aptitude purge package #   ,    ; $ apt-get dist-upgrade # , killer-feature   ! $ aptitude search package # . $ apt-cache depends package # ; $ apt-cache rdepends package #   . 

Some features are available with an additional dpkg MT.


 $ dpkg -l #  ; $ dpkg -L package #   

There is such a miracle - wajig . Despite the strange sound, it is quite suitable for the MP with a human-readable display of information on the screen.


Configuring repositories is done by editing the /etc/apt/sources.list file.


 $ wajig install package $ wajig distupgrade # ; $ wajig install --fileinput filename #  ; $ wajig listinstalled 

Overall, the Debian PM is one of the best I've dealt with.


Redhat and other RPM distributions


RPM cannot be called a model package manager; rather, it was a cactus that mice ate with tears in their eyes. Then more or less imputed MP appeared: yum , dnf , zypper and others. I just updated more than 700 packages on the RHEL 7.4 server at a time and did not break anything, I think is a good result.


 $ yum install package $ yum update package $ yum update $ yum remove package $ yum deplist package # ; $ dnf repoquery --deplist #  ,  Fedora $ yum whatprovides package #   - ; $ yum list all #    

The rpm commands for cases when using yum not direct.


 $ rpm -i package # ; $ rpm -e packate # ; $ rpm -qa #  ; $ rpm -qi package #    ; $ rpm -q --whatrequires package #   . 

To set up Yum repositories, open the /etc/yum.repos.d/*.repo file, or use the yum-config-manager command.


Zypper


On SuSE Linux, Zypper / YaST to manage packages, the ZYpp engine rotates over RPM.


 $ zypper in mc # ,   ,    -  ; $ zypper up nginx openssh # ; $ zypper se gnome-desktop # ; $ zypper remove package; $ zypper se --provides --match-exact hg #   - ; $ zypper se --requires package #   . 

You can use operators and regular expressions.


 zypper in 'gcc.i586<5.1'#    i586,   5.1; zypper in php5*; 

Repositories are managed zypper mr command.


 $ zypper lr # ,   ; $ zypper mr -d 5 # 5- ; $ zypper mr -e 5 # 5- . 

Pacman


This MP is used in Archa and Manjaro.


 $ pacman -S package # ; $ pacman -R package # ; $ pacman -Su package # ; $ pacman -Q1 package #  ; $ pacman -Qo filename #   - ; $ whoneeds package #   ; $ pacman -Qdt # -,   . 

The database search engine supports regular expressions.


 $ pacman -Ss package #  ; $ pacman -Ss '^vim-' #   ; $ pacman -Qs package #   ; 

Configuring repositories and mirrors is done from the /etc/pacman.conf file /etc/pacman.conf


Gentoo emerge


Of course, this is more a speculative scenario than a real one, since it is difficult to assume that the red-eyed user of Gentoo Linux does not know the necessary emerge options. However, without this, the almanac would be incomplete.


 $ emerge package # ; $ emerge -av package #    ; $ emerge -pv package #    ; $ emerge -u packave #  ; $ emerge -C package #  ; $ emerge -auDv world #      ; $ emerge -auDNv word #         USE . 

With additional utilities, you can get more information about files, unnecessary packages, etc.


 $ revdep-rebuild #    ; $ eix package # ; $ equery belongs package #   - ; $ equery depends package #   ; $ equery uses package #USE  ; $ qlop -l #  emerge; 

Repositories, mirrors and all the most important for emerge / portage contained in /etc/make.conf .


Materials on the topic


  1. How To List All Installed Packages In Linux
  2. Package Management Basics: apt, yum, dnf, pkg
  3. 45 Zypper Commands to Manage SUSE Linux Package Management
  4. ArchWiki - pacman

')

Source: https://habr.com/ru/post/341764/


All Articles