Search This Blog

Friday, January 8, 2016

RHEL6 - YUM Management



Overview of common yum commands
Task
Explanation
search
Search for the exact name of the package
[what]provides */name
Perform a deep search in the package to look for specific files within the package
info
Provide more information about the packages.
install
Install a package
reinstall
reinstall a package
update [packagename]
Update all packages on your server or a specific one, if you include a package name.
localinstall
Install a package that is not in the repositires but available as an RPM file
remove
Remove the package
erase
Remove a package or packages from your system
list[all|installed]
List all or installed packages
update
Update packages specified
clean all
Remove all stored metadata
deplist
Produces a list of all dependencies and what packages provide those dependencies for the given packages
yum grouplist
List package groups
yum groupinstall
Install all packages from a group
yum grouperase
Is used to remove  all  of  the  packages  in  a  group,  unlike "groupinstall"   this   will remove  everything  regardless  of group_package_types.
yum groupinfo
Is used to give the description and package list of a group.
yum groupupdate
Is just an alias for groupinstall

a.      rpm –e ‘dos2unix unix2dos’            -              remove both pacakges
b.      ‘yum search unix2dos’       -              searches for package
c.       ‘yum info unix2dos’           -              returns/dumps/enumerates package metadata
d.      ‘yum install unix2dos’       -              install the package once
e.      ‘yum reinstall unix2dos’    -              reinstalls package. i.e ‘—replacepkgs’ with ‘rpm’
f.       ‘yum –y reinstall unix2dos’              -              assumes yes when prompted
g.      ‘yum history’       -              returns usage history. i.e BASH shell history
h.      ‘yum –y erase unix2dos dos2unix’  -              assumes yes and removes both packages
i.        ‘yum deplist lftp’ -              dependencies and their providers are returned
j.        ‘yum localinstall dos2unix-3.1-37.el6.i686.rpm’         -              Note: The entire file name is inidicated



[root@server2 /]# rpm -e dos2unix unix2dos
[root@server2 /]# rpm -qi dos2unix
package dos2unix is not installed
[root@server2 /]# rpm -qi unix2dos
package unix2dos is not installed

[root@server2 yum.repos.d]# yum search unix2dos
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
=========================================================================================================== N/S Matched: unix2dos ===========================================================================================================
unix2dos.x86_64 : UNIX to DOS text file format converter

  Name and summary matches only, use "search all" for everything.

[root@server2 yum.repos.d]# yum info unix2dos
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
Available Packages
Name        : unix2dos
Arch        : x86_64
Version     : 2.2
Release     : 35.el6
Size        : 14 k
Repo        : myrepo
Summary     : UNIX to DOS text file format converter
License     : BSD
Description : A utility that converts plain text files in UNIX format to DOS format.

[root@server2 yum.repos.d]# yum install unix2dos
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package unix2dos.x86_64 0:2.2-35.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                   Arch                                                    Version                                                     Repository                                               Size
=============================================================================================================================================================================================================================================
Installing:
 unix2dos                                                  x86_64                                                  2.2-35.el6                                                  myrepo                                                   14 k

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

Total download size: 14 k
Installed size: 17 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : unix2dos-2.2-35.el6.x86_64                                                                                                                                                                                                1/1
  Verifying  : unix2dos-2.2-35.el6.x86_64                                                                                                                                                                                                1/1

Installed:
  unix2dos.x86_64 0:2.2-35.el6                                                                                                                                                                                                              

Complete!

[root@server2 yum.repos.d]# yum reinstall unix2dos
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
Setting up Reinstall Process
Resolving Dependencies
--> Running transaction check
---> Package unix2dos.x86_64 0:2.2-35.el6 will be reinstalled
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                   Arch                                                    Version                                                     Repository                                               Size
=============================================================================================================================================================================================================================================
Reinstalling:
 unix2dos                                                  x86_64                                                  2.2-35.el6                                                  myrepo                                                   14 k

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

Total download size: 14 k
Installed size: 17 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : unix2dos-2.2-35.el6.x86_64                                                                                                                                                                                                1/1
  Verifying  : unix2dos-2.2-35.el6.x86_64                                                                                                                                                                                                1/1

