YUM (Yellowdog Updater, Modified) provide more services and functionality than is available with the rpm command and other RPM-based tools.
With Yum tools and plug-ins, you can:
- List software packages, both installed and available, in local or remote repositories
- Check for package dependencies (packages required to install a package)
- Create new repositories and enable or disable access to existing repositories
- Speed up package installation by using cached information (Yum cache)
- Extend Yum’s functionality with plug-ins such as the downloadonly plug-in (to download a package without installing it)
Installing packages
Following example usages shows the most commonly used options for performing package installation with yum :
Command options | Description |
---|---|
install | Install a package making sure that all the dependencies are resolved. |
install /path/to/file | Install the package which provides the given file, making sure that all dependencies are resolved |
localinstall | Install a package from a local le, http, or ftp |
reinstall | Reinstall the current version of a package |
groupinstall | Install all packages in the selected group |
Examples :
1. Install the vsftpd package from the repository in the system :
# yum install vsftpd
2. Install a package from local directory :
# yum localinstall pkg-1-1.i686.rpm
You can also install a package from a local ftp site :
# yum localinstall http://myrepo/pkg-1-1.i686.rpm
3. Reinstall the current version of a package nfs-utils (to replace any deleted files) :
# yum reinstall nfs-utils
4. Install all packages in the group “Web server” :
# yum groupinstall “Web server”
Removing packages
Options available with yum command to remove packages :
Command options | Description |
---|---|
remove | remove a package as well as packages that depend on it |
swap | Remove one package and install another |
erase | Erase a package (and possibly dependencies) from your system. Same as remove. |
autoremove | Same as erase, plus removes additional unneeded packages (available in RHEL 7) |
Examples :
1. Removing package vsftpd and all its dependencies from the system :
# yum remove vsftpd
Similar to remove you can also use erase option.
2. To remove one package and install another using single command use the swap option :
# yum swap lftp vsftpd
3. Another option introduced in RHEL 7 i.e. autoremove can be used to remove a package along with additional unneeded packages :
# yum autoremove httpd
Upgrading/Downgrading packages
Command options | Description |
---|---|
update | update all or a specific package if specified as well as updates any dependent packages. |
update-to | update all or a specific package to a particular version specified |
upgrade | update packages taking obsoletes into account |
downgrade | downgrade a package to an earlier version |
Examples :
1. To update all the packages available on the system :
# yum update
2. To update a specific package like httpd :
# yum update httpd
3. To downgrade a package to an earlier version :
# yum downgrade pkg_name
Non-interactive use of yum
The -y option when used with any yum command assumes the answer to any question as yes and provides a non-interactive use of the yum command. It can be coupled with any of the commands we have seen so far in the post. One of the examples where it’s very much useful is :
yum update -y