RPM, Urpmi & Yum commands

RPM

  • List all installed packages:
    rpm -qa
    
  • Get the list of all installed packages and their architecture:
    rpm -qa --queryformat "%-40{NAME} %-8{ARCH}\n"
    
  • Same as above, but show i586 packages only:
    rpm -qa --queryformat "%-40{NAME} %-8{ARCH}\n" | grep i586
    
  • Downgrade a package to an old version:
    wget ftp://ftp.repository.org/mandrakelinux/official/10.0/package-1.0-1mdk.i586.rpm
    rpm -Uvh --oldpackage package-1.0-1mdk.i586.rpm
    
  • Unpack/Deflate/Extract a RPM without installing it:
    rpm2cpio dummy.src.rpm | cpio -id
    
  • Evaluate %mkrel 3 rpm macro:
    rpm --eval '%mkrel 3'
    
  • Force removal of a package that has problems with embedded “pre-” and/or “post-” scripts:
    rpm -e --noscripts packagename
    

Urpmi

  • List all available packages with name containing python:
    urpmq --fuzzy python
    
  • Find which RPM contain the file named dummy:
    urpmf dummy
    
  • Get informations about the dummy RPM:
    urpmq -i dummy
    
  • Get the list of all RPMs that require python-psyco package:
    urpmf --requires python-psyco
    
  • Get the list of all RPMs that provide python-psyco package:
    urpmf --provides python-psyco
    
  • I use this command in a cron entry to update automatically and regularly my Mandriva:
    /usr/sbin/urpmi.update -a && /usr/sbin/urpmi --update --auto --auto-select
    
  • Generate urpmi repository index and metadata of the current folder:
    genhdlist ./
    
  • APT/URPMI commands list

Yum

  • Install a new package:
    yum install subversion
    
  • Search for packages containing the x11 string:
    yum search x11
    
  • Get the list of packages that provide Python’s Subversion bindings:
    yum provides "*/svn/__init__.py"
    
  • Update repository index:
    yum update
    
  • Clear all caches (sometimes required to force a repository index update):
    yum clean all
    
  • Generate Yum repository index and metadata of the current folder:
    createrepo -v ./
    

2 thoughts on “RPM, Urpmi & Yum commands

  1. Pingback: Useful Commands: a Synthesis | Kevin Deldycke

  2. Pingback: All my command lines | Kevin Deldycke

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>