Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the differences between yum and apt-get

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about the differences between yum and apt-get. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The difference between yum and apt-get

Generally speaking, the famous linux systems are basically divided into two categories:

1.RedHat series: Redhat, Centos, Fedora, etc.

2.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 series

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 the files.

Rpm is the equivalent of an installation file in windows, and it automatically handles dependencies between packages.

In terms of advantages and disadvantages, rpm is generally a pre-compiled file, which may have been bound to some kind of CPU or distribution.

Tar generally includes compilation scripts, which you can compile in your environment, so it is versatile.

If your package does not want to open source, you can make it into rpm. If it is open source, it is more convenient to use tar.

Tar is generally source code packaged software, need to unpack their own, and then install the trilogy,. / configure, make, make install. To install the software.

Rpm is a software package management mechanism of redhat Company, which directly carries out installation and deletion operations through the rpm command. The biggest advantage is that it automatically deals with the possible dependencies of various software packages.

-- * .rpm binary package [centos]

Installation: rpm-ivh * .rpm

Uninstall: rpm-e packgename

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

Querying a file is generated by that rpm package: rpm-qf / etc/yum.conf

Rpm-qpi xxx

Rpm-qa | grep php to view installed RMP packages

Installation: rpm-ivh xxx

Remove: rpm-e xxx

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

Querying a file is generated by that rpm package: rpm-qf / etc/yum.conf

Rpm-qpi xxx

-- installation and uninstallation of src.rpm source code distribution package

The source code distribution of Linux software refers to the release form of all the program source code of the software, which requires users to compile into executable binary code and install it. Its advantage is flexible configuration, can remove or retain some functions / modules at will, adapt to a variety of hardware / operating system platforms and compilation environment, the disadvantage is that it is difficult, generally not suitable for beginners to use.

1. Source code package in the form of * .src.rpm

Installation: rpm-rebuild * .src.rpm

Cd / usr/src/dist/RPMS

Rpm-ivh * .rpm

Uninstall: rpm-e packgename

Description: the rpm-rebuild * .src.rpm command compiles the source code and generates a binary rpm package under / usr/src/dist/RPMS, and then installs the binary package. Packgename is as described earlier.

-- dpkg [ubuntu]

Dpkg-l | grep 'php' uses dpkg-l to view installed software

Dpkg is short for Debian [guest] Package. A suite management system specially developed for Debian to facilitate the installation, update and removal of software. All Linux distributions originating from Debian use dpkg, such as Ubuntu, Knoppix, and so on.

Here are some common uses of Dpkg:

1. Dpkg-I

Install a Debian package, such as the file you downloaded manually.

2. Dpkg-c

What is listed.

3. Dpkg-I

Extract package information from.

4. Dpkg-r

Remove an installed package.

5. Dpkg-P

Completely clear an installed package. Unlike remove, remove only deletes data and executables, and purge also deletes all configuration files.

6. Dpkg-L

Make a list of all installed files. At the same time, see dpkg-c to check the contents of a .deb file.

7. Dpkg-s

Displays information about installed packages. Also see apt-cache to display the package information in the Debian archive, and dpkg-I to display the package information extracted from a .deb file.

8 、 dpkg-reconfigure

Reconfigure an installed package if it uses debconf (debconf provides a unified configuration interface for package installation).

-use yum and apt-get. Upgrade of software management methods.

The configuration file for yum is / etc/yum.conf

1. Let's start with advanced package management like Redhat's yum.

Yum install gcc [centos]

Update: yum update

Installation: yum install xxx

Remove: yum remove xxx

Clear installed files (/ var/cache/yum/): yum clean all

Search: yum search xxx

List all files: yum list

Query file message: yum info xxx

# sudo-s

# LANG=C

# yum-y install gcc gcc-c autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel

Install the software package with YUM

Yum-y

Command: yum install

Delete a software package with YUM

Command: yum remove

Yum-y remove httpd*

Command: yum search

List all installable software packages

Command: yum list

Yum list php*

List all updatable software packages

Command: yum list updates

List all installed packages

Command: yum list installed

List all packages that are installed but not within Yum Repository

Command: yum list extras

List the specified software packages

Command: yum list

Yum = Yellow dog Updater, Modified

The main function is to make it easier to add / delete / update RPM packages.

It can automatically solve the problem of packet dependence.

It is easy to manage a large number of system update problems.

Characteristics of yum

Multiple repositories can be configured simultaneously (Repository)

