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, 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 <package. deb>
Install a Debian software package, such as the file you manually download.
2. dpkg-c <package. deb>
List the contents of <package. deb>.
3. dpkg-I <package. deb>
Extract package information from <package. deb>.
4. dpkg-r <package>
Remove an installed package.
5. dpkg-P <package>
Completely clear an installed package. Unlike remove, remove only deletes data and executable files, and purge also deletes all preparation files.
6. dpkg-L <package>
List all the files installed in <package>. Check the content of A. deb file by checking dpkg-c.
7. dpkg-s <package>
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 <package>
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 <package_name>
Command: yum install <package_name>

Use YUM to delete a software package
Command: yum remove <package_name>

Yum-y remove httpd *


Command: yum search <keyword>

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 packages installed but not in Yum Repository
Command: yum list extras

List the specified software packages
Command: yum list <package_name>

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.