1. To list all enabled repositories

[root@rhel6-1 ~]# yum repolist
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
rhel6                                                                                                                                                                         | 3.9 kB     00:00     
repo id                                                                                         repo name                                                                                      status
rhel6                                                                                           rhel6                                                                                          3,690
repolist: 3,690
[root@rhel6-1 ~]

2. To install particular package and their dependencies

[root@rhel6-1 ~]# yum install vsftpd
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.2.2-11.el6_4.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================================================================
 Package                                      Arch                                         Version                                                 Repository                                   Size
=====================================================================================================================================================================================================
Installing:
 vsftpd                                       x86_64                                       2.2.2-11.el6_4.1                                        rhel6                                       151 k

Transaction Summary
=====================================================================================================================================================================================================
Install       1 Package(s)

Total download size: 151 k
Installed size: 331 k
Is this ok [y/N]: y
Downloading Packages:
vsftpd-2.2.2-11.el6_4.1.x86_64.rpm                                                                                                                                            | 151 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : vsftpd-2.2.2-11.el6_4.1.x86_64                                                                                                                                                    1/1 
  Verifying  : vsftpd-2.2.2-11.el6_4.1.x86_64                                                                                                                                                    1/1 

Installed:
  vsftpd.x86_64 0:2.2.2-11.el6_4.1                                                                                                                                                                   

Complete!
[root@rhel6-1 ~]# 

3. To remove particluar package and their dependencies

[root@rhel6-1 ~]# yum remove vsftpd
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.2.2-11.el6_4.1 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================================================================
 Package                                      Arch                                         Version                                                Repository                                    Size
=====================================================================================================================================================================================================
Removing:
 vsftpd                                       x86_64                                       2.2.2-11.el6_4.1                                       @rhel6                                       331 k

Transaction Summary
=====================================================================================================================================================================================================
Remove        1 Package(s)

Installed size: 331 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : vsftpd-2.2.2-11.el6_4.1.x86_64                                                                                                                                                    1/1 
  Verifying  : vsftpd-2.2.2-11.el6_4.1.x86_64                                                                                                                                                    1/1 

Removed:
  vsftpd.x86_64 0:2.2.2-11.el6_4.1                                                                                                                                                                   

Complete!
[root@rhel6-1 ~]# 

4. To update the package and their dependencies automatically. In below example, have updated the vsftpd from 2.2.2-11 to 2.2.2-24

[root@rhel6-1 ~]# rpm -qa | grep vsftpd
vsftpd-2.2.2-11.el6_4.1.x86_64
[root@rhel6-1 ~]# yum update vsftpd
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.2.2-11.el6_4.1 will be updated
---> Package vsftpd.x86_64 0:2.2.2-24.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================================================================
 Package                                       Arch                                          Version                                             Repository                                     Size
=====================================================================================================================================================================================================
Updating:
 vsftpd                                        x86_64                                        2.2.2-24.el6                                        update                                        156 k

Transaction Summary
=====================================================================================================================================================================================================
Upgrade       1 Package(s)

Total download size: 156 k
Is this ok [y/N]: y
Downloading Packages:
vsftpd-2.2.2-24.el6.x86_64.rpm                                                                                                                                                | 156 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : vsftpd-2.2.2-24.el6.x86_64                                                                                                                                                        1/2 
  Cleanup    : vsftpd-2.2.2-11.el6_4.1.x86_64                                                                                                                                                    2/2 
  Verifying  : vsftpd-2.2.2-24.el6.x86_64                                                                                                                                                        1/2 
  Verifying  : vsftpd-2.2.2-11.el6_4.1.x86_64                                                                                                                                                    2/2 

Updated:
  vsftpd.x86_64 0:2.2.2-24.el6                                                                                                                                                                       

Complete!
[root@rhel6-1 ~]# rpm -qa | grep vsftpd
vsftpd-2.2.2-24.el6.x86_64
[root@rhel6-1 ~]# 

5. To list both enabled and disabled repositories