Concise configuration file (/ etc/yum.conf

Automatically resolve dependency issues encountered when adding or deleting rpm packages

Easy to use

Maintain consistency with RPM database

Yum installation

CentOS comes with (yum-*.noarch.rpm)

# rpm-ivh yum-*.noarch.rpm

Before enabling yum for the first time, you need to import the RPM-GPG-KEY of the system:

# rpm-import / usr/share/doc/centos-release-3 (4) / RPM-GPG-KEY-CentOS-3 (4)

Yum instruction

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

Updates to the rpm package

Check for updatable rpm packages

# yum check-update

Update all rpm packages

# yum update

Update specified rpm packages, such as kernel and kernel source

# yum update kernel kernel-source

Large-scale version upgrades, unlike yum update, even old obsolete packages are upgraded.

# yum upgrade

Installation and removal of rpm packages

Install rpm packages, such as xmms-mp3

# yum install xmms-mp3

Delete the rpm package, including packages that are dependent on the package

# yum remove licq

Note: you will also be prompted to delete licq-gnome,licq-qt,licq-text.

Parameters related to yum temporary storage (/ var/cache/yum/)

Clear rpm package files in temporary storage

# yum clean packages

Clear the rpm header file in temporary storage

# yum clearn headers

Clear old rpm header files in temporary storage

# yum clean oldheaders

Clear old rpm header files and package files in temporary storage

# yum clearn or # yum clearn all

Note: equivalent to yum clean packages + yum clean oldheaders

Package list

List all rpm packages in the repository that can be installed or updated

# yum list

List the specific rpm packages in the repository that can be installed or updated, as well as which packages have been installed

# yum list mozilla#yum list mozilla*

Note: you can use matches in rpm package names, such as listing all rpm packages that begin with mozilla

List all updatable rpm packages in the repository

# yum list updates

List all installed rpm packages

# yum list installed

List rpm packages that have been installed but are not included in the repository

# yum list extras

Note: download and install the rpm package through other websites

Rpm package information display (info parameter is the same as list)

Lists information about all rpm packages in the repository that can be installed or updated

# yum info

Lists specific information in the repository that can be installed or updated, as well as the rpm packages that have been installed

# yum info mozilla#yum info mozilla*

Note: you can use matches in rpm package names, such as listing information for all rpm packages that begin with mozilla

Lists information about all updatable rpm packages in the repository

# yum info updates

List the information of all installed rpm packages

# yum info installed

Lists information about rpm packages that have been installed but are not included in the repository

# yum info extras

Note: download information about installed rpm packages from other websites

Search for rpm packages

Search for rpm packets that match specific characters

# yum search mozilla

Note: search in rpm package name, package description, etc.

Search for rpm packages that contain specific file names

# yum provides realplay

Increase the resource pool

For example, add rpm.livna.org as a resource library

Install Livna.org rpms GPG key

# rpm-- import http://rpm.livna.org/RPM-LIVNA-GPG-KEY

Check GPG Key

# rpm-qa gpg-pubkey*

Display Key information

# rpm-qi gpg-pubkey-a109b1ec-3f6e28d5

(note: if you want to delete Key, use # rpm-e gpg-pubkey-a109b1ec-3f6e28d5)

Commands commonly used in yum

# yum install xxx installs xxx software

# yum info xxx View the information of xxx software

# yum remove xxx delete software package

# yum list lists software packages

# yum clean clears buffered and reconciled packages

# yum provides xxx uses xxx as the keyword search package (the information provided is the keyword)

# yum search xxx search package (with name as keyword)

# yum groupupdate xxx

# yum grouplist xxx

# yum groupremove xxx

These three are all a group of operations that upgrade the list and delete the unit. For example, "Mysql Database" is a group that operates all relevant software packages at the same time.

# yum update system upgrade

# yum list available lists packages on all upgrade sources

# yum list updates lists updatable packages on all upgrade sources

# yum list installed lists installed packages

# yun update kernel upgrade kernel

Sources commonly used in yum

1) automatically select the fastest source

Because some mirror in yum is very slow, if yum chooses this mirror, yum will be very slow at this time. You can download the fastestmirror plug-in, which automatically selects the fastest mirror:

# yum install yum-fastestmirror

Configuration file: (usually do not move) / etc/yum/pluginconf.d/fastestmirror.conf

The speed test record file of your yum image: / var/cache/yum/timedhosts.txt

(2) yum with graphical interface

If you find command-line yum inconvenient, you can use graphical yumex, which seems more convenient because you are free to choose the software repository:

# yum install yumex

Then you can see yum extender in the system tools. In fact, the system's own "add / remove programs" can also achieve graphical software installation, but some yumex functions it does not have.

two。 Talk about the advanced package management method apt-get in Ubuntu

Configuration file / etc/apt/sources.list

For the Server version, it is recommended to use aptitude to view, install and delete the deb package

Sudo apt-get install aptitude

Then execute sudo aptitude to enter the management

You can also use the command:

Aptitude update updates the list of available packages

Aptitude upgrade upgrade available packages

Aptitude dist-upgrade upgrades the system to a new release

Aptitude install pkgname installation package

Aptitude remove pkgname delete package

Aptitude purge pkgname delete package and its configuration file

Aptitude search string search package

Aptitude show pkgname displays package details

Aptitude clean deletes downloaded package files

Aptitude autoclean deletes only expired package files

Considering the compatibility of the system, and the above things are relatively large, do not find the latest version, just use apt-get install XXX to install. Because our Ubuntu is dailyBulid, the contents of the CD are basically up-to-date and do not need to be downloaded again. If you must have the latest version, you might as well update the software repository by apt-get update first, and then apt-get install.

Common APT command parameters:

Apt-cache search package search package

Apt-cache show package gets information about the package, such as description, size, version, etc.

Sudo apt-get install package installation package

Sudo apt-get install package-- reinstall reinstall package

Sudo apt-get-f install repair installation "- f =-- fix-missing"

Sudo apt-get remove package delete package

Sudo apt-get remove package-- purge delete packages, including deletion of configuration files, etc.

Sudo apt-get update update source

Sudo apt-get upgrade updates installed packages

Sudo apt-get dist-upgrade upgrade system

Sudo apt-get dselect-upgrade uses dselect to upgrade

Apt-cache depends package understands using dependencies

Apt-cache rdepends package is to see which packages the package is dependent on.

Compilation environment related to sudo apt-get build-dep package installation

Apt-get source package downloads the source code of the package

Sudo apt-get clean & & sudo apt-get autoclean cleans up useless packages

Sudo apt-get check checks for corrupted dependencies

Thank you for reading! This is the end of the article on "what's the difference between yum and apt-get". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report