Differences between yum and apt

1. Contrast

Comparison itemrpmyumdpkgapt
seriesRedHat systemRedHat systemDebian systemDebian system
differencePackage installation toolDependency management toolsPackage installation toolDependency management tools
Query installedrpm -qayum list installeddkpg -lapt list –installed
installrpm -i package.rpm or rpm – ivh http://www.xxx.net/package.rpmyum install -ydpkg -i package.debapt-get install package
to updaterpm –U software.rpmyum updateapt upgrade
Remove packagerpm -e [module1][module2]...yum -removedpkg -r packageapt remove package
Remove package and configurationdpkg -Papt purge package
Download package storage location/var/cache/apt/archives
Default location for software installationrpm -ql/usr/share
Executable location/usr/bin/usr/bin
Profile location/etc/etc
lib file location/usr/lib/usr/lib
User manual/usr/share/doc
Help documentation/usr/share/man
to update

2. Overview

Generally speaking, famous Linux systems are basically divided into two categories:
Redhat series: Redhat, Centos, Fedora, etc
Debian series: Debian, Ubuntu, etc

RedHat series

  1. The common installation package format is rpm package. The command to install rpm package is "rpm - parameter"
  2. Package management tool yum
  3. Support tar package

Debian collection

  1. The common installation package format is deb package. The command to install deb package is "dpkg - parameter"
  2. Package management tool apt get
  3. Support tar package
  • tar is just a compressed file format, so it just compresses and packages files.
  • rpm is equivalent to the installation file in windows. It automatically handles the dependencies between software packages.
  • In terms of advantages and disadvantages, rpm is generally a precompiled file, which may have been bound to a CPU or distribution.

tar generally includes compiling scripts. You can compile them in your environment, so it is universal.
If your package does not want to open the source code, you can make it into rpm. If it is open source, it is more convenient to use tar.
tar is usually software packaged with source code. You need to unpack it yourself, and then install the trilogy. / configure, make, make install. To install the software.

rpm is a software package management mechanism of redhat company. It can directly install and delete through rpm command. The biggest advantage is that it automatically handles the possible dependencies of various software packages.

3. Binary package in *. rpm form [centos]

  • Installation: rpm -ivh *.rpm
  • Unloading: RPM - e packname
    rpm -q nginx to see if it is installed
  • Upgrade: rpm -Uvh xxx
  • Query:
    • Query all installed packages: rpm -qa
    • Query a package: rpm -qa | grep xxx
      rpm -qi xxx
    • Query the installation path of the software: rpm -ql xxx
      rpm -qc xxx
    • Query which rpm package generates a file: rpm -qf /etc/yum.conf
      rpm -qpi xxx
      rpm -qa|grep php view the installed RMP package

4,dpkg[ubuntu]

dpkg -l | grep 'php'
Use dpkg -l to view the installed software

Dpkg is short for Debian Package. A suite management system specially developed for Debian to facilitate software installation, update and removal. All Linux distributions from Debian use dpkg, such as Ubuntu, Knoppix, etc.

1) . usage:

1,`dpkg -i <package.deb>`
Install one Debian Software packages, such as files you download manually.

2,`dpkg -c <package.deb>`
list <package.deb> Content of the.

3,`dpkg -I <package.deb>`
from <package.deb> Extract package information from.

4,`dpkg -r <package>`
Remove an installed package.

5,`dpkg -P <package>`
Completely remove an installed package. and remove The difference is, remove Just delete the data and executable files, purge Also delete all configuration files.

6,`dpkg -L <package>`
list <package> List of all files installed. At the same time, please see dpkg -c To check one .deb Contents of the file.

7,`dpkg -s <package>`
Displays information about installed packages. At the same time, please see apt-cache display Debian Package information in the archive, and dpkg -I To display from a .deb Package information extracted from the file.

8,`dpkg-reconfigure <package>`
Reconstitute an installed package if it uses debconf (debconf It provides a unified configuration interface for package installation). 

5,yum

yum = Yellow dog Updater, Modified
The configuration file for Yum is / etc/yum.conf

Let's first talk about the advanced package management of Redhat's yum

1) . common commands

# Install xxx software using yum install xxx
# View information about xxx software using yum info xxx
# Remove package using yum remove xxx
# List packages using yum list
# yum clean to clear the buffers and packages
# yum provides xxx searches for packages using xxx as the keyword (the information provided is the keyword)
# Search packages using yum search xxx (by name)
# yum groupupdate xxx
# yum grouplist xxx
# yum groupremove xxx

These three operations are performed by group.. such as "Mysql Database"That is, a group will operate all related software packages at the same time;
# Update system upgrade using Yum or up2date
# List packages on all upgrade sources using yum list available;
# yum list updates lists the updatable packages on all upgrade sources;
# yum list installed to list the installed packages;
# yun update kernel upgrade kernel;

