Thursday, August 12, 2010

Chapter2 - rpm and yum

Commands to be aware of:

yum
  • yum list [all|installed|available|updates] [regex]
  • yum info pkgname
  • yum provides filename (lists the rpms that contain that file. 'yum provides filename | grep installed -B3' is more useful)
  • yum install pkgname | yum localinstall pkgname.rpm | yum groupinstall group
  • yum search
createrepo
  • createrepo -v /dir
  • createrepo -v --update /dir
  • Creates the following files in /dir/repodata/
    • repomd.xml - md5 checksum of other files. client cache is updated when this file changes
    • primary.xml.gz - list of all rpms, and files provided by rpms
    • filelists.xml.gz - list of all files provided by rpms, used by 'yum provides'
    • other.xml.gz - other meta info of packages
rpm
  • install-upgrade-remove
  • rpm -ivh pkg.rpm: installs. -v verbose, -h prints hash progress bar
  • rpm -Uvh pkg.rpm: upgrades pkg.rpm if it exists, installs if it doesn't exist
  • rpm -Fvh pkg.rpm: upgrades pkg.rpm if it exists, skips if it doesn't exist
  • rpm -i --replacepkgs: install same package again
  • rpm -i --oldpackage: downgrade package
  • rpm -e pkg: removes pkg
  • query
  • rpm -qa: list all packages
  • rpm -ql pkg: list all files of installed pkg
  • rpm -qc pkg: list all config files of installed pkg
  • rpm -qd pkg: list all doc files of installed pkg
  • rpm -qi pkg: pkg info
  • rpm -qf filename: name the package that installed this file
  • rpm -q --changelog pkg: print changelog
  • rpm -q --scripts pkg: print pre and post scripts
  • rpm -qa --last: print installation time
  • rpm -qap pkg.rpm: list all files of pkg.rpm
  • rpm -qcp | -qdp pkg.rpm
  • verify
  • rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
  • rpm -V pkg: verifies package (of any modifications to its files)
  • rpm -Va : verify all pkg
  • rpm -Vp pkg.rpm
  • rpm --checksig pkg.rpm

No comments: