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.
It's written in Python, so be careful when updating python.
On RHEL 5, yum has replaced "up2date" for getting updates/packages/etc. that are requested on the RHN website.
Useful invocations
yum search string1 [string2] […]
- Search for packages whose name or description match 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
rpm
Mostly used by us to install packages that aren't in a repository and to reinstall broken packages without messing with packages that depend on them.
Useful invocations
rpm -i package_file1 [package_file2] […]
- Installs the listed packages. Note that these are pathnames and not package names as used for yum.
rpm -e --nodeps package_name1 [package_name2] […]
- Removes the named packages, without removing packages that depend on them. Note that these are package names and not pathnames like when installing. I'm pretty sure the names don't follow the same rules as for yum, so the whole package name might be necessary.
up2date
This is, for pre-RHEL5 systems, the only method of getting updates/packages/etc. that are requested on the RHN website.
Useful invocations
up2date
- Runs the interactive, GUI version, so if you SSH'd in, make sure it was with X forwarding. Not the preferred method, just because the interactive aspect isn't usually needed.
up2date -u
- Gets and installs the updates from RHN in "unattended" mode, with no GUI. Generally the best method, although some systems have some updates flagged to be skipped (things like new kernels).