Difference between rpm and yum

rpm ( redhat package manager)
is  a powerful Package Manager, which can be used to build, install, query, verify, update, and erase individual software packages.
RPM is the default package manager in default but rpm is not  having the advantage of tracking dependencies .

Install a package using rpm
#rpm -ivh packagename.rpm

i – install
v – verbose
h – display status hash bar

install a package with out considering dependancy
#rpm -ivh –nodep packagename.rpm

remove a package
#rpm -e packagename.rpm

Show installed packages
# rpm -qa

Find the corresponding package of a binary
# which ls

# rpm -qf /bin/ls

To find the files installed by a specific package
# rpm -ql coreutils-5.97-23.el5_4.1

yum ( Yellow Dog Update Modifier)
is  an interactive, rpm based, package manager. It can automatically perform system updates, including dependency analysis and obsolete processing based on “repository” meta-
data. It can also perform installation of new packages, removal of old packages and perform queries on the installed and/or available packages among many  other  commands/services
(see below). yum is similar to other high level package managers like apt-get and smart

If you want to install a package , first check whether the package is already installed or not

# yum list | grep httpd
# yum install httpd
# yum remove httpd
Or even we can install multiple packages in a single command
# yum install httpd vsftpd
# yum upgrade httpd
# yum search | grep httpd
# yum info httpd
# yum clean
to remove/clean yum cache
# yum downgrade
Will  try  and  downgrade  a  package from the version currently installed to the previously highest version
# yum -y httpd
Assume yes; assume that the answer to any question which would be asked is yes

yum list :  List all available and installed packages
yum list available :  List all packages in the yum repositories available to be installed
yum list updates : List all packages with updates available in the yum repositories
yum list recent :   List packages recently added into the repositories.
yum clean all :   Runs yum clean packages and yum clean headers, yum clean metadata and yum clean dbcache as above.

Yum can view the yum installation tips here install yum on CentOs 5