Linux RPM, YUM

Source: Internet
Author: User
Tags gpg rpmbuild

  1. two major mainstream of Linux: RPM and DPKG
    • distribution delegate software management mechanism online upgrade mechanism (Directive)
      red hat/fedora rpm rpm, Rpmbuild yum (y UM)
      debian/ubuntu dpkg  dpkg apt (apt-get)

  2. rpm and srpm
    1. rpm is a set of management mechanisms for installing the software you need into your Linux system in a database record.
      1. Advantage:
        1. because it has been compiled and packaged, so the software transmission and installation is very convenient (no need to recompile);
        2. because the software information is already recorded on the Linux host database, it is Easy to query, upgrade, and reverse install
      2. issues:
        1. The installation environment of the software files must be consistent or equivalent to the environmental requirements of the packaging;
        2. needs to meet the dependency property requirements of the software; /li>
        3.   Anti-installation requires special care, the lowest software can not be removed first, otherwise it may cause the whole system problem! The software content provided by
    2. SRPM (Source RPM) is "not compiled" and he provides the original code. Usually the SRPM extension is named in the format ***.src.rpm. The
      1. first compiles the software in RPM management, at which point the SRPM is compiled into an RPM file;
      2. then installs the completed RPM file into the Linux system
  3. What is i386, i586, i686, Noarch, x86_64
    1. rp-pppoe-3.1-5.i386.rpm----The meaning of the file
      1. rp-pppoe- 3.1-  5 .i386 .rpm
        software name soft Version information applicable platform extension

         

  4. RPM is a way to install it by pre-compiling and packaging it into the RPM file format, and can also be documented in the database. So RPM has the following advantages:
    1. RPM contains compiled programs and configuration files and other data, can let users exempt from the problem of recompilation;
    2. RPM before being installed, will check the system's hard disk capacity, operating system version, etc., can avoid the wrong installation of files;
    3. The RPM file itself provides information such as software version information, dependency property software name, software usage description, and files contained in the software for easy understanding of the software;
    4. The RPM management method uses the database to record the relevant parameters of the RPM file, which facilitates the upgrade, removal, query and verification.
  5. RPM Software Management Program: RPM
    1. Information related to software installed by RPM will be written to the database file in the/var/lib/rpm/directory
    2. RPM Installation (install)
      1. RPM-IVH package_name
        1. The meaning of-i:install
        2. -V: View more detailed installation Information screen
        3. -H: Displays the installation progress in the installation information column
    3. RPM Upgrades and updates (Upgrade/freshen)
      1. RPM-[UF]VH Package_name
        1. -UVH: After the software is not installed, the system will be installed directly, if the following software has been installed older version, the system automatically updated to the new version;
        2. -FVH: If the next software is not installed on your Linux system, the software will not be installed, i.e. only the software installed in your Linux system is "upgraded"!
    4. RPM Queries (query)
      1. RPM-QA <== installed software
      2. RPM-Q[LICDR] Installed software name <== installed software
      3. RPM-QF exists in a file name above the system <== installed software
      4. RPM-QP[LICDR] A file name that is not installed <== read the rpm file
        1. To query information about installed software:
        2. -Q: Only query, followed by the software name is installed;
        3. -QA: Lists all the software names that have been installed on the native Linux system;
        4. -qi: List details of the software (information), including the developer, version and description;
        5. -QL: Lists the full file name (list) of all files and directories for the software;
        6. -QC: Lists all the configuration files for the software (find the file name under/etc/)
        7. -QD: List all documentation for the software (find files related to man)
        8. -QR: Lists the files contained in the dependent software associated with the software (Required meaning)
        9. -QF: The name of the file followed by, find out which of the files are installed software;
        10. Query for information contained in an RPM file:
        11. QP[ICDLR]: Note that all parameters followed by-QP are consistent with the instructions above. But the only use is to find the information in an RPM file, not the installed software information! Attention!
    5. RPM Verification and Digital signatures (verify/signature)
      1. The way to do this is to "use the database content under/var/lib/rpm to compare to all software files in the current Linux system environment" that is, when you have lost data accidentally, or because you have accidentally killed a software file, or accidentally do not know the changes to a certain software file content, Just use this simple method to verify the original file system!
      2. Rpm-va
      3. Rpm-v installed software name
      4. RPM-VP the file name of an RPM file
      5. RPM-VF a file on the system.
        1. -V: The software name is added later, if the file contained in the software has been changed, it will be listed;
        2. -va: Lists all the files that may have been changed in the current system;
        3. -VP: A filename is appended to the file, which lists the files that may have been altered in the software;
        4. -VF: List If a file has been altered
      6. example: [[email protected] ~]# rpm-vf/etc/crontab
        1. ... 5....T C/etc/crontab
        2. Previous eight letter output description:
          1. S: (file size differs) the size of the file is changed
          2. M: (Mode dif FERS) is the file type or the file's attribute (RWX) changed? If an executable parameter has been changed
          3. 5: (MD5 sum differs) MD5 the content of this kind of fingerprint code is different
          4. 5: (MD5 sum differs) MD5 the content of this kind of fingerprint code is different
          5. L: (Readlink (2) path Mis-match) The Link path has been changed
          6. U: (User ownership differs) The owner of the file has been changed
          7. G: Group ownership differs file has been changed
          8. T: (mTime differs) file setup time has been changed
        3. nineth Field Description:
          1. C: Profile (config file)
          2. d: File data file (documentation)
          3. g: Ghost file ~ Usually the file is not used by a software Included, less happens! (Ghost file)
          4. L: License files (license file)
          5. r: Readme file (Read me)
    6. Digital signature (digitally signature)
      1. When you want to install an RPM file:
        1. First you must first install the original release of the public key files;
        2. In the actual installation of the original RPM software, RPM instruction will read the information of the RPM file, and the signature information in the local system,
        3. If the seal is the same, it will be installed, if the relevant seal information is not found, then give a warning and stop the installation OH.
      2. Installation of the original release of GPG digital signature public key file
        1. Locate Gpg-key or find/etc-name ' *gpg-key* '--------find
        2. RPM--IMPORT/ETC/PKI/RPM-GPG/RPM-GPG-KEY-CENTOS-5---------Installation
    7. RPM anti-install and rebuild database (ERASE/REBUILDDB)
      1. RPM-E package_name------Remove a software
      2. RPM--REBUILDDB------<== Rebuild Database
  6. Use of SRPM: Rpmbuild
    1. Install SRPM Archives with default values (--rebuid/--recompile)
      1. Rpmbuild [--rebuild--recompile] srpm bag
        1. --rebuild: "Compile" and "pack" the action, the end will produce the RPM file.
        2. --recompile: "Compile" "Package" and "Install"
    2. SRPM use the path with the required software-----need to install RPM-BUILD-4.2-0.69.I386.RPM package-------806
    3. Package your own RPM software------------811
  7. Query, install, upgrade and remove features with Yum
    1. Yum [option] [query work item] [Related parameters] option
      1. [option]: The main options include:
        1. -y: This option automatically provides a yes response when Yum waits for user input;
        2. --installroot=/some/path: Install the software in/some/path without using the default path
      2. [Query Work Items] [Related parameters]: parameters In this regard are:
        1. Search: Searches for a software name or a description (description) of important keywords;
        2. List: Lists all the software names and versions currently managed by Yum, somewhat similar to RPM-QA;
        3. Info: ditto, but somewhat similar to Rpm-qai's execution results;
        4. Provides: Follow the file to search for software! Similar to RPM-QF features!
      3. List what software is currently available on the server for native upgrade?
        1. [email protected] ~]# Yum list updates
    2. Install/Upgrade features: Yum [install|update] Software
      1. Yum [option] [Query work items] [related parameters]
        1. Install: Follow the software to be installed!
        2. Update: Next to the software to upgrade, to upgrade the entire system, you can directly update
    3. Removal function: Yum [remove] Software
      1. Yum Remove Pam-devel
    4. Yum configuration file
      1. Vi/etc/yum.repos.d/centos-base.repo
      2. Content Description:
        1. [Base]: Represents the name of the container! Must exist in the scratch number, the name of the inside can be taken arbitrarily. But you cannot have two identical container names, or Yum will not know where to find the container-related software list file.
        2. Name: Just explain the meaning of this container, the importance is not high!
        3. mirrorlist=: Lists the mapping platform that this container can use, and if you do not want to use it, you can annotate it to this line;
        4. Baseurl=: This is the most important, because the actual URL of the container is followed! Mirrorlist is by the Yum program to capture the image platform, BaseURL is designated a fixed container URL! When you are looking for the URL of the container, the most important thing is that there must be a directory named Repodata under the URL.
        5. Enable=1: Just let this container be started. If you do not want to start can use Enable=0 Oh!
        6. Gpgcheck=1: Do you remember the digital signature of RPM? This is to specify whether you need to check the digital signature in the RPM file!
        7. Gpgkey=: is the digital signature of the public key file location! Use the default values to
  8. The problem of modifying container and the way to solve it
    1. Yum Clean [Packages|headers|all]
      1. Packages: Delete downloaded software files
      2. Headers: Delete the downloaded software file header
      3. All: Delete all container data!
  9. Yum's software group capabilities
    1. Yum [group function] [software group]
      1. Grouplist: List all available "suite groups", such as development Tools;
      2. Groupinstall: This works! Can install a whole set of suite groups, pretty good use!
      3. Groupremove: Removing a suite group;
  10. System-wide automatic upgrades
    1. Vim/etc/crontab
    2. 0 3 * * * root/usr/bin/yum-y update

