Usage and difference of Yum and Apt-get in Linux

Source: Internet
Author: User
Tags gpg

Usage and difference of Yum and Apt-get in Linux

  Generally famous Linux systems are basically divided into two main categories:  1.redhat series: Redhat, Centos, Fedora  2.debian series: Debian, Ubuntu and other  redhat Series  1 common installation package format RPM package, the command to install RPM package is "rpm-parameters"  2 Package management tool &NBSP;YUM&NBSP;3 Support TAR package   debian Series 1 common installation package format Deb Package, The command to install the Deb package is the "dpkg-parameters" 2 package management tool APT-GET3 support for the TAR package  tar is just a compressed file format, so it just packages the file compression. RPM is the equivalent of an installation file in Windows that automatically handles dependencies between packages.   Advantages and disadvantages, RPM is generally pre-compiled files, it 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's universal.   If your package doesn't want to open the source code, you can make it into RPM, and if it's open source, it's easier to use tar.  tar are generally packaged software, need to unpack their own, and then install the trilogy,./configure, make, do install. To install the software. &NBSP;RPM is a software package management mechanism of Redhat company, which can be installed and deleted directly through the RPM command, and the biggest advantage is that it automatically handles the possible dependencies of various packages within itself.   --------------------------------*.rpm form of binary package [centos]  installation: Rpm-ivh *.rpm  Uninstall: rpm-e packgename       RPM-Q nginx   See if you have installed      Upgrade: RPM-UVH xxx  query:  Query all installed packages: Rpm-qa query a package: RPM-QA | grep xxxrpm-qi XXX Query Software Installation path: RPM-QL xxxrpm-qc xxx Query A file is that RPM package generated: RPM-QF/ETC/YUM.CONFRPM-QPI xxx rpm-qa|grep phP   View installed RMP packages   installation: RPM-IVH XXX removal: rpm-e XXX Upgrade: RPM-UVH xxx  -------------------------------- SRC.RPM Source code distribution package installation and uninstallation   Linux software source code distribution is to provide the software all the program source of the release form, the user needs to compile their own executable binary code and installation, the advantage is flexible configuration, can be arbitrarily removed or retained some features/modules , adapt to a variety of hardware/operating system platform and compilation environment, the disadvantage is more difficult, generally not suitable for beginners to use.   1, *.src.rpm form of source code package   Installation: Rpm-rebuild *.src.rpm  cd/usr/src/dist/rpms  rpm-ivh *.rpm  Uninstall : rpm-e packgename  Description: Rpm–rebuild *.src.rpm command compiles the source code and generates a binary RPM package under/usr/src/dist/rpms before installing the binary package. Packgename as mentioned earlier.  --------------------------------dpkg "Ubuntu"  dpkg-l | grep ' php '   use DPKG-L to see which software is already installed  dpkg is a shorthand for debian[. A suite management system specifically developed for Debian to facilitate the installation, updating 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 <package.deb> Install a Debian package, such as files you have manually downloaded.  2, dpkg-c <package.deb> list <package.deb> content.  3, Dpkg-i <package.deb> extract package information from <package.deb>.  4. Dpkg-r <package> Remove an installed package. 5. Dpkg-p <package> CompleteClears a package that has already been installed.  Unlike remove, remove just deletes the data and executable files, and purge also removes all the configuration files. 6, Dpkg-l <package> List of all files <package> installed.  Also see Dpkg-c to check the contents of a. deb file. 7. Dpkg-s <package> Displays information about installed packages.  Also see Apt-cache displays the package information in the Debian archive, as well as dpkg-i to display the package information extracted from a. deb file. 8. Dpkg-reconfigure <package> re-prepare an already installed package if it is using debconf (debconf provides a unified configuration interface for package installation). --------------------------------use Yum and Apt-get. Upgrade of software management methods. The  yum configuration file is/etc/yum.conf 1. Let's start with the Redhat Yum's advanced package management.  yum Install GCC  [centos]  update: Yum update installation: Yum install xxx Remove: Yum remove XXX clear files that have already been installed (/var/cache/yum/): Yum clean all search: Yum search xxx Lists all archives: Yum List query Archive 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 li BXML2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel Curl curl- devel  installing packages with yum yum-y <package_name> commands: Yum install <package_name>  Remove package with yum command: Yum remove <package_name> yum-y Remove httpd*     command: Yum Search < keyword>  List all installable package commands: Yum List yum list php*  lists all updatable package commands: Yum list updates  List all installed packages commands: Yum list installed  lists all packages installed but not within Yum Repository commands: Yum list extras  lists the specified package commands: Yum List < Package_name> yum = Yellow Dog Updater, the main function of modified is more convenient to add/remove/update RPM packages. It can automatically solve the dependency problem of the package. It is easy to manage the update problems of a large number of systems   Yum features multiple repository (Repository) Concise profiles can be configured at the same time (/etc/yum.conf automatically resolves dependency issues encountered when adding or removing RPM packages easy to maintain consistency with RPM database  yum install CentOS self-bring ( yum-*.noarch.rpm) #rpm-IVH yum-*.noarch.rpm first need to import the system's Rpm-gpg-key before first enabling Yum: #rpm--import/usr/share/doc/ Centos-release-3 (4)/rpm-gpg-key-centos-3 (4)  yum Directive Note: When the first use of Yum or Yum repositories is updated, Yum automatically downloads all required headers placed in/var/cache /yum directory, the required time may be longer. Update check for &NBSP;RPM package update RPM package #yum check-update Update all RPM packages #yum update the specified RPM package, such as update kernel and kernel source# Yum Update kernel Kernel-source A large-scale version upgrade, unlike Yum Update, even the old obsolete package also upgrades #yum upgrade rpm package installation and removal of installation RPM packages, such as Xmms-mp3#yum InchStall Xmms-mp3 Remove the RPM package, including a dependency on the package #yum remove LICQ Note: Also prompts to delete Licq-gnome,licq-qt,licq-text yum staging (/var/cache/yum/) Related parameters purge staging in rpm package file #yum Clean Packages purge Staging rpm header file #yum Clearn headers clear staging of old rpm header file #yum clean oldheaders purge old rpm header files and package files in staged storage #yum Clearn or #yum clearn all note: the equivalent of the Yum clean packages + Yum Clean oldheaders  Package list lists all the RPM packages that can be installed or updated in the resource pool #yum list lists the specific can install or update and already installed RPM package #yum list Mozilla#yum list mozilla* Note: You can use a match in the RPM package name, such as listing all RPM packages starting with Mozilla to list all the RPM packages that can be updated in the repository #yum List updates lists all RPM packages that have been installed #yum list installed lists the RPM packages that have been installed but are not included in the Repository #yum list Extras Note: Download the RPM Package &NBSP;RPM package information display from other websites ( Info parameter with list) lists all the RPM packages that can be installed or updated in the repository #yum info lists the specific information in the repository that can be installed or updated and the RPM packages that have been installed #yum Info Mozilla#yum Info mozilla* Note: You can use a match in the RPM package name, such as listing all the RPM packages that start with Mozilla to list all the RPM packages that can be updated in the repository #yum info updates lists all the RPM packages that have been installed #yum info Installed lists information about RPM packages that have been installed but are not included in the repository #yum info Extras Note: Download the information for the installed RPM package from other websites   search RPM package search RPM package matching specific characters #yum search Mozilla Note: Search in RPM Package name, package description, etc. to search for RPM packages with a specific file name #yum provides realplay  add a resource library for example: Add rpm.livna.org as repository installation 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-PUBK EY-A109B1EC-3F6E28D5 (Note: If you want to remove key, use #rpm-e gpg-pubkey-a109b1ec-3f6e28d5)  yum common commands  # yum install xxx   & nbsp         install XXX software  # yum info xxx                 View XXX software information &N bsp;# yum Remove xxx         Delete package  # Yum list               &NB Sp         list packages  # Yum clean                     purge slow Rushed and on the package  # yum provides xxx         search package with XXX keyword (provided information for keywords)  # yum search xxx           Search package (by name keyword)  # yum groupupdate xxx # yum grouplist xxx # Yum Groupremove xxx  These three are a set of Unit to upgrade the list and delete the action. For example, "Mysql Database" is a group that will operate all related packages simultaneously;  # Yum update                 system upgrade   # YuM list available         list the packages on all upgrade sources;  # Yum list updates         List all updates available on the upgrade source ;  # Yum List installed         list installed packages,  # Yun update kernel       update kernel; &nbsp Yum Common source   (1) automatically selects the fastest source   because Yum has mirror speed is very slow, if Yum chooses this mirror, this time Yum will be very slow, in this case, can download Fastestmirror plugin, It automatically selects the fastest mirror:  #yum install yum-fastestmirror  profile: (generally not moving)/etc/yum/pluginconf.d/fastestmirror.conf   Your yum image Speed test log file:/var/cache/yum/timedhosts.txt  (2) using the graphical interface of the yum  if you feel that the command line Yum is not convenient, then you can use the graphical Yumex, This looks more convenient because you are free to choose a software warehouse:  #yum install yumex  and then you can see Yum extender in the system tools. In fact, the system comes with the "Add/Remove Programs" can also achieve graphical software installation, but some Yumex features it does not.   The following describes the advanced package management methods in Ubuntu apt-get  profile/etc/apt/sources.list  for the server Edition, we recommend using aptitude to view, install, remove the Deb package sudo Apt-get install aptitude then execute sudo aptitude into admin   can also use the command: Aptitude update update available packages list aptitude Upgrade upgrade available Packages aptitude dis T-upgrade upgrade the system to a new release aptitude install Pkgname installation package aptitude Remove Pkgname DeleteIn addition to package aptitude purge Pkgname Delete package and its configuration file aptitude search string Search Package aptitude show Pkgname Show package details aptitude Clean Delete downloaded package file aptitude AutoClean only Delete expired package files   Consider the compatibility of the system, and the above are large, do not find the latest version, directly installed with Apt-get install XXX. Because our Ubuntu is dailybulid, So the content of the disc is basically up-to-date and does not need to be re-downloaded. Be sure to update your software's repository with the latest version, and then apt-get install.  Common apt command parameters:  apt-get Apt-cache Search Packages  apt-cache Show package information about packages, such as description, size, version  sudo apt-get install package   sudo apt-get Install package--Reinstall Reinstall Packages  sudo Apt-get-f installs repair installation "-F =--fix-missing"  sudo Apt-get R Emove Package Remove Packages  sudo apt-get Remove Package-purge Delete packages, including delete configuration files  sudo apt-get update source  sudo apt-get Upgrade update installed packages  sudo apt-get Dist-upgrade upgrade system  sudo Apt-get dselect-upgrade use Dselect upgrade  apt-cache Depends package understands the build environment that relies on  apt-cache rdepends packages to see which packages are dependent on  sudo apt-get BUILD-DEP pack installation   Apt-get Source package Download source code  sudo apt-get clean && sUdo Apt-get AutoClean cleans up useless packages  sudo Apt-get Check to see if there is a corrupted dependency

Usage and difference of Yum and Apt-get in Linux

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.