rpm yum使用笔记

rpm/yum note

-v0.1 2017.12.7 Sherlock
-v0.2 2017.12.18 Sherlock add how to download source code
-v0.3 2018. 4.22 Sherlock add rpm download

rpm

  1. install a rpm package: rpm -ivh *.rpm

  2. query something:

    rpm -q kernel –> query a package name kernel.

    rpm -qf file –> query a file to find which package it belogs to
    so we can use this to find the package of one shell
    command, like: rpm -qf /usr/sbin/lspci, it will get:
    pciutils-3.5.1-2.el7.aarch64.

    rpm -ql package -> list all files in this package.

    rpm -qa –> query all installed package in system.

    rpm -qi package -> list related info of this package.

    rpm -qc package -> find config file of this package, e.g.
    rpm -qc openssh-clients-xxxx, will get
    /etc/ssh/ssh_config.

    rpm -qd package -> find related document.

    rpm -qR package -> find related required libs.

yum

   yum search kernel      --> search in yum datebase.

   yum provides software  --> find which package contains this software in
                              yum database. similar with rpm -qf file, but
                              rpm searchs packages locally.
                              yum provides fio, we will get:

   yum info package       --> show information of one package
                  e.g. yum info kernel will show all kernel
                   packages with different versions

   yum list               --> list all packages in related yum repo.

rpmbuild

1. from source to build rpm package

    ...

P.S. For linux kernel, you can directly run: "make rpm" to do so,
     it will create kernel/kernel-dev/kernel-header rpm packages.

2. downlaod a rpm, modify it, and re-build a new rpm package

    ...

download rpm

This document shares the way to download rpm package using yum tools:
https://www.ostechnix.com/download-rpm-package-dependencies-centos/

"yum install --downloadonly" will also install package.

"yumdownloader" just downloads the package.

download source

   1. yum install yum-utils

      /* should be the name of package, just showed when yum search XXX */
   2. yumdownloader --source xorg-x11-drv-ati

   3. yum install mock
      useradd -s /sbin/nologin mockbuild

   4. rpm -hiv xorg-x11-drv-ati-7.7.1-3.20160928git3fc839ff.el7.src.rpm
      it will create ~/rpmbuild/SOURCE and install above package there.

   5. cd /root/rpmbuild/SOURCES

   6. xz -d *
      tar -xf *

猜你喜欢

转载自blog.csdn.net/scarecrow_byr/article/details/80085974