In this article, we will learn about “how to use the Yum command” for installing the packages. Also note that, the repositories on the Cent OS 6.7 YUM (Yellowdog Update Modified) is a tool used to develop by Redhat. You can use this materials for learning the YUM.
Managing Software with YUM
Use the yum utility to install or modify the software on your system in the following ways –
- New software installation from repositories.
- Installing software from an individual package file.
- Updating the existing software on your system.
- Removing unwanted software from your system.
Installing Software from a Package File
The yum commands used in this is to use repositories as a package sources and the yum will install software from an individual package file. To use yum for a specific function and for one or more packages or the package groups. Each section below will shows some examples.
The following sections along with examples will help you to understand “how to use yum for a specific function and or for multiple packages or package groups”.
Yum always downloads the latest package information from the repositories. If the system uses a slow network connection, then yum may require some time to download the repository and find the indexes and the header files for each package.
The yum utility will search for data to determine the best repository and proceeds with the required installation and will show the result to display the transaction for you. The result may include the installations, updates, or removal of the packages, in order to resolve and install the software dependencies.
Below is an example of installing a unity using install option ‘tsclient‘ utility.
# yum install tsclient Loaded plugins: fastestmirror, security Setting up Install Process Loading mirror speeds from cached hostfile epel/primary_db | 5.9 MB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 updates/primary_db | 4.7 MB 00:00 Resolving Dependencies --> Running transaction check ---> Package tsclient.x86_64 0:2.0.2-10.el6 will be installed (1/2): tsclient-2.0.2-10.el6.x86_64.rpm | 97 kB 00:00 (2/2): xcb-util-0.3.6-6.el6.x86_64.rpm | 26 kB 00:00 Installing : tsclient-2.0.2-10.el6.x86_64 1/2 Installing : xcb-util-0.3.6-6.el6.x86_64.rpm 2/2 Verifying : tsclient-2.0.2-10.el6.x86_64 1/2 Verifying : xcb-util-0.3.6-6.el6.x86_64.rpm 2/2 --------------------------------------------------------------------------------------------------------------------- Total 729 kB/s | 16 MB 00:22 Installed: tsclient.x86_64 0:2.0.2-10.el6 Dependency Installed: xcb-util.x86_64 0:0.3.6-6.el6 Complete!
It will review the list of changes and packages needed to upgrade, and when we press y to accept and begin the process. If you press N or Enter, then yum will not download or change any packages.
The yum will only display and uses the newest version of the package, unless we specify about installing the older version. The yum also imports the repository of public keys if it is not installed on the RPM keyring.
Below 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<email@example.com>" Is this ok [y/N]:
Importing the YUM Public Key
After we check the public key, then press y to import the key and authorize the key to use. If you press N or Enter, yum stops importing the key and stops the installation of packages.
To ensure that, the downloading of packages is genuine, yum verifies all digital signatures of each package with the public key provided by the provider. Once all of the packages required for the installation are successfully downloaded and verified, yum will install them to your system.
Downloads are Cached
The yum will keep downloading the data files and packages for the future. You may take a backup of the packages from the repository cache directories which locates at /var/cache/yum/, and we can use them to install elsewhere if required. If you remove the package from the cache, it won’t affect the copy of the installed software on the system.
Installing New Software with YUM
To install the package mysql, enter the command:
# yum install mysql-server
Installing Software in a Group
If you want to install the package group MySQL Database, enter the below command:
# yum groupinstall "MySQL Database" ================================================================================================= Package Arch Version Repository Size ================================================================================================= Updating: unixODBC i386 2.1.11-10.el5 base 290 k Installing for dependencies: unixODBC-libs i386 2.1.11-10.el5 base 551 k Transaction Summary ================================================================================================= Install 1 Package(s) Upgrade 1 Package(s) Total size: 841 k Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : unixODBC-libs 1/3 Updating : unixODBC 2/3 Cleanup : unixODBC 3/3 Dependency Installed: unixODBC-libs.i386 0:2.1.11-10.el5 Updated: unixODBC.i386 0:2.1.11-10.el5 Complete!
Updating Software uses yum
To update the HTTP package which is already installed with the latest version, type:
# yum update httpd
If the software is in use and when we update it, the older version remains active till the application or service is restarted. Updates like the kernel or system software will take effect when the machine gets rebooted.
If we want to update all of the packages in the package group “MySQL Database”, we have to run the command:
# yum groupupdate "MySQL Database"
Removing the Software using YUM
To remove the software installed, the yum examines your system for both the specified software for removal and any software which effects the dependencies. Also note that, if you remove the software, then both the software and its dependencies gets deleted.
To remove the HTTP package from your system, use the command:
# yum remove http
To remove all of the packages in the package group “MySQL Database”, Run the below command
# yum groupremove "MySQL Database"
The removal process will leave the user data in place, but it will remove configuration files in. If a package removal has the option of not removing the configuration file, and we reinstall the packages later, it may use the old configuration files only.
After reading this article you are able to use the Yum (Yellowdog Update and Modified) and command to install, upgrade, remove the softwares on Linux machines to manage the softwares and package requirement for the environment.