rpm-4.0.3-1.03 (Red Hat Package Manager)

Type of Packages

RPM Package (Binary)
Extension Description
i386.rpm Intel 80386 or more
i586.rpm Pentium or more
i686.rpm Pentium Pro or more
alpha.rpm Alpha
ppc.rpm Power PC (Power Macintosh)
sparc.rpm SPARC (SUN)
noarch.rpm Doesn't belong to architecture
SRPM Package (Source)
Extension Description
src.rpm Source Package to make binary package
nosrc.rpm A part of source code (not all)

Installing

  1. Installing
    # rpm -ivh foo-1.0-1.i386.rpm
    foo                       ####################################
    
  2. Don't do a dependency check before installing
    # rpm -ivh --nodeps foo-1.0-1.i386.rpm
    
  3. Install the packages even if they replace files from other, already installed, packages.
    # rpm -ivh --replacefiles foo-1.0-1.i386.rpm
    
  4. Install the packages even if some of them are already installed on this system
    # rpm -ivh --replacepkgs foo-1.0-1.i386.rpm
    
  5. Allow an upgrade to replace a newer package with an older one.
    # rpm -ivh --oldpackage foo-1.0-1.i386.rpm
    
  6. Force (Same as using --replacepkgs, --replacefiles, and --oldpackage)
    # rpm -ivh --force foo-1.0-1.i386.rpm
    

Uninstalling

# rpm -e foo

Upgrading

# rpm -Uvh foo-2.0-1.i386.rpm
foo                       ####################################

Freshening

# rpm -Fvh foo-1.2-1.i386.rpm
foo                       ####################################
RPM's freshen option works for single packages or a group of packages. If you have just downloaded a large number of different packages, and you only want to upgrade those packages that are already installed on your system, freshening will do the job. If you use freshening, you will not have to deleting any unwanted packages from the group that you downloaded before using RPM.
# rpm -Fvh *.rpm

Query

  1. Show installed package's information
    # rpm -qi packagename
    # rpm -qip packagename-1.2.rpm
    
  2. Show all installed files
    # rpm -ql packagename
    # rpm -qpl packagename-1.2.rpm
    
  3. Show document file
    # rpm -qd packagename
    # rpm -qpd packagename-1.2.rpm
    
  4. Show configuration file
    # rpm -qc packagename
    # rpm -qpc packagename-1.2.rpm
    
  5. List packages on which this package depends.
    # rpm -qR packagename
    # rpm -qpR packagename-1.2.rpm
    
  6. List the package specific scriptlet(s) that are used as part of the installation and uninstallation processes.
    # rpm -q --scripts packagename
    # rpm -qp --scripts packagename-1.2.rpm
    
  7. Query package owning FILE
    # rpm -qf FILE(full path)
    
  8. Display the states of files in the package. The state of each file is one of normal, not installed, or replaced.
    # rpm -qs packagename
    
  9. Show all installed packages
    # rpm -qa
    
  10. Show all installed packages (order by last installed package)
    # rpm -qa --last
    

Using SRPM

  • Build Binary Package into /usr/src/redhat/RPMS from SRPM (Source Package) file

  • # rpmbuild --rebuild foo-1.2-1.src.rpm
    

    Rebuild package by user

    1. Make /home/hoge/.rpmmacros
      %_topdir /home/hoge/RPM
      %packager hoge <hoge@here>
      
    2. Make directories as below,
      cd
      mkdir RPM
      mkdir RPM/BUILD
      mkdir RPM/RPMS
      mkdir RPM/RPMS/i386
      mkdir RPM/RPMS/i586
      mkdir RPM/RPMS/i686
      mkdir RPM/RPMS/noarch
      mkdir RPM/SPECS
      mkdir RPM/SOURCES
      mkdir RPM/SRPMS 
      
    3. Rebuild

      $ rpmbuild --rebuild /somewhere/hoge-1.0.src.rpm
      
      It expands source file and then compile and make binary RPM file automatically.

    4. Install
      $ su
      # rpm -ihv RPM/i386/hoge-1.0.i386.rpm
      # exit
      

    Install SRPMS and build

    1. If you install SRPMS (src.rpm), it expands source file into top directory.

      $ rpm -ihv hoge-1.0.src.rpm
      
      After this, all sources, patch are placed under SOURCE directory and SPEC file under SPEC directory. What the SPEC file is that a kind of recipe for building RPM file.

    2. Build RPM

      $ rpmbuild -bb RPM/SPECS/foo.spec
      
      Even you don't need to keep spec file under SPEC directory. You can keep original spec file under SPEC directory.

    3. Remove source After building RPM, you can remove source files

      $ rpmbuild -rmsource --rmspec --clean foo.spec
      


    Back
    Google
    Web www.grape-info.com