rpm common options and parameter descriptions for installation

Options available for release Representative meaning
--nodeps

Time to use: When a software attribute dependency problem occurs that cannot be installed, but you are determined to install it

Risk: The software will have dependencies because each other will use the other's mechanism or function, if forced to install regardless of the nature of the software dependencies, it may cause the software can not be used properly!

--replacefiles

Use time: If there is a "file already installed on your system" in the process of the installation of the information, and perhaps the version of the message (confilcting files), you can use this parameter to directly overwrite the file.

Danger: The covered action cannot be undone! So, you have to be very clear to know that the overwritten file is really can be overwritten Oh! Otherwise you will cry without tears!

--replacepkgs Use time: Reinstall a software that has already been installed! If you want to install a bunch of RPM software files, you can use rpm-ivh*.rpm, but if some software has been installed, the system will appear "a software has been installed" information, resulting in the inability to continue the installation. You can use this option to repeat the installation now!
--force Use time: This parameter is actually--replacefiles and--replacepkgs complex!
--test

Use time: To test whether the software can be installed in the user's Linux environment, you can find out whether there is a problem with attribute dependencies.

Examples are: RPM-IVH pkgname.i386.rpm--test

--justdb Timing: This option can be used to update information about the software in the database when the RPM database is damaged or if there is some reason for error.
--nosignature Use time: This option is available when you want to bypass the digital signature check.
--prefix New Path Use time: When you want to install software into other informal catalogs. For example, if you want to install a software into a/usr/local rather than a regular/bin, etc directory, you can use "--prefix/usr/local" to handle it.
--noscripts

Use time: You do not want the software to perform some system instructions on its own during the installation process.

Description: The advantages of RPM in addition to the ability to place files in the location, but also automatically perform some pre-job instructions, such as the initialization of the database. If you don't want RPM to help you automate this type of instruction, add him!

Linux RPM, YUM

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.