Package Management
Every machine has yum and rpm installed, and these are the main methods of adding software to a machine.
yum
This program is a higher-level interface to rpm
and repositories. RedHat systems must be registered with RHN to make full use of yum, because registration is the only way to access the offical RedHat repositories. Other repositories can be added by adding entries in /etc/yum.repos.d/, but this should be avoided unless some non-RedHat-supplied software is really needed.
On RHEL 5, yum has replaced "up2date" for getting updates/packages/etc. requested on the RHN website.
Useful invocations
yum search string1 [string2] […]
- Search for packages matching the given string(s)
yum install package1 [package2] […]
- Is used to install the latest version of a package or group of packages while ensuring that all dependencies are satisfied. If no package matches the given package name(s), they are assumed to be a shell glob and any matches are then installed. Sometimes a specific version of package must be specified (e.g. 32-bit versus 64-bit, or if mutliple versions of the same program are installed for some insane reason), see Package Names.
yum update [package1] [package2] […]
- Update packages with same name rules as "install". If no packages are named, all installed packages will be updated. Sometimes that's a bad thing; always use "check-update" first.
yum check-update
- Implemented so you could know if your machine had any updates that needed to be applied without running it interactively. Returns exit value of 100 if there are packages available for an update. Also returns a list of the pkgs to be updated in list format. Returns 0 and no packages are available for update.
yum remove package1 [package2] […]
- Remove packages and all packages that depend on them.
Note that there is no way to simply "reinstall" a package when using yum. Instead, a remove-install combo may be necessary. However, this can be trouble, because could wipe out a lot of innocent packages. So, either use rpm for this (preferred) or make sure to copy the list of packages that yum reports will be removed and install the whole list again.
Package Names
A package can be referred to for install,update,list,remove etc. with any of the following:
- name
- name.arch
- name-ver
- name-ver-rel
- name-ver-rel.arch
- name-epoch:ver-rel.arch
- epoch:name-ver-rel.arch