0% found this document useful (0 votes)
100 views11 pages

20 RPM Command Examples for Linux

The document discusses RPM (Red Hat Package Manager) commands. It provides 20 examples of RPM commands for installing, updating, removing, querying, and verifying packages on Linux systems. It also lists some facts about RPM and the main modes for the RPM command: install, remove, upgrade, verify, and query.

Uploaded by

abhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views11 pages

20 RPM Command Examples for Linux

The document discusses RPM (Red Hat Package Manager) commands. It provides 20 examples of RPM commands for installing, updating, removing, querying, and verifying packages on Linux systems. It also lists some facts about RPM and the main modes for the RPM command: install, remove, upgrade, verify, and query.

Uploaded by

abhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

12/20/2015

20PracticalExamplesofRPMCommandsinLinux

20PracticalExamplesofRPMCommandsinLinux
byRaviSaive|Published:April10,2013|LastUpdated:January3,2015

DownloadYourFreeeBooksNOW10FreeLinuxeBooksforAdministrators|4FreeShell
ScriptingeBooks

RPM(RedHatPackageManager)isandefaultopensourceand
mostpopularpackagemanagementutilityforRedHatbased
systemslike(RHEL,CentOSandFedora).Thetoolallowssystem
administratorsandusers
toinstall,update,uninstall,query,verifyandmanagesystem
softwarepackagesinUnix/[Link]
[Link],thatincludescompiledsoftware
[Link]
[Link].

20MostUsefulRPMCommandExamples

Thisarticleprovidessomeuseful20RPMcommandexamplesthat
[Link]
canmanagedtoinstall,update,removepackagesinyourLinux
[Link]

1/11

12/20/2015

20PracticalExamplesofRPMCommandsinLinux

systems.

SomeFactsaboutRPM(RedHat
PackageManager)
RPMisfreeandreleasedunderGPL(GeneralPublicLicense).
RPMkeepstheinformationofalltheinstalledpackages
under/var/lib/rpmdatabase.
RPMistheonlywaytoinstallpackagesunderLinuxsystems,
ifyouveinstalledpackagesusingsourcecode,thenrpmwont
manageit.
[Link],whichcontainstheactualinformation
aboutthepackagessuchas:whatitis,fromwhereit
comes,dependenciesinfo,versioninfoetc.

Therearefivebasicmodesfor
RPMcommand
Install:ItisusedtoinstallanyRPMpackage.
Remove:Itisusedtoerase,removeoruninstallanyRPM
package.
Upgrade:ItisusedtoupdatetheexistingRPMpackage.
Verify:ItisusedtoqueryaboutdifferentRPMpackages.
Query:ItisusedfortheverificationofanyRPMpackage.

WheretofindRPMpackages
Belowisthelistofrpmsites,whereyoucanfindanddownload
allRPMpackages.
[Link]
[Link]
[Link]
[Link]
ReadAlso:
20YUMCommandExamplesinLinux
10WgetCommandExamplesinLinux
30MostUsefulLinuxCommandsforSystemAdministrators
[Link]

2/11

12/20/2015

20PracticalExamplesofRPMCommandsinLinux

Pleaserememberyoumustberootuserwheninstallingpackages
inLinux,withtherootprivilegesyoucanmanagerpmcommands
withtheirappropriateoptions.

[Link]
SignaturePackage
AlwayscheckthePGPsignatureofpackagesbeforeinstallingthem
onyourLinuxsystemsandmakesureitsintegrityandoriginisOK.
Usethefollowingcommandwithchecksig(checksignature)option
tocheckthesignatureofapackagecalledpidgin.

[root@tecmint]#rpmchecksigpidgin2.7.95.el6.2
.[Link]
[Link]:rsasha1(md5)pgpm
d5OK

[Link]
Forinstallinganrpmsoftwarepackage,usethefollowingcommand
[Link],toinstallanrpmpackagecalledpidgin
[Link].

[root@tecmint]#rpmivhpidgin2.7.95.el6.2.i686.
rpm
Preparing...#######################
####################[100%]
1:pidgin#######################
####################[100%]

RPMcommandandoptions
[Link]

3/11

12/20/2015

20PracticalExamplesofRPMCommandsinLinux

i:installapackage
v:verboseforanicerdisplay
h:printhashmarksasthepackagearchiveisunpacked.

[Link]
RPMPackagebeforeInstalling
Letssayyouwouldliketodoadependencycheckbeforeinstalling
[Link],usethefollowingcommandto
checkthedependenciesofBitTorrent5.2.21
[Link]
dependenciesofpackage.

