Linux Package Managers

So many different ways of doing the same thing, with tricky aspects to boot. Here are some notes regarding package managers and dependency resolution used by different distros

For a summary showing how to do the most common operations on various distros see this great Pacman Summary


Contents

RPM Tricks

Some good rpm and yum tips are here

--replacepkgs #Install it anyway

http://www.rpm.org/max-rpm/s1-rpm-install-additional-options.html

--oldpackage # "Upgrade" To an older version of a package

NOTE: The the repackage option has been removed in rpm 4.6.0 per the release notes here

--repackage # Be able to revert to prior installs

http://www.linuxjournal.com/article/7034

Note: When installing repacked rpms, you may need to disable digest and md5 checking, for example:

rpm -Uvh --nodigest --nomd5 /var/spool/repackage/VMware-vpxa-4.1.0-258902.i386.rpm

For more info, see the above LInux Journal article and this post

Rebuild an RPM from a currently install package:

http://rpmrebuild.sourceforge.net/rpmrebuild.1.html

Some simple examples of using RPM query tags can be found here

64-Bit

To remove a specific architecture if you have multiple ones installed is simply:

rpm -e zlib.i386 (or rpm -e zlib.x86_64)

Configure RPM's default query tags to display the architecture (very handy):

echo "%_query_all_fmt %%{name}-%%{version}-%%{release}.%%{arch}" >> ~/.rpmmacros

OpenSuse

http://en.opensuse.org/SDB:Zypper_usage_11.3

For a quick guide on zypper see this basic tutorial

Lots of options. Zypper and Yasy are defaults. (smart and rug are no longer around.) Don't want to use them because you are used to yum? No problem, just install yum, though you may have to set up repos for it separately as zypper use separate repos.d directories in /etc/zypp/repos.d whereas yum's are in /etc/yum/repos.d


Zypper:

  • No longer Lacks the equivalent to yum localinstall.


Smart:

Should you need to turn off GPG Signature checking:

  • smart config --set rpm-check-signatures=false
  • Do what you need to do
  • smart config --set rpm-check-signatures=true

Yes, yes - amazingly unsafe, etc. etc.


Yum:

  • zypper install yum

Will install yum and set up repos in /etc/yum/

  • Turn off GPG validation (GPGCheck=0) in /etc/yum/yum.conf (Only if needed and you trust the source of the RPM of course)
  • Install RPMs locally and resolve needed dependencies by using yum localinstall package.rpm Note that you must first install yum-utils to have the localinstall feature.

Verify RPMs

To ensure an rpm you downloaded is not corrupted, verify its self-consistency with:

rpm -K --nopgp *rpm


RPM GPG Signatures

If a package is not signed you can sign it yourself, or turn of GPGCheck in yum.conf

In order to sign packages you need to configure a GPG key and then create a file in the users home directory which contains some environmental variables used by GPG to sign packages.

1) Run gpg --gen-key to create a GPG key which will be stored in .gnupg in your home directory

2) To see the list of keys in your key ring, run gpg --list-keys which will produce output similar to:

pub   1024D/34E16DF5 2008-11-16
uid                  Joe Blow (GPG Key to sign stuff locally) <JoeBlow@gmail.com>
sub   2048g/7031624D 2008-11-16

2) Create an .rpmmacros file in the home directory which contains:

%_signature gpg
%_gpg_path /root/.gnupg
%_gpg_name 34E16DF5
%_gpgbin /usr/bin/gpg

Note the 34E16DF5 value is the pub key ID given in the gpg --list-keys output above.

To verify the signature of an RPM, use:

rpm --checksig –verbose package.rpm

For additional information on GPG and RPMs see:

http://www.cognitus.net/html/howto/rpmSigning.html

http://sial.org/howto/rpm/

http://fedoranews.org/tchung/gpg/

http://www.gnupg.org/gph/en/manual.html

Creating yum repo server

Instructions for creating your own yum repo server:

http://sial.org/howto/yum/

Looking for something?

Use the form below to search the wiki:

 

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!