[root@rhel6-1 yum.repos.d]# yum repolist all
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
repo id                                                                                  repo name                                                                                     status
rhel6                                                                                    rhel6                                                                                         enabled: 3,690
update                                                                                   rhel6-update                                                                                  disabled
repolist: 3,690
[root@rhel6-1 yum.repos.d]# 

6. To get the information about the package in which the config file belongs to. Suppose if you want to know the file vsftpd.conf belongs to which package then yum provides function will help. Not necessary to install the package in the server. This information can be found even if the package is not installed in the server.

[root@rhel6-1 yum.repos.d]# yum provides /etc/vsftpd/vsftpd.conf 
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
vsftpd-2.2.2-11.el6_4.1.x86_64 : Very Secure Ftp Daemon
Repo        : rhel6
Matched from:
Filename    : /etc/vsftpd/vsftpd.conf



vsftpd-2.2.2-24.el6.x86_64 : Very Secure Ftp Daemon
Repo        : installed
Matched from:
Other       : Provides-match: /etc/vsftpd/vsftpd.conf

7. Yum will keep the all enabled package information in /var/cache/yum. You may need to run clean all function at regular intervals to free up the space or if you made any changes in repository.

[root@rhel6-1 yum.repos.d]# yum clean all
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: rhel6
Cleaning up Everything
[root@rhel6-1 yum.repos.d]# 

8. Suppose if you have multiple repos and you want to install, update using particular repo then this can be possible by using –enablerepo function as shown below. This will look the package in rhel6 repo and in any other repo’s.

[root@rhel6-1 yum.repos.d]# yum --enablerepo=rhel6 install vsftpd
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.2.2-11.el6_4.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================================================================
 Package                                      Arch                                         Version                                                 Repository                                   Size
=====================================================================================================================================================================================================
Installing:
 vsftpd                                       x86_64                                       2.2.2-11.el6_4.1                                        rhel6                                       151 k

Transaction Summary
=====================================================================================================================================================================================================
Install       1 Package(s)

Total download size: 151 k
Installed size: 331 k
Is this ok [y/N]: 

9. To view the past transactions of install, update of yum command.

[root@rhel6-1 yum.repos.d]# yum history
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     9 | root               | 2017-11-27 17:23 | Install        |    1   
     8 | root               | 2017-11-27 17:16 | Erase          |    1   
     7 | root               | 2017-11-27 16:56 | Update         |    1   
     6 | root               | 2017-11-27 16:19 | Install        |    1   
     5 | root               | 2017-11-27 16:01 | Erase          |    1   
     4 | root               | 2017-11-27 16:00 | Install        |    1   
     3 | root               | 2017-05-15 14:28 | Install        |    1  <
     2 | root               | 2017-05-14 11:04 | Install        |    5 > 
     1 | System            | 2017-05-02 15:55 | Install        |  636   
history list
[root@rhel6-1 yum.repos.d]#

10. To list the installed packages on the servers.

[root@rhel6-1 yum.repos.d]# yum list installed
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed Packages
ConsoleKit.x86_64                                                               0.4.1-3.el6                                                   @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
ConsoleKit-libs.x86_64                                                          0.4.1-3.el6                                                   @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
MAKEDEV.x86_64                                                                  3.24-6.el6                                                    @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
Red_Hat_Enterprise_Linux-Release_Notes-6-en-US.noarch                           5-2.el6                                                       @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
SDL.x86_64                                                                      1.2.14-3.el6                                                  @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
abrt.x86_64                                                                     2.0.8-21.el6                                                  @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
abrt-addon-ccpp.x86_64                                                          2.0.8-21.el6                                                  @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
abrt-addon-kerneloops.x86_64                                                    2.0.8-21.el6                                                  @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
abrt-addon-python.x86_64                                                        2.0.8-21.el6                                                  @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
abrt-cli.x86_64                                                                 2.0.8-21.el6                                                  @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5

NO COMMENTS

LEAVE A REPLY