[root@tecmint]#rpmqpRBitTorrent5.2.21Python2
.[Link]
/usr/bin/python2.4
python>=2.3
python(abi)=2.4
pythoncrypto>=2.0
pythonpsyco
pythontwisted>=2.0
pythonzopeinterface
rpmlib(CompressedFileNames)=2.6

RPMcommandandoptions
q:Queryapackage
p:Listcapabilitiesthispackageprovides.
R:Listcapabilitiesonwhichthispackagedepends..

[Link]
WithoutDependencies
IfyouknowthatallneededpackagesarealreadyinstalledandRPM
isjustbeingstupid,youcanignorethosedependenciesbyusingthe
optionnodeps(nodependenciescheck)beforeinstallingthe
package.

[root@tecmint]#rpmivhnodepsBitTorrent5.2.2
[Link]

4/11

12/20/2015

20PracticalExamplesofRPMCommandsinLinux

[Link]
Preparing...#######################
####################[100%]
1:BitTorrent#######################
####################[100%]

Theabovecommandforcefullyinstallrpmpackagebyignoring
dependencieserrors,butifthosedependencyfilesaremissing,then
theprogramwillnotworkatall,untilyouinstallthem.

[Link]
Package
Usingqoptionwithpackagename,willshowwhetheranrpm
installedornot.

[root@tecmint]#rpmqBitTorrent
[Link]

[Link]
installedRPMpackage
Toviewallthefilesofaninstalledrpmpackages,usetheql(query
list)withrpmcommand.

[root@tecmint]#rpmqlBitTorrent
/usr/bin/bittorrent
/usr/bin/bittorrentconsole
/usr/bin/bittorrentcurses
/usr/bin/bittorrenttracker
/usr/bin/changetrackerconsole
/usr/bin/launchmanyconsole
/usr/bin/launchmanycurses
/usr/bin/maketorrent
/usr/bin/maketorrentconsole
/usr/bin/torrentinfoconsole

[Link]

5/11

12/20/2015

20PracticalExamplesofRPMCommandsinLinux

[Link]
RPMPackages
Usethefollowingrpmcommandwithqa(queryall)option,willlist
alltherecentlyinstalledrpmpackages.

[root@tecmint]#rpmqalast
BitTorrent5.2.21.noarchTue0
4Dec20[Link]PMBDT
pidgin2.7.95.el6.2.i686Tue0
4Dec20[Link]PMBDT
cyrussasldevel2.1.2313.el6_3.1.i686Tue0
4Dec20[Link]PMBDT
cyrussasl2.1.2313.el6_3.1.i686Tue0
4Dec20[Link]PMBDT
cyrussaslmd52.1.2313.el6_3.1.i686Tue0
4Dec20[Link]PMBDT
cyrussaslplain2.1.2313.el6_3.1.i686Tue0
4Dec20[Link]PMBDT

[Link]
Packages
Typethefollowingcommandtoprinttheallthenamesofinstalled
packagesonyourLinuxsystem.

[root@tecmint]#rpmqa
[Link].i686
polkitdesktoppolicy0.962.el6_0.[Link]
[Link].i686

[Link]
Package
IfwewanttoupgradeanyRPMpackageU(upgrade)optionwill
[Link]
willnotonlyupgradethelatestversionofanypackage,butitwill
[Link]

6/11

12/20/2015

20PracticalExamplesofRPMCommandsinLinux

alsomaintainthebackupoftheolderpackagesothatincaseifthe
newerupgradedpackagedoesnotrunthepreviouslyinstalled
packagecanbeusedagain.

[root@tecmint]#[Link].i686
.rpm
Preparing...#######################
####################[100%]
1:nx#######################
####################[100%]

[Link]
Package
TouninstallanRPMpackage,forexampleweusethepackage
namenx,nottheoriginalpackagenamenx3.5.0
[Link](erase)optionisusedtoremove
package.

[root@tecmint]#rpmevvnx

[Link]
PackageWithoutDependencies
Thenodeps(Donotcheckdependencies)optionforcefullyremove
[Link]
particularpackagemaybreakotherworkingapplications.

[root@tecmint]#rpmevnodepsvsftpd

[Link]
belongswhichRPMPackage
Letssay,youhavelistoffilesandyouwouldliketofindoutwhich
[Link],thefollowingcommand
[Link]

7/11

12/20/2015

20PracticalExamplesofRPMCommandsinLinux

withqf(queryfile)optionwillshowyouafile/usr/bin/htpasswdis
[Link].1.i686.

[root@tecmint]#rpmqf/usr/bin/htpasswd
[Link].1.i686

