search by tags

for the user

adventures into the land of the command line

mmm yum

yum (yellowdog updater modified) is a linux package manager written in python. it extends on the functionality of the rpm package manager in a couple of ways it gives you access to hundreds of thousands of versions of rpms in official redhate repositories and other third party public repositories all over the world it resolves dependancies for you, giving you a solution to the horrors of dependancy hell so how do you use yum? first you need to make sure your computer knows about repositories, which is where all the rpms are. yum’s repo config files are in

/etc/yum.repos.d/

you can set up access to a yum repository by putting a .repo file in here. for example

$ vim /etc/yum.repos.d/rhel-6-myrpms.repo

[rhel-6-myrpms]
name=rhel-6-myrpms
baseurl=http://hostname/or/domainname/and/path/to/repo
enabled=1
gpgcheck=0

if you’ve just added a new repo file, you should clear your local yum cache and remake all the metadata from the repo

$ yum clean all
$ yum makecache

this command will show you a list of all available repos, which ones are enabled or disabled, and how many rpms are available in them

$ yum repolist all

list all available versions of packages within a repo

$ yum list all --disablerepo="*" --enablerepo="rhel-6-myrpms" --showduplicates

list only the latest versions of those packages

$ yum list all --disablerepo="*" --enablerepo="rhel-6-myrpms"

list all available packages for the package you know the name of

$ yum list splunk --showduplicates

Available Packages
splunkforwarder.x86_64  6.0.3-204106        rhel-6-myrpms
splunkforwarder.x86_64  6.0.4-207768        rhel-6-myrpms

list more detailed info for a package

$ yum info splunk --showduplicates

Available Packages
Name       : splunkforwarder
Arch       : x86_64
Version    : 6.0.3
Release    : 204106
Size       : 11 M
Repo       : application-repo
Summary    : Splunk Universal Forwarder
License    : (C) 2005-2013 Splunk Inc. All Rights Reserved
Description: Splunk> The platform for machine data.

Name       : splunkforwarder
Arch       : x86_64
Version    : 6.0.4
Release    : 207768
Size       : 11 M
Repo       : application-repo
Summary    : Splunk Universal Forwarder
License    : (C) 2005-2013 Splunk Inc. All Rights Reserved
Description: Splunk> The platform for machine data.

list installed packages

$ yum list installed

list packages with updates available

$ yum list updates

list all dependencies and what packages provide those dependencies for the given packages

$ yum deplist somepackage

find out which package provides some feature or file

$ yum whatprovides somefeature

install the latest available version-release package

$ yum install somepackage

yum will tell you what its going to do before making any changes, but if you want to skip this check, you can force it with

$ yum -y install somepackage

install a specfic version-release of a package

$ yum install somepackage-1.0.1-1

uninstall a package

$ yum remove somepackage

update all available packages to their latest version. this is useful for patching a system

$ yum update all

upgrade a package to its latest available version

$ yum upgrade somepackage

upgrade a package to a specific version

$ yum upgrade somepackage-1.0.1-1

downgrade a package to a specific older version

$ yum downgrade somepackage-1.0.1-1

redhat have a pretty fantastic cheat sheet right here

i like yum