This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Monday, November 2, 2015

How to Manage Software with YUM in Linux Server?

Use the yum utility to modify the software on your system in four ways:

    To install new software from package repositories
    To install new software from an individual package file
    To update existing software on your system
    To remove unwanted software from your system

[Important]            Installing Software from a Package File


To use yum, specify a function and one or more packages or package groups. Each section below gives some examples.

For each operation, yum downloads the latest package information from the configured repositories.

The yum utility searches these data files to determine the best set of actions to produce the required result, and displays the transaction for you to approve. The transaction may include the installation, update, or removal of additional packages, in order to resolve software dependencies.

This is an example of the transaction for installing tsclient:
==================================================================
 Package                 Arch       Version          Repository        Size
==================================================================
Installing:
 tsclient                   i386       0.132-4          base              247 k
Installing for dependencies:
 rdesktop                i386       1.3.1-5            base              107 k
Transaction Summary
==================================================================
Install      2 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 355 k

Is this ok [y/N]:
Format of YUM Transaction Reports:
Review the list of changes, and then press y to accept and begin the process. If you press N or Enter, yum does not download or change any packages.

Package Versions
 The yum utility only displays and uses the newest version of each package, unless you specify an older version.
The yum utility also imports the repository public key if it is not already installed on the rpm keying.

This is an example of the public key import:

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 443E1821
public key not available for tsclient-0.132-4.i386.rpm
Retrieving GPG key from http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4
Importing GPG key 0x443E1821 "CentOS-4 Key<centos-4key@centos.org>"
Is this ok [y/N]:

Format of yum Public Key Import

 Check the public key, and then press y to import the key and authorize the key for use. If you press N or Enter, yum stops without installing any packages.
To ensure that downloaded packages are genuine, yum verifies the digital signature of each package against the public key of the provider. Once all of the packages required for the transaction are successfully downloaded and verified, yum applies them to your system.

Downloads are Cached

The yum utility keeps downloaded data files and packages for reuse. You may copy packages from the repository cache directories under /var/cache/yum/, and use them elsewhere if you wish. If you remove a package from the cache, you do not affect the copy of the software installed on your system.

Installing New Software with YUM:

 To install the package tsclient, enter the command:
 yum install tsclient

To install the package group MySQL Database, enter the command:
yum groupinstall "MySQL Database"

Updating Software with YUM:
yum update tsclient

Note: New Software Versions Require Reloading

If a piece of software is in use when you update it, the old version remains active until the application or service is restarted. Kernel updates take effect when you reboot the system.

To update all of the packages in the package group MySQL Database, enter the command:
yum groupupdate "MySQL Database"

Removing Software with YUM:

To remove software, yum examines your system for both the specified software, and any software which claims it as a dependency. The transaction to remove the software deletes both the software and the dependencies.
yum remove tsclient

To remove all of the packages in the package group MySQL Database, enter the command:
yum groupremove "MySQL Database"

Searching for Packages with YUM:
Use the search features of yum to find software that is available from the configured repositories, or already installed on your system. Searches automatically include both installed and available packages.

The format of the results depends upon the option. If the query produces no information, there are no packages matching the criteria.

Searching by Package Name and Attributes
yum list tsclient

To make your queries more precise, specify packages with a name that include other attributes, such as version or hardware architecture. To search for version 0.132 of the application, use the command:
yum list tsclient-0.132

Advanced Searches:

If you do not know the name of the package, use the search or provides options. Alternatively, use wild cards or regular expressions with any yum search option to broaden the search criteria.

The search option checks the names, descriptions, summaries and listed package maintainers of all of the available packages to find those that match. For example, to search for all packages that relate to PalmPilots, type:
yum search PalmPilot

This provides function checks both the files included in the packages and the functions that the software provides. This option requires yum to download and read much larger index files than with the search option.

To search for all packages that include files called libneon, type:
yum provides libneon

To search for all packages that either provides a MTA (Mail Transport Agent) service, or includes files with mta in their name:
yum provides MTA

Use the standard wildcard characters to run any search option with a partial word or name: ? to represent any one character, and * to mean zero or more characters. Always add the escape character (\) before wildcards.

To list all packages with names that begin with tsc, type:
yum list tsc\*

Understanding Matches
 Searches with yum show all of the packages that match your criteria. Packages must meet the terms of the search exactly to be  considered matches,  unless you use wildcards or a regular expression.

For example, a search query for shadowutils or shadow-util would not produce the package shadow-utils. This package would match and be shown if the query was shadow-util\?, or shadow\*.
Updating Your System with yum

Use the update option to upgrade all of your system software to the latest version with one operation.
yum update

Automatically Updating Your System
/sbin/chkconfig --level 345 yum on; /sbin/service yum start

How Daily Updates are Run

There is no separate yum service that runs on your system. The command given above enables the control script /etc/rc.d/init.d/yum.
This control script activates the script /etc/cron.daily/yum.cron, which causes the cron service to perform the system update  automatically at 4am each day.

Maintaining YUM
The yum system does not require any routine maintenance. To ensure that yum operations are carried out at optimal speed, disable or remove repository definitions which you no longer require. You may also clear the files from the yum caches in order to recover disk space.

Disabling or Removing Package Sources
 Set enable=0 in a definition file to prevent yum from using that repository. The yum utility ignores any definition file with this setting.

To completely remove access to a repository:
    Delete the relevant file from /etc/yum.repos.d/.
    Delete the cache directory from /var/cache/yum/.

Clearing the yum Caches

By default, yum retains the packages and package data files that it downloads, so that they may be reused in future operations without being downloaded again. To purge the package data files, use this command:
yum clean headers

Run this command to remove all of the packages held in the caches:
yum clean packages

For CentOS-4 users, to clean the metadata files use this command:
yum clean metadata

Purging cached files causes those files to downloaded again the next time that they are required. This increases the amount of time required to complete the operation.

No comments:

Post a Comment