[Link]
InstalledRPMPackage
Letssayyouhaveinstalledanrpmpackageandwanttoknowthe
[Link](queryinfo)option
willprinttheavailableinformationoftheinstalledpackage.

[root@tecmint]#rpmqivsftpd
Name:vsftpd

Relocations:(notrelocatable)
Version:2.2.2

Vendor:CentOS
Release:11.el6

BuildDate:Fri22Jun20[Link]PMBDT
InstallDate:Mon17Sep20[Link]PMBDT
BuildHost:[Link]
Group:SystemEnvironment/Daemons
SourceRPM:[Link]
Size:351932
License:GPLv2withexceptions
Signature:RSA/SHA1,Mon25Jun20[Link]M
BDT,KeyID0946fca2c105b9de
Packager:CentOSBuildSystem<[Link]
[Link]>
URL:[Link]
Summary:VerySecureFtpDaemon
Description:
[Link]
completelyfrom
scratch.

[Link]
PackageBeforeInstalling
[Link]

8/11

12/20/2015

20PracticalExamplesofRPMCommandsinLinux

Youhavedownloadapackagefromtheinternetandwanttoknow
[Link],the
followingoptionqip(queryinfopackage)willprinttheinformationof
apackagesqlbuddy.

[root@tecmint]#[Link]
m
Name:sqlbuddyRelocati
ons:(notrelocatable)
Version:1.3.3Vendor:
(none)
Release:1BuildDa
te:Wed02Nov20[Link]PMBDT
InstallDate:(notinstalled)BuildHo
st:[Link]
Group:Applications/InternetSourceR
PM:[Link]
Size:1155804License:
MIT
Signature:(none)
Packager:ErikMJacobs
URL:[Link]
Summary:SQLBuddyWebbasedMySQLadministr
ation
Description:
SQLBuddyisaPHPscriptthatallowsforwebbased
MySQLadministration.

[Link]
ofInstalledRPMPackage
Togetthelistofavailabledocumentationofaninstalledpackage,
usethefollowingcommandwithoptionqdf(querydocumentfile)
willdisplaythemanualpagesrelatedtovmstatpackage.

[root@tecmint]#rpmqdf/usr/bin/vmstat
/usr/share/doc/procps3.2.8/BUGS
/usr/share/doc/procps3.2.8/COPYING
/usr/share/doc/procps3.2.8/[Link]
/usr/share/doc/procps3.2.8/FAQ
/usr/share/doc/procps3.2.8/NEWS
/usr/share/doc/procps3.2.8/TODO
[Link]

9/11

12/20/2015

20PracticalExamplesofRPMCommandsinLinux

[Link]
Verifyingapackagecomparesinformationofinstalledfilesofthe
[Link](verifypackage)is
usedtoverifyapackage.

[root@tecmintdownloads]#rpmVpsqlbuddy1.3.31.
[Link]
S.5....T.c/etc/httpd/conf.d/[Link]

[Link]
Packages
Typethefollowingcommandtoverifyalltheinstalledrpmpackages.

[root@tecmint]#rpmVa
S.5....T.c/etc/rc.d/[Link]
.......T.c/etc/[Link]
.......T./etc/[Link].d/kernel2.6.32279.5.
[Link]
S.5....T.c/etc/[Link]
S.5....T.c/etc/[Link].d/[Link]

[Link]
key
ToverifyRHEL/CentOS/Fedorapackages,youmustimport
[Link],[Link]
importCentOS6GPGkey.

[root@tecmint]#rpmimport/etc/pki/rpmgpg/RPMG
PGKEYCentOS6

[Link]

10/11

12/20/2015

20PracticalExamplesofRPMCommandsinLinux

[Link]
GPGkeys
ToprintalltheimportedGPGkeysinyoursystem,usethefollowing
command.

[root@tecmint]#rpmqagpgpubkey*
gpgpubkey0608b8954bd22942
gpgpubkey7fac59914615767f
gpgpubkey0f2672c84cd950ee
gpgpubkeyc105b9de4e0fd3a3
gpgpubkey00f97f56467e318a
gpgpubkey6b8d79e63f49313d
gpgpubkey849c449f4cb9df30

[Link]
RPMDatabase
Sometimesrpmdatabasegetscorruptedandstopsallthe
[Link],atthe
timeweneedtorebuildtherpmdatabaseandrestoreitwiththehelp
offollowingcommand.

[root@tecmint]#cd/var/lib
[root@tecmint]#rm__db*
[root@tecmint]#rpmrebuilddb
[root@tecmint]#rpmdb_verifyPackages

[Link]

11/11

You might also like