YUM is a tool provided in the RHEL System for installing, detaching, and searching software packages. It does not only install and uninstall software packages, but also does more. We will show you in this article.
YUM can automatically install the dependent packages of the software package. For example, when you use yum to install httpd, it will automatically install https apache server and the software package on which it depends. It is not so convenient to install the rpm package !), You must download all the software packages it depends on and then install them in sequence.
The yum tool obtains information about the software package from the software repository on the remote server (usually provided by the OS provider. A software repository is a collection of rpm software packages that can run on a specific architecture. For example, there is a software warehouse for 32-bit and 64-bit systems, and a software warehouse for RHEL5 and RHEL6. You can also create a local repository and configure your yum to search for installation packages from your local repository. In the following example, I will show you what yum can do in addition to installing and detaching software. For ease of understanding, I will use the httpd package on my Amazon EC2 RHEL 6.4 server as an example.
Search for software packages from a software Repository
# yum search httpdLoaded plugins: amazon-id, rhui-lb, security==================== N/S Matched: httpd ==========httpd.x86_64 : Apache HTTP Serverhttpd-devel.i686 : Development interfaces for the Apache HTTP serverhttpd-devel.x86_64 : Development interfaces for the Apache HTTP serverhttpd-manual.noarch : Documentation for the Apache HTTP serverhttpd-tools.x86_64 : Tools for use with the Apache HTTP Servermod_dav_svn.x86_64 : Apache httpd module for Subversion servermod_dnssd.x86_64 : An Apache HTTPD module which adds Zeroconf support
To obtain detailed output information, run the following command:
# yum provides httpdLoaded plugins: amazon-id, rhui-lb, securityhttpd-2.2.15-26.el6.x86_64 : Apache HTTP ServerRepo : rhui-REGION-rhel-server-releasesMatched from:
Yum provides httpd searches for software packages containing httpd in the software repository.
Provides a list of all software groups
# yum grouplist
The preceding command displays the installed and available software groups. You can use the software group installation option to install one of the software groups. For example, we will install a software group for PHP Support. This software group contains the required PHP software package.
# yum groupinstall PHP SupportLoaded plugins: amazon-id, downloadonly, rhui-lb, securitySetting up Group ProcessWarning: Group Support does not exist.Resolving Dependencies-> Running transaction check--> Package php.x86_64 0:5.3.3-23.el6_4 will be installed-> Processing Dependency: php-common(x86-64) = 5.3.3-23.el6_4 for package: php-5.3.3-23.el6_4.x86_64-> Processing Dependency: php-cli(x86-64) = 5.3.3-23.el6_4 for package: php-5.3.3-23.el6_4.x86_64--> Package php-gd.x86_64 0:5.3.3-23.el6_4 will be installed-> Processing Dependency: libXpm.so.4()(64bit) for package: php-gd-5.3.3-23.el6_4.x86_64--> Package php-pdo.x86_64 0:5.3.3-23.el6_4 will be installed--> Package php-pear.noarch 1:1.9.4-4.el6 will be installed--> Package php-xml.x86_64 0:5.3.3-23.el6_4 will be installed-> Running transaction check--> Package libXpm.x86_64 0:3.5.10-2.el6 will be installed--> Package php-cli.x86_64 0:5.3.3-23.el6_4 will be installed--> Package php-common.x86_64 0:5.3.3-23.el6_4 will be installed-> Finished Dependency ResolutionDependencies Resolved==================================================Package Arch Version Repository Size==================================================Installing:php x86_64 5.3.3-23.el6_4 rhui-REGION-rhel-server-releases 1.1 Mphp-gd x86_64 5.3.3-23.el6_4 rhui-REGION-rhel-server-releases 106 kphp-pdo x86_64 5.3.3-23.el6_4 rhui-REGION-rhel-server-releases 75 kphp-pear noarch 1:1.9.4-4.el6 rhui-REGION-rhel-server-releases 393 kphp-xml x86_64 5.3.3-23.el6_4 rhui-REGION-rhel-server-releases 103 kInstalling for dependencies:libXpm x86_64 3.5.10-2.el6 rhui-REGION-rhel-server-releases 51 kphp-cli x86_64 5.3.3-23.el6_4 rhui-REGION-rhel-server-releases 2.2 Mphp-common x86_64 5.3.3-23.el6_4 rhui-REGION-rhel-server-releases 524 kTransaction Summary==================================================Install 8 Package(s)Total download size: 4.5 MInstalled size: 16 MIs this ok [y/N]: yDownloading Packages:(1/8): libXpm-3.5.10-2.el6.x86_64.rpm | 51 kB 00:00(2/8): php-5.3.3-23.el6_4.x86_64.rpm | 1.1 MB 00:00(3/8): php-cli-5.3.3-23.el6_4.x86_64.rpm | 2.2 MB 00:00(4/8): php-common-5.3.3-23.el6_4.x86_64.rpm | 524 kB 00:00(5/8): php-gd-5.3.3-23.el6_4.x86_64.rpm | 106 kB 00:00(6/8): php-pdo-5.3.3-23.el6_4.x86_64.rpm | 75 kB 00:00(7/8): php-pear-1.9.4-4.el6.noarch.rpm | 393 kB 00:00(8/8): php-xml-5.3.3-23.el6_4.x86_64.rpm | 103 kB 00:00-----------------------------------------------Total 2.9 MB/s | 4.5 MB 00:01Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionInstalling : php-common-5.3.3-23.el6_4.x86_64 1/8Installing : php-cli-5.3.3-23.el6_4.x86_64 2/8Installing : libXpm-3.5.10-2.el6.x86_64 3/8Installing : php-gd-5.3.3-23.el6_4.x86_64 4/8Installing : 1:php-pear-1.9.4-4.el6.noarch 5/8Installing : php-5.3.3-23.el6_4.x86_64 6/8Installing : php-xml-5.3.3-23.el6_4.x86_64 7/8Installing : php-pdo-5.3.3-23.el6_4.x86_64 8/8Verifying : 1:php-pear-1.9.4-4.el6.noarch 1/8Verifying : php-xml-5.3.3-23.el6_4.x86_64 2/8Verifying : php-common-5.3.3-23.el6_4.x86_64 3/8Verifying : libXpm-3.5.10-2.el6.x86_64 4/8Verifying : php-cli-5.3.3-23.el6_4.x86_64 5/8Verifying : php-5.3.3-23.el6_4.x86_64 6/8Verifying : php-pdo-5.3.3-23.el6_4.x86_64 7/8Verifying : php-gd-5.3.3-23.el6_4.x86_64 8/8Installed:php.x86_64 0:5.3.3-23.el6_4 php-gd.x86_64 0:5.3.3-23.el6_4 php-pdo.x86_64 0:5.3.3-23.el6_4php-pear.noarch 1:1.9.4-4.el6 php-xml.x86_64 0:5.3.3-23.el6_4Dependency Installed:libXpm.x86_64 0:3.5.10-2.el6 php-cli.x86_64 0:5.3.3-23.el6_4 php-common.x86_64 0:5.3.3-23.el6_4Complete!
Install the software package using YUM
You can use the yum install command to install the software package, as shown below:
# yum install httpdLoaded plugins: amazon-id, rhui-lb, securitySetting up Install ProcessResolving Dependencies-> Running transaction check--> Package httpd.x86_64 0:2.2.15-29.el6_4 will be installed-> Processing Dependency: httpd-tools = 2.2.15-29.el6_4 for package: httpd-2.2.15-29.el6_4.x86_64-> Processing Dependency: apr-util-ldap for package: httpd-2.2.15-29.el6_4.x86_64-> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.2.15-29.el6_4.x86_64-> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.2.15-29.el6_4.x86_64-> Running transaction check--> Package apr.x86_64 0:1.3.9-5.el6_2 will be installed--> Package apr-util.x86_64 0:1.3.9-3.el6_0.1 will be installed--> Package apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 will be installed--> Package httpd-tools.x86_64 0:2.2.15-29.el6_4 will be installed-> Finished Dependency ResolutionDependencies Resolved======================================================Package Arch Version Repository Size======================================================Installing:httpd x86_64 2.2.15-29.el6_4 rhui-REGION-rhel-server-releases 821 kInstalling for dependencies:apr x86_64 1.3.9-5.el6_2 rhui-REGION-rhel-server-releases 123 kapr-util x86_64 1.3.9-3.el6_0.1 rhui-REGION-rhel-server-releases 87 kapr-util-ldap x86_64 1.3.9-3.el6_0.1 rhui-REGION-rhel-server-releases 15 khttpd-tools x86_64 2.2.15-29.el6_4 rhui-REGION-rhel-server-releases 73 kTransaction Summary======================================================Install 5 Package(s)Total download size: 1.1 MInstalled size: 3.6 MIs this ok [y/N]: y
As you can see, when installing httpd, yum installs additional software packages. This is called the dependency package parsing completed by yum.
If you do not want yum to bring up the [y/N] option, you can use yum install-y httpd.
Use the yum update command to update an existing software package
# yum update httpdLoaded plugins: amazon-id, rhui-lb, securitySetting up Update ProcessNo Packages marked for Update
This means that the httpd package installed in your system is the latest version in the yum software repository.
For more details, please continue to read the highlights on the next page:
Recommended reading:
Configure the epel yum Source
RedHat local yum source configuration
RedHat Linux local yum source configuration
RedHat 6.2 modify yum source in Linux use CentOS source for free