Installed:
  unix2dos.x86_64 0:2.2-35.el6                                                                                                                                                                                                               

Complete!

[root@server2 yum.repos.d]# rpm -e unix2dos

[root@server2 yum.repos.d]# rpm -qi unix2dos
package unix2dos is not installed

[root@server2 yum.repos.d]# yum reinstall unix2dos
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
Setting up Reinstall Process
No Match for argument: unix2dos
Package(s) unix2dos available, but not installed.
Error: Nothing to do

[root@server2 yum.repos.d]# yum -y reinstall unix2dos
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
Setting up Reinstall Process
Resolving Dependencies
--> Running transaction check
---> Package unix2dos.x86_64 0:2.2-35.el6 will be reinstalled
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                   Arch                                                    Version                                                     Repository                                               Size
=============================================================================================================================================================================================================================================
Reinstalling:
 unix2dos                                                  x86_64                                                  2.2-35.el6                                                  myrepo                                                   14 k

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

Total download size: 14 k
Installed size: 17 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : unix2dos-2.2-35.el6.x86_64                                                                                                                                                                                                1/1
  Verifying  : unix2dos-2.2-35.el6.x86_64                                                                                                                                                                                                1/1

Installed:
  unix2dos.x86_64 0:2.2-35.el6                                                                                                                                                                                                               

Complete!

[root@server2 yum.repos.d]# yum history
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
Existing lock /var/run/yum.pid: another copy is running as pid 4464.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  43 M RSS (374 MB VSZ)
    Started: Wed Jan  6 15:24:57 2016 - 00:03 ago
    State  : Sleeping, pid: 4464
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  43 M RSS (374 MB VSZ)
    Started: Wed Jan  6 15:24:57 2016 - 00:05 ago
    State  : Sleeping, pid: 4464
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     9 | root <root>              | 2016-01-06 15:24 | Reinstall      |    1  
     8 | root <root>              | 2016-01-06 15:17 | Reinstall      |    1  
     7 | root <root>              | 2016-01-06 15:17 | Install        |    1  <
     6 | root <root>              | 2016-01-06 15:14 | Reinstall      |    1 >
     5 | root <root>              | 2016-01-06 15:13 | Install        |    1  <
     4 | root <root>              | 2016-01-06 14:43 | Install        |    2 >
     3 | root <root>              | 2016-01-05 15:55 | I, U           |  172  
     2 | root <root>              | 2016-01-05 15:40 | Install        |    3  
     1 | System <unset>           | 2016-01-04 15:27 | Install        | 1219  
history list


[root@server2 yum.repos.d]# yum history undo 7
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
Undoing transaction 7, from Wed Jan  6 15:17:17 2016
    Install unix2dos-2.2-35.el6.x86_64 @myrepo
Resolving Dependencies
--> Running transaction check
---> Package unix2dos.x86_64 0:2.2-35.el6 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                  Arch                                                   Version                                                       Repository                                               Size
=============================================================================================================================================================================================================================================
Removing:
 unix2dos                                                 x86_64                                                 2.2-35.el6                                                    @myrepo                                                  17 k

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

Installed size: 17 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : unix2dos-2.2-35.el6.x86_64                                                                                                                                                                                                1/1
  Verifying  : unix2dos-2.2-35.el6.x86_64                                                                                                                                                                                                1/1

Removed:
  unix2dos.x86_64 0:2.2-35.el6                                                                                                                                                                                                               

Complete!
[root@server2 yum.repos.d]#

[root@server2 yum.repos.d]# yum -y erase unix2dos dos2unix
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package dos2unix.x86_64 0:3.1-37.el6 will be erased
---> Package unix2dos.x86_64 0:2.2-35.el6 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                  Arch                                                   Version                                                       Repository                                               Size
=============================================================================================================================================================================================================================================
Removing:
 dos2unix                                                 x86_64                                                 3.1-37.el6                                                    @myrepo                                                  18 k
 unix2dos                                                 x86_64                                                 2.2-35.el6                                                    @myrepo                                                  17 k

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