2) , yum features

  1. Multiple repositories can be configured at the same time
  2. Concise configuration file (/ etc/yum.conf)
  3. Automatically resolve dependency problems encountered when adding or deleting rpm packages
  4. Easy to use
  5. Maintain consistency with RPM database

3) , yum detailed instructions

Note: when you use Yum for the first time or update the yum resource library, Yum will automatically download all required headers and place them in the / var/cache/yum directory, which may take a long time

rpm Package update
 Check for updatable rpm package
#yum check-update
 Update all rpm package
#yum update
 Update specified rpm package,If updated kernel and kernel source
#yum update kernel kernel-source
 Large scale version upgrade,And yum update The difference is,Even old obsolete packages are upgraded
#yum upgrade
rpm Installation and removal of packages
 install rpm package,as xmms-mp3
#yum install xmms-mp3
 delete rpm package,Include packages that depend on the package
#yum remove licq
 notes:You will also be prompted to delete licq-gnome,licq-qt,licq-text
yum Temporary storage(/var/cache/yum/)Relevant parameters of
 Clear staging rpm Package file
#yum clean packages
 Clear staging rpm Header file
#yum clearn headers
 Clear old in staging rpm Header file
#yum clean oldheaders
 Clear old in staging rpm Header and package files
#yum clearn or#yum clearn all
 notes:amount to yum clean packages + yum clean oldheaders

Package list
 Lists all that can be installed or updated in the repository rpm package
#yum list
 Lists the specific that can be installed or updated in the repository and the ones that have been installed rpm package
#yum list mozilla#yum list mozilla*
notes:Can be in rpm Use matching characters in package names,If all are listed mozilla initial  rpm package
 Lists all that can be updated in the repository rpm package
#yum list updates
 List all installed rpm package
#yum list installed
 Lists installed but not included in the repository rpm package
#yum list extras
 notes:Download and install through other websites rpm package
rpm Package information display(info Same parameters list)
Lists all that can be installed or updated in the repository rpm Package information
#yum info
 Lists the specific that can be installed or updated in the repository and the ones that have been installed rpm Package information
#yum info mozilla#yum info mozilla*
notes:Can be in rpm Use matching characters in package names,If all are listed mozilla initial  rpm Package information
 Lists all that can be updated in the repository rpm Package information
#yum info updates
 List all installed rpm Package information
#yum info installed
 Lists installed but not included in the repository rpm Package information
#yum info extras
 notes:Download and install through other websites rpm Package information
 search rpm package
 Search for matching specific characters rpm package
#yum search mozilla
 notes:stay rpm Package name,Search in package description, etc
 Search for files with specific file names rpm package
#yum provides realplay
 Add resource pool
 for example:increase rpm.livna.org As a repository
 install Livna.org rpms GPG key
#rpm --import http://rpm.livna.org/RPM-LIVNA-GPG-KEY
 inspect GPG Key
#rpm -qa gpg-pubkey*
display Key information
#rpm -qi gpg-pubkey-a109b1ec-3f6e28d5
(notes:If you want to delete Key,use#rpm -e gpg-pubkey-a109b1ec-3f6e28d5)

4) yum, common sources

  1. Automatically select the fastest source
    Because some mirrors in yum are very slow, if yum selects this mirror, yum will be very slow at this time. For this, you can download the fastestmirror plug-in, which will automatically select the fastest mirror:
#yum install yum-fastestmirror

Configuration file: (generally do not move) / etc / Yum / pluginconf.d/faststmirror.conf
Speed test record file of your yum image: / var/cache/yum/timedhosts.txt
2. Use yum in the graphical interface
If you find it inconvenient to use yum on the command line, you can use the graphical yumex, which looks more convenient because you can freely choose the software warehouse:

#yum install yumex

Then you can see yum extender in the system tool. In fact, the system's own "add / Remove Program" can also realize graphical software installation, but it does not have some functions of yumex.

6,apt-get

Configuration file / etc/apt/sources.list

Under Ubuntu, apt get is almost one of the most commonly used shell commands, because it is a common tool command for Ubuntu to install software through xinlide.

Common APT command parameters:

  • Apt cache search package

  • Apt cache show package gets the package related information, such as description, size, version, etc

  • Sudo apt get install package

  • Sudo apt get install package -- reinstall reinstall package

  • Sudo apt get - f install repair installation

  • Sudo apt get remove package delete package

  • Sudo apt get remove package -- purge deletes packages, including configuration files

  • Sudo apt get update source

  • Sudo apt get upgrade update installed packages

  • Sudo apt get dist upgrade upgrade system

  • Apt cache dependencies package learn which packages the package depends on

  • Apt cache rdependents package view which packages the package depends on

  • Sudo apt get build dep package installs the relevant compilation environment

  • Apt get source package download the source code of the package

  • Sudo apt get clean & & sudo apt get autoclean clean up useless packages

  • Sudo apt get check checks for corrupt dependencies

Tags: Linux Operation & Maintenance Ubuntu

Posted on Tue, 28 Sep 2021 06:17:30 -0400 by k994519