Software >> OS >> Unix >> Linux >> Red Hat Enterprise Linux >>  How to use rpm or yum to manage software packages

rpm

list all installed packages rpm -qa
show information about specific package rpm -qi packagename
install a package with verbose output rpm -ivh package.rpm
uninstall current version  rpm -e packagename
list dependencies 

rpm -qRp package.rpm

rpm -qR packagename

list files in package

rpm -qlp package.rpm

rpm -ql packagename

test package installation rpm -ivh  - - test  packagename 
install all rpms that depend on each other.
 

put all .rpm in one directory

rpm -ivh *.rpm

 

yum

list installed packages yum list installed
list repositories yum repolist
search package by name yum search firefox
install from repository yum install firefox
install without using repository yum --disablerepo=* localinstall /var/tmp/rhel6/*.rpm
create and use the RHEL install CD as yum repository

e.g. for RHEL 6.1

# mkdir /mnt/iso
# mount -t iso9660 /dev/sr0 /mnt/iso
# mkdir /etc/rpm-gpg
# cp /mnt/iso/RPM-GPG-KEY-redhat-release /etc
# vi /etc/yum.repos.d/dvd.repo


dvd.repo

[rhel6.1-local]
name=RHEL 6.1 local repository
baseurl=file:///mnt/iso/
gpgcheck=1
gpgkey=file:///etc/rpm-gpg/RPM-GPG-KEY-redhat-release
enabled=1

list the repo

# yum repolist

search package from the repo

# yum search packagename

install from the repo

# yum install packagename