Installed size: 35 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing    : unix2dos-2.2-35.el6.x86_64                                                                                                                                                                                                1/2
  Erasing    : dos2unix-3.1-37.el6.x86_64                                                                                                                                                                                                2/2
  Verifying  : dos2unix-3.1-37.el6.x86_64                                                                                                                                                                                                1/2
  Verifying  : unix2dos-2.2-35.el6.x86_64                                                                                                                                                                                                2/2

Removed:
  dos2unix.x86_64 0:3.1-37.el6                                                                                          unix2dos.x86_64 0:2.2-35.el6                                                                                         

Complete!


[root@server2 yum.repos.d]# yum deplist lftp
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
Finding dependencies:
package: lftp.x86_64 4.0.9-6.el6
  dependency: libutil.so.1()(64bit)
   provider: glibc.x86_64 2.12-1.166.el6
  dependency: libgcc_s.so.1(GCC_4.2.0)(64bit)
   provider: libgcc.x86_64 4.4.7-16.el6
  dependency: libgcc_s.so.1(GCC_3.3)(64bit)
   provider: libgcc.x86_64 4.4.7-16.el6
  dependency: libgnutls.so.26()(64bit)
   provider: gnutls.x86_64 2.8.5-18.el6
  dependency: libutil.so.1(GLIBC_2.2.5)(64bit)
   provider: glibc.x86_64 2.12-1.166.el6
  dependency: libc.so.6(GLIBC_2.4)(64bit)
   provider: glibc.x86_64 2.12-1.166.el6
  dependency: ld-linux-x86-64.so.2(GLIBC_2.3)(64bit)
   provider: glibc.x86_64 2.12-1.166.el6
  dependency: libtinfo.so.5()(64bit)
   provider: ncurses-libs.x86_64 5.7-4.20090207.el6
  dependency: rtld(GNU_HASH)
   provider: glibc.i686 2.12-1.166.el6
   provider: glibc.x86_64 2.12-1.166.el6
  dependency: libgnutls.so.26(GNUTLS_1_4)(64bit)
   provider: gnutls.x86_64 2.8.5-18.el6
  dependency: librt.so.1()(64bit)
   provider: glibc.x86_64 2.12-1.166.el6
  dependency: libdl.so.2(GLIBC_2.2.5)(64bit)
   provider: glibc.x86_64 2.12-1.166.el6
  dependency: ld-linux-x86-64.so.2()(64bit)
   provider: glibc.x86_64 2.12-1.166.el6
  dependency: librt.so.1(GLIBC_2.2.5)(64bit)
   provider: glibc.x86_64 2.12-1.166.el6
  dependency: libdl.so.2()(64bit)
   provider: glibc.x86_64 2.12-1.166.el6

[root@server2 repo]# pwd
/repo

[root@server2 repo]# ls -l|grep -i dos2unix
-r--r--r--. 1 root root    15960 Jan  5 15:15 dos2unix-3.1-37.el6.x86_64.rpm

[root@server2 repo]# yum localinstall dos2unix-3.1-37.el6.x86_64.rpm
Loaded plugins: product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
Setting up Local Package Process
Examining dos2unix-3.1-37.el6.x86_64.rpm: dos2unix-3.1-37.el6.x86_64
Marking dos2unix-3.1-37.el6.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package dos2unix.x86_64 0:3.1-37.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                             Arch                                              Version                                                  Repository                                                              Size
=============================================================================================================================================================================================================================================
Installing:
 dos2unix                                            x86_64                                            3.1-37.el6                                               /dos2unix-3.1-37.el6.x86_64                                             18 k

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

Total size: 18 k
Installed size: 18 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : dos2unix-3.1-37.el6.x86_64                                                                                                                                                                                                1/1
  Verifying  : dos2unix-3.1-37.el6.x86_64                                                                                                                                                                                                1/1

Installed:
  dos2unix.x86_64 0:3.1-37.el6                                                                                                                                                                                                              

Complete!


Thank you for reading.
For Reading other article, visit to “https://sites.google.com/site/unixwikis/

No comments:

Post a Comment