What is the difference between yum and apt-get?

Source: Internet
Author: User
The differences between yum and apt-get are generally divided into two main categories: 1. redHat series: Redhat, Centos, Fedora, etc. 2. debian series: Debian, Ubuntu, and other RedHat Series 1 Common installation package format rpm packages, the command for installing the rpm Package is the difference between & ldqu yum and apt-get. Generally, the famous linux system is 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. the command for installing the rpm package is "rpm-parameter"

2 package management tool yum

3. support for tar packages


Debian series
1. the common installation package format is deb. the command for installing deb package is "dpkg-parameter"

2 package management tool apt-get

3. support for tar packages

Tar is only a compressed file format. Therefore, it only compresses and packs files.
Rpm is equivalent to an installation file in windows. it automatically processes dependencies between software packages.

In terms of advantages and disadvantages, rpm is generally a pre-compiled file, which may have been bound to a certain CPU or release version.
Tar generally includes the compilation script. you can compile it in your environment, so it is universal.

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

Tar is usually the software packaged in source code. you need to unpack the package yourself and then install the trilogy./configure, make, make install. to install the software.

Rpm is a software package management mechanism of redhat. it is directly installed and deleted using rpm commands. its biggest advantage is that it automatically handles the possible dependencies of various software packages.

-------------------------------- *. Binary package in rpm format [centos]

Installation: rpm-ivh *. rpm

Uninstall: rpm-e packgename

Run the rpm-q nginx command to check whether the nginx has been installed.

Upgrade: rpm-Uvh xxx

Query:
Query all installed packages: rpm-qa
Query a package: rpm-qa | grep xxx
Rpm-qi xxx
Query the software installation path: rpm-ql xxx
Rpm-qc xxx
Query the rpm package generated by a file: rpm-qf/etc/yum. conf
Rpm-qpi xxx

Rpm-qa | grep php 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 software installation path: rpm-ql xxx
Rpm-qc xxx
Query the rpm package generated by a file: rpm-qf/etc/yum. conf
Rpm-qpi xxx


-------------------------------- Install and uninstall the src. rpm source code distribution package

The source code distribution of Linux software refers to the release form of the source code of all programs of the software. you need to compile and install the executable binary code on your own. The advantage is that the configuration is flexible, some functions/modules can be removed or retained at will to adapt to a variety of hardware/operating system platforms and compiling environments. The disadvantage is that it is difficult and is generally not suitable for beginners.

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

Install: rpm-rebuild *. src. rpm

Cd/usr/src/dist/RPMS

Rpm-ivh *. rpm

Uninstall: rpm-e packgename

Note: The rpm-rebuild *. src. rpm command compiles the source code and generates a binary rpm package under/usr/src/dist/RPMS. then install the binary package. Packgename is described above.



-------------------------------- Dpkg [ubuntu]

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

Dpkg is short for Debian [waiting for bin] Package. A suite management system specially developed for Debian to facilitate software installation, update, and removal. All Debian-based Linux distributions use dpkg, such as Ubuntu and Knoppix.
Below are some common Dpkg usage:
1. dpkg-I
Install a Debian software package, such as the file you manually download.
2. dpkg-c
List .
3. dpkg-I
Slave .
4. dpkg-r
Remove an installed package.
5. dpkg-P
Completely clear an installed package. Unlike remove, remove only deletes data and executable files, and purge also deletes all preparation files.
6. dpkg-L
List List of all installed files. Check the content of A. deb file by checking dpkg-c.
7. dpkg-s
Displays information about installed packages. At the same time, 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
Re-prepare an installed package if it uses debconf (debconf provides a unified configuration interface for package installation ).



-------------------------------- Use yum and apt-get. Software management method upgrade.

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


1. let's talk about advanced package management such as Redhat yum.

Yum install gcc [centos]

Update: yum update
Install: 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 information: yum info xxx

# Sudo-s
# LANG = C
# Yum-y install gcc-c autoconf libjpeg-devel libpng-devel freetype-devel libpng-devel libxml2 libxml2-devel zlib-devel glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses-devel curl-devel

Install software package with YUM
Yum-y
Command: yum install

Use YUM to delete a software package
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 software packages
Command: yum list installed

List all installed but not in Yum Repository? Que na ?? Nbsp;
Command: yum list extras

List the specified software packages
Command: yum list

Yum = Yellow dog Updater, Modified
The main function is to conveniently add/delete/update RPM packages.
It automatically solves the dependency problem of the package.
It facilitates management of a large number of system update problems

Yum features
Multiple Resource libraries can be configured simultaneously (Repository)
Simple configuration file (/etc/yum. conf
Automatically solves the dependency problem when rpm packages are added or deleted.
Easy to use
Maintain consistency with the RPM database

Install yum
Built-in CentOS (yum-*. noarch. rpm)
# Rpm-ivh yum-*. noarch. rpm
Before you enable yum for the first time, you first need to import the system's RPM-GPG-KEY:
# Rpm -- import/usr/share/doc/centos-release-3 (4)/RPM-GPG-KEY-CentOS-3 (4)

Yum command
Note: When the yum or yum Resource Library is updated 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.

Rpm package update
Check the updatable rpm Package
# Yum check-update
Update all rpm packages
# Yum update
Update the specified rpm package, such as updating the kernel and kernel source
# Yum update kernel-source
For large-scale version upgrades, unlike yum update, the old obsolete package is also upgraded.
# Yum upgrade

Installation and deletion of rpm packages
Install rpm packages like xmms-mp3
# Yum install xmms-mp3
Delete an rpm package, including packages that depend on the package
# Yum remove licq
Note: You will also be prompted to delete licq-gnome, licq-qt, and licq-text.

Parameters related to yum temporary storage (/var/cache/yum /)
Clear temporary rpm Package files
# Yum clean packages
Clear temporary rpm header files
# Yum clearn headers
Clear the existing rpm header file
# Yum clean oldheaders
Clear existing rpm header files and package files
# Yum clearn or # yum clearn all
Note: equivalent to yum clean packages + yum clean oldheaders

Package List
List all rpm packages that can be installed or updated in the Resource Library
# Yum list
List specific rpm packages that can be installed, updated, and installed in the Resource Library
# Yum list mozilla *
Note: Match characters can be used in rpm package names, for example, to list all rpm packages starting with mozilla
List all updates to the rpm package in the Resource Library
# Yum list updates
List all installed rpm packages
# Yum list installed
List rpm packages installed but not included in the Resource Library
# Yum list extras
Note: Download and install the rpm package from other websites

Rpm Package Information Display (the info parameter is the same as the list)
Lists information about all rpm packages that can be installed or updated in the resource library.
# Yum info
Lists the specific information of rpm packages that can be installed or updated and installed in the resource library.
# Yum info mozilla *
Note: Match characters can be used in rpm package names, such as listing all rpm packages starting with mozilla
Lists information about all the rpm packages that can be updated in the resource library.
# Yum info updates
Lists information about all installed rpm packages.
# Yum info installed
Lists the installed rpm packages that are not included in the resource library.
# Yum info extras
Note: Download the installed rpm package information from other websites.

Search for rpm packages
Search for rpm packages matching specific characters
# Yum search mozilla
Note: Search for rpm package names and package descriptions
Search for rpm packages with specific file names
# Yum provides realplay

Add Resource Library
For example, add rpm.livna.org as the 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 *
Show Key Information
# Rpm-qi gpg-pubkey-a109b1ec-3f6e28d5
(Note: If you want to delete the Key, use the # rpm-e gpg-pubkey-a109b1ec-3f6e28d5)

Common yum commands

# Install xxx software in yum install xxx

# Yum info xxx view xxx software information

# Yum remove xxx delete a software package

# Yum list listing software packages

# Yum clean

# Yum provides xxx search package with xxx as the keyword (the provided information is the keyword)

# Yum search xxx search package (name-based keyword)

# Yum groupupdate xxx

# Yum grouplist xxx

# Yum groupremove xxx

All three are in a group to perform the upgrade list and delete operations .. For example, "Mysql Database" is a group that operates all related software packages at the same time;

# Yum update system upgrade

# Yum list available lists all packages on the upgrade source;

# Yum list updates lists all update packages on the upgrade source;

# Yum list installed: list installed packages;

# Yun update kernel upgrade kernel;

Common sources of yum

1) automatically select the fastest source

The speed of some mirror in yum is very slow. if yum chooses this mirror, yum will be very slow at this time. For this reason, you can download the fastestmirror plug-in, it automatically selects the fastest mirror:

# Yum install yum-fastestmirror

Configuration File: (do not change)/etc/yum/pluginconf. d/fastestmirror. conf

Speed Test record file of your yum Image:/var/cache/yum/timedhosts.txt

(2) use the yum

If the yum of the command line is inconvenient, you can use the graphical yumex, which looks more convenient, because you can freely choose the software repository:

# Yum install yumex

Then you can see yum extender in the system tool. In fact, the system's built-in "add/delete programs" can also achieve graphical software installation, but some yumex features it does not.



2. talk about the advanced package management method apt-get in Ubuntu


Configuration file/etc/apt/sources. list


For Server, we recommend that you use aptitude to view, install, and delete the deb package.
Sudo apt-get install aptitude
Then execute sudo aptitude to go to the administrator

You can also run the following command:
Aptitude update updates the list of available packages
Available packages for aptitude upgrade
Aptitude dist-upgrade: upgrade the system to the new release
Aptitude install pkgname installation package
Aptitude remove pkgname Delete Package
Aptitude purge pkgname: delete the package and its configuration file
Aptitude search string search package
Aptitude show pkgname displays the package details
Aptitude clean: delete downloaded package files
Aptitude autoclean only deletes expired package files



Considering the system compatibility, and the above stuff is relatively large, do not find the latest version, directly use apt-get install XXX to install. because our Ubuntu is dailyBulid, the content of the CD is basically the latest, and you do not need to download it again. if you need the latest version, you may wish to update the software repository with apt-get update first, and then use apt-get install.


Common APT command parameters:

Apt-cache search package

Apt-cache show package obtains package information, such as description, size, and version.

Sudo apt-get install package installation package

Sudo apt-get install package--reinstall re-installation package

Sudo apt-get-f install fix and install "-f = -- fix-missing"

Sudo apt-get remove package Delete package

Sudo apt-get remove package--purge delete a package, including deleting a configuration file.

Sudo apt-get update source

Sudo apt-get upgrade updates installed packages

Sudo apt-get dist-upgrade system

Sudo apt-get dselect-upgrade using dselect

Apt-cache depends package for dependency usage

Apt-cache rdepends package is used to check which packages are dependent on this package.

Sudo apt-get build-dep package installation-related compilation environment

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

Sudo apt-get clean & sudo apt-get autoclean clear useless packages

Sudo apt-get check whether any corrupted dependency exists

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.