Connect with us

Hi, what are you looking for?

Linux

RPM and YUM Commands Cheat Sheet for CentOS 7

Package Management (RPM & YUM) Commands for RHEL and Fedora Based Linux Distributions

Redhat Package Manager (RPM)

  • RPM is both a installation method as well as a package format.
  • RPM packages were original created of Red Hat Linux, but now can be used on many Linux distributions like
  • red Hat enterprise Linux, fedora, SUSE, Mandriva, etc.
  • Using RPM we can
  • Install new applications
  • Upgrade existing applications
  • Remove installed applications
  • Query packages
RPM Label Pattern
Bind-9.3.3-7.el5.i386.rpm

this examples is given by using following format

(Package Name)-(Package Version)-(Package Architecture)-(Package Extension)

Methods of Installation
  • Standalone Method
  • Installing from a Harddisk, CD, DVD or Pendrive
  • Network Installation Method
  • Network file service (NFS).
  • File transfer Protocol(FTP).
Standalone Installation
Installing a package
[root@techbrown.com~]# rpm <options> <package name>  --force
Options

-I             install                                                    -U           Update existing package
-v            Verbose                                               –force  Install the package forcefully
-h            Displays the progress in hashes

Removing  an Installed Package
Removing a Package
[root@techbrown.com~]# rpm <options> <package name> --nodeps

Options
-e                            Erase (uninstall)
–nodeps             Uninstall the package even if other applications are dependent on this application

Querying an Installation
Installing a package
[root@techbrown.com~]# rpm <options ><Package name>

Options
-q            Query the availability of the package
-qa         Displays all installed packages
-qc          Displays the configuration files of the package
-qi           Displays the information of the package
-ql           Displays all the files associated with the installed package

Network Installation Method – NFS
Create a directory
[root@techbrown.com~]# mkdir <directory name>
Mount the NFS fie system on the directory
[root@techbrown.com~]# mount <NFSservip>:<path to the package> <mount Point>
To install the package
[root@techbrown.com~]# cd <mount point>
[root@techbrown.com~]# rpm <option><package>  --force
Network Installation Method –FTP
To install the package
[root@techbrown.com~]# rpm <options> ftp://<FTPserver><path > --force

Yellowdog Updater Modification (YUM)

  • It is an interactive use to Install, Remove, upgrade or qury the packages.
  • Added from RHEL 5 onwards.
  • YUM uses an repository that is xml-based rpm metadata for installation.
  • It automatically computes dependencies and figures out what things should occur to install packages.
  • It can be used to installed from a local media, ftp server or nfs server.
To create a Respository
On the local machine
  • Create a directory.
  • Copy the packages into this directory.
  • Install the package createrepo*.rpm.
  • Insert the 1st OS cd
  • Create the respository.
Creating the repository
[root@techbrown.com~]# createrepo –g /media/cdrom/Server/repodate/comps-rhel5-server-core.xml <directory>
Client Configuration
To define the path to the repository
[root@techbrown.com~]# vi/etc/yum.repos.d/rhel-debuginfo.repo

Add the following lines

[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever-$basearch- debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasver/en/os/$basearch/Debuginfo
enable=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

:wq

Client Configuration
For local machine- change the highlighted line to
baseurl=file:///<path to the directory containing the dumps>
Through ftp – change the highlighted line to
Baseurl=ftp://<ftpserver><path to the directory containing the dumps>
YUM Command
Installing a package
[root@techbrown.com~]# yum <option> <package name1>* <package name2>*

Options
List                         Display the list of packages in the repository.
List installed       Displays the packages that are already installed.
Remove               To erase or remove a packages.
Install                    Installs the package from the respository.
Update                 To update existing packages.
Congratulations now you have learned Package Management (RPM & YUM) Commands for RHEL and Fedora Based Linux Distributions. 

Advertisement. Scroll to continue reading.
Comments
Advertisement
Advertisement
Advertisement

You May Also Like

Windows

How to auto upgrade JioFi firmware for JioFi 2 / JioFi 3 / JioFi 4 / JioFi 5 / JioFi 6 and other JioFi...

Windows

Internet is the most important public network for connecting to the WEB. For internet connection requirement the ISP is required as well as it...

Windows

How to download and install the Mobile Intel 4 Series Express Chipset Graphics Drivers for Windows 10.  Windows 10 is the one of the...

Windows

How to Install and Configure PCSX2 on Windows 10. The Windows 10 is the most recommended operating system for the Games. In stream platform...