Usage and difference of yum and apt-get in Linux

Source: Internet
Author: User
In Linux, the usage and difference 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 package, the command to install the rpm Package is rpm... in Linux, the usage and difference 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 "rpm-parameters". 2. the management tool yum 3 supports the tar package Debian Series 1. the common installation package format is deb, the command to install deb package is "dpkg-parameter" 2 package management tool apt-get3 support tar package tar is just a compressed file format, so it just Compress and package the file. 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. --------------------------------*. Install the binary package in rpm format [centos]: rpm-ivh *. rpm uninstall: rpm-e packgename rpm-q nginx check whether the upgrade has been installed: rpm-Uvh xxx query: query all installed packages: rpm-qa query a package: rpm-qa | grep xxxrpm-qi xxx to query the installation path of the software: rpm-ql xxxrpm-qc xxx to query which file is generated by the rpm Package: rpm-qf/etc/yum. confrpm-qpi xxx rpm-qa | grep php check installed RMP package installation: rpm-ivh xxx remove: rpm-e xxx upgrade: rpm-Uvh xxx -------------------------------- src. installation and uninstallation of rpm source code distribution package L Source code distribution of inux 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 by yourself. the advantage of inux is flexible configuration, 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 ,*. src. install the source code package in rpm format: rpm-rebuild *. src. rpm cd/usr/src/dist/RPMS rpm-ivh *. rpm uninstall: rpm-e packgename description: rpm-rebuild *. src. run the rpm command to compile the source code and generate 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 check that the 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 the advanced package management of Redhat yum first. yum install gcc [centos] update: yum update installation: yum install xxx remove: yum remove xxx clear files already installed (/var/cache/yum /): yum clean all search: yum search xxx lists 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 xmllib2 libxml2-devel zlib zlib-devel glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses-devel curl-devel install package YUM-y with yum Command: yum install Run the YUM remove command to delete a software package. Yum-y remove httpd * command: yum search Run the command yum list php * to list all installed software packages. run the command yum list updates to list all installed software packages: yum list installed lists all installed but not in Yum Repository? Que na ?? /Div> command: yum list extras to list the specified software package command: yum list Yum = Yellow dog Updater. The main function of Modified is to conveniently add/delete/update RPM packages. it automatically solves the dependency problem of the package. it is easy to manage a large number of system updates. yum features that you can configure multiple resource libraries (Repository) with simple configuration files (/etc/yum. conf automatically solves the dependency problems encountered when adding or deleting rpm packages. it is convenient to maintain consistency with the RPM Database. yum is installed with CentOS (yum -*. noarch. rpm) # rpm-ivh yum -*. noarch. rpm first needs to import the system's RPM-GPG-KEY before enabling yum for the first time: # rpm -- import/usr/share/doc/centos-release-3 (4)/RPM-GPG-KEY-CentOS-3 (4) yum directive note: when you use the yum or yum resource library for updates 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. update check of the rpm Package: updatable rpm Package # yum check-update all rpm packages # yum update the specified rpm Package, for example, if you update a large-scale version upgrade of kernel and kernel source # yum update kernel-source, which is different from yum update, even the old obsolete package is also upgraded # install and delete the install rpm Package for yum upgrade rpm package, such as the xmms-mp3 # yum install xmms-mp3 to delete the rpm Package, including the dependent package # yum remove licq note: you will be prompted to delete the licq-gnome, licq-qt, licq-text yum temporary storage (/var/cache/yum /) to clear the rpm file # yum clean packages to clear the rpm header file # yum clearn headers to clear the old rpm header file # yum clean oldheaders to clear the old rpm header file and package file # yum clearn or # yum clearn all note: equivalent to yum clean packages + yum clean oldheaders The Package list lists all the rpm packages that can be installed or updated in the resource library # yum list lists the specific rpm packages that can be installed, updated, and installed in the resource library # yum list mozilla # yum list mozilla * Note: you can use a match character in the rpm Package name, for example, listing all rpm packages starting with mozilla lists all the rpm packages that can be updated in the resource library # yum list updates lists all installed rpm packages # yum list installed lists installed but not rpm package contained in the resource library # yum list extras note: download and install the rpm package information on other websites (the info parameter is the same as the list) list information about all rpm packages that can be installed or updated in the resource library # yum info lists information about specific rpm packages that can be installed or updated and installed in the resource library # yum info mozilla # yum info mozilla * Note: you can use a match character in the rpm Package name, for example, 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 list the rpm packages installed but not included in the resource library # yum info extras note: search for rpm packages matching specific characters by downloading and installing the rpm packages from other websites # yum search mozilla note: in the rpm Package name, search for rpm packages with specific file names in the package description and other searches # yum provides realplay adds a resource library for example: add rpm.livna.org as the resource library to 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 the Key, use # rpm-e gpg-pubkey-a109b1ec-3f6e28d5) common yum commands # yum install xxx software # yum info xxx view xxx software information # yum remove xxx delete software package # yum list software package # yum clean clear buffer and just package # yum provides xxx search package with xxx as the keyword (the provided information is the keyword) # yum search xxx search package (with the name as the keyword) # yum groupupdate xxx # yum grouplist xxx # yum groupremove xxx are all upgraded in one group. List and delete operations. For example, "Mysql Database" is a group that will operate on all related software packages at the same time; # yum update system upgrade # yum list available list all packages on the upgrade source; # yum list updates lists update packages on all upgrade sources; # yum list installed lists installed packages; # yun update kernel upgrade; common yum sources (1) automatic selection of the fastest source because 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: (generally do not need to change)/etc/yum/pluginconf. d/fastestmirror. conf:/var/ Cache/yum/timedhosts.txt (2) use the yum of the graphic interface. if you think the yum of the command line is inconvenient, you can use the graphical yumex. this looks more convenient, because you can freely select the software repository: # yum install yumex and 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. The following describes the advanced package management method apt-get configuration file/etc/apt/sources in Ubuntu. for the list Server version, we recommend that you use aptitude to view it. install and delete the deb package sudo apt-get install aptitude, and then run the sudo aptitude command to enter the administrator. you can also run the following command: aptitude update available Package List aptitude upgrade available package aptitude dist-upgrade the system to the new release version aptitude install pkgname installation package aptitude remove pkgname delete package aptitude purge pkgname delete pack configuration file aptitude search string search package aptitude show pkgname display package details aptitude clean delete downloaded package file aptitude autoclean only delete expired package files considering system compatibility, in addition, all the above items are relatively large. if you do not find the latest version, you can directly install it using apt-get install XXX. 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 to obtain package information, for example, sudo apt-get install package installation package sudo apt-get install package--reinstall re-installation package sudo apt-get-f install fix installation "-f = -- fix -missing "sudo apt-get remove package delete package sudo apt-get remove package-purge Delete package, including deleting configuration files and other sudo apt-get update sources sudo apt-get upgrade update installed packages sudo apt-get dist-upgrade system sudo apt-get dselect-upgrade use dselect upgrade apt-cache depends package to learn how to use apt-cache rdepends package to check which packages of the package depend on sudo apt-get build-dep package to download apt-get source package the source code sudo apt-get clean & sudo apt-get autoclean of this package cleans up useless packages sudo apt-get check to check for any corrupted dependencies
 
Related Article

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.