How to Manage (Install / Update / Remove) various softwares / packages in RedHat or CentOS Linux ??


There are two methods or tools for package management in Red Hat or CentOS Linux.

  • rpm (Redhat Pacakge Management) 

    • Traditional tool for package installation
    • Easy to use but does need to install all the package dependencies manually.  


Managing Packages using rpm

Package Query

a) Lists all installed packages
# rpm -qa 


b) Checks whether the given package is installed or not. Instead of <package name>, enter the name of the package you want to search.
# rpm -q <package name>


c) List all packages that matches the given pattern in their names
# rpm -qa <pattern>


d) List all files and directories contained in a package
# rpm -ql <package name>


e) List only documentation files of a package
# rpm -qd <package name>


f) List only configuration files of a package
# rpm -qc <package name>


g) To get a brief information about a package
#rpm -qi <package name>


h) Displays the name of the package that contains the given file
# rpm -qf <file name>


i) To get the dependencies required for a package
# rpm --requires <package name>


j) To get the name of the package that depends on the given package
# rpm --whatrequires <package name>


k) To get the version history of a package
# rpm --change-log <package name>



Installing / Upgrading / Removing packages using 'rpm'

a) Installing a package
# rpm -ivh <full package name>

b) Upgrading a package
# rpm -Fvh <full package file name>

c) Removing a package
# rpm -Uvh <full package file name>  (Removes the package with its dependencies)

 # rpm -e --nodeps <package name>
  (Removes the package ignoring dependencies)
Note:
    •  -i    ----->   install only
    •  -F   ----->   upgrade only
    •  -U  ----->   upgrade or install
    •  -v   ----->   verbose (show details)
    •  -h   ----->   show installation progress in terms of hash (#) bar
    •  --nodeps -----> ignores dependency check


  • yum (Yellodog Updated Modified)

    • Newer tool for software / package installation.
    •  Resolves all packages dependencies automatically, no need for manual installation like in rpm.

Managing packages using 'yum'


Installing a package
# yum install <package name>
# yum -y install <package name> --> (automatic, no confirmation)

Upgrading a package
# yum update <package name>
# yum -y update <package name> --> (automatic, no confirmation)

Querying a package
# yum list <pacakge name>
   (To check whether the package is installed or not.)

Managing packages
# yum info <package name>
   (To view brief information about a package) 

Removing a package
# yum remove <package name>
   (To remove package along with its dependencies)

# yum -e --nodeps <package name> 
   (To remove package only) 

For whole system update
# yum update 



 Thank You :)

Post a Comment

0 Comments