Rpm package management

Package and Package Manager

  • The package consists of:
    二进制文件、库文件、配置文件、帮助文件 
  • Package Manager:
      Debian: deb file, dpkg package manager
      redhat: rpm file, rpm package manager
      RPM: Redhat Package Penalty for Manager
           RPM Package Penalty for Manager

Package naming and tools

  • Package: Classification and unpacking
  • Between the package: possible dependencies, even circular dependencies
  • Resolving dependencies package management tools
    yum: rpm package manager of the tool
    apt: deb Package Manager tool bit
    zypper: rpm on a front end management tool SUSE
    DNF: Fedora 18+ RPM Package Manager front-end management tool

Source packages

rpm

是RPM软件包的管理工具。rpm原本是Red Hat Linux发行版专门用来管理Linux各项套件的程序,由于它遵循GPL规则且功能强大方便,因而广受欢迎。逐渐受到其他发行版的采用。RPM套件管理方式的出现,让Linux易于安装,升级,间接提升了Linux的适用度

Command Options

  • -a: Query All kits;
  • -b <completion stage> <profile Kits> or + -t <completion stage> <Kits file> +: Set kit packaging stage of completion, and specify the file name of the package file;
  • -c: list only configuration profiles, this parameter must comply with the "-l" parameter;
  • -d: list only a text file, this parameter must comply with the "-l" parameter;
  • -e <package file> or --erase <package file>: Deletes the specified package;
  • -f <file> +: Query suite has a specified file;
  • -h or --hash: List mark installation kit;
  • -i: Display information kit;
  • -i <package file> or --install <package file>: Specifies the installation package file;
  • -l: displays a list of files kits;
  • -p <package file> +: Query RPM kit specified file;
  • -q: Use inquiry mode, when faced with any problem, rpm command will first ask the user;
  • -R: the display-related information kit;
  • -s: display file status, parameters to be present with the "-l" parameter;
  • -U <package file> or --upgrade <package file>: Upgrade kit specified file;
  • -v: display process execution instruction;
  • -vv: detailed display process execution instruction, to facilitate troubleshooting.

Query package

rpm -K | checksig rpmfile: integrity and packet signature inspection

Database reconstruction: / var / lib / rpm

Example:

  1. Rpm package installed

    rpm -ivh your-package.rpm
    where your-package.rpm is the file name you want to install the rpm package, generally placed in the current directory.
    The following symptoms or warning prompted the installation process:
    ... Conflict with ...
    probably want to install package contains some files may overwrite existing files. By default, this case is not installed correctly can with rpm --force -i force the installation to
    ... iS needed by ...
    ... iS not installed ...
    you can use rpm --nodeps -i to ignore some of the software you need this package is not installed Note: this information, which means rpm -i --force --nodeps can ignore all dependencies and documentation issues, what the package can be installed on, but the mandatory installation package can not guarantee full function

  2. How to install packages .src.rpm
    end is .src.rpm some packages, these packages are included source code rpm package, it needs to be compiled during installation. Such packages There are two installation methods:

    • Method One:
      RPM -i your-package.src.rpm
      cd / usr / src / RedHat / SPECS
      rpmbuild-package.specs # -bp your specs and a file of the same name of your package
      cd / usr / src / redhat / BUILD / your-package / # a package of the same name and your directory
      ./configure # this step and compile common source software like, you can add parameters
      the make
      the make install
    • Method Two:
      RPM -i you-package.src.rpm cd / usr / src / RedHat / SPECS
      first two steps and a method same
      rpmbuild -bb your-package.specs # file your specs and a package of the same name
      at this time in / usr / src / redhat / RPM / i386 / ( depending on the different packages, it could be i686, noarch, etc.) in this directory, there is a new rpm package, this is the compiled binaries
      execute rpm - i new-package.rpm can be installed

3. How to uninstall the rpm package

Use the command rpm -e package name, package name can contain information such as the version number, but may not have the suffix .rpm, such as uninstallation package proftpd-1.2.8-1,

  • You can use the following format
    RPM ProFTPD -e-1.2.8-1
    RPM -e ProFTPD-1.2.8
    RPM -e proftpd-
    RPM -e ProFTPD
  • Malformed
    -e proftpd-1.2.8-1.i386.rpm RPM
    RPM -e proftpd-1.2.8-1.i386
    RPM -e proftpd-1.2
    RPM -e proftpd-1
    and sometimes there will be some errors or warnings
    ... is needed by ...
    description of the software with other software is required, not just unload, you can use rpm -e --nodeps forced to unload

4. How to get the file but does not install rpm package

Use tools rpm2cpio and cpio

  • rpm2cpio xxx.rpm | cpio -vi
  • rpm2cpio xxx.rpm | cpio -idmv
  • rpm2cpio xxx.rpm | cpio --extract --make-directories
    the same parameters i and extract, extract file indicates. v is instructed to perform the process, d, and the same make-directory, create directory represents the path of the package according to the original file, m represents the update time of the file holder

5. How to view documents and other information related to the rpm package
all of the following examples assume that using a software package mysql-3.23.54a-11

  • (1) My system is installed rpm package that lists all installed packages
    rpm -qa
    If you want to find a string sql package contains all of the installed
    rpm -qa | grep sql
  • File (2) how to get a package full name of the
    rpm -q mysql
    can get the system installed mysql package full name, where you can get the current version of the package and other information. This example can obtain the information mysql-3.23.54a-11
  • (3) to see a rpm package files are installed to go there
    rpm -ql package name
    note here is the name of the package does not include the .rpm suffix, that can only use mysql or mysql-3.23.54a-11 instead of mysql-3.23.54a-11.rpm. If you just want to know where to put the executable program can also be used which, for example:
    Which MySQL
  • (4) see a rpm package contains those files
    package to see not had installed
    rpm -qlp ****. Rpm
    see packages already installed
    rpm -ql ****. Rpm
  • (5) for information about a package version, use and other related information
    see the package had not installed the
    rpm -qip ****. Rpm
    see packages already installed
    rpm -qi ****. Rpm
  • (6) a program to see which package is installed, or which package contains this program
    RPM -qfwhich 程序名    # return the package's full name
    RPM -qifwhich 程序名    # return information for packages
    RPM -qlfwhich 程序名   # Returns the file package list
    Note: this is not a quote, but `can also use rpm -qilf, while the output of the package and list information file
  • (7) to see which package a file is installed, or which package contains the file
    noted that the method of the previous question applies only to the executable program, and the following method, not only for executable programs It can also be used for any ordinary file. Provided that know the file name. This program first obtain the full path, you can use whereis or which, then use rpm -qf

    E.g:

    whereis ftptop
    ftptop: /usr/bin/ftptop /usr/share/man/man1/ftptop.1.gz

  • rpm -qf /usr/bin/ftptop
    proftpd-1.2.8-1

  • rpm -qf /usr/share/doc/proftpd-1.2.8/rfc/rfc0959.txt
    proftpd-1.2.8-1

Guess you like

Origin blog.51cto.com/14234291/2443751