Yum
From Wsms
Note: This page should be titled yum (all lowercase). It is Yum due to technical limitations of Mediawiki.
Yum is short for "Yellowdog Updater Modified". It is a high-level tool for managing the rpm packages that constitute a Fedora Linux installation.
Contents |
Common Usage
[root@arthur ~]# yum list 2>&1 | tee yum.list # Generate a file listing installed and available packages [root@arthur ~]# yum -y install emacs # Install a single package [root@arthur ~]# yum -y update 2>&1 | tee yum-200703116.out # Update everything sending the output to both a file and the terminal.
Log File
Yum's log file is /var/log/yum
Automatic Updates
On Fedore Core 5
Start the yum deamon with:
[root@arthur ~]# chkconfig yum on [root@arthur ~]# service yum start Enabling nightly yum update: [ OK ]
See: http://www.linuxjournal.com/article/7448
On Fedora Core 6
Fedora Core 6 featues yum-updatesd in place of Fedora Core 5's yum deamon. By default, it checks for updates and notifies you when they are available. See the discussion below under common errors.
To make yum-updatesd auto update, you have to change /etc/yum/yum-updatesd.conf. Here is a sample:
[main] # how often to check for new updates (in seconds) run_interval = 3600 # how often to allow checking on request (in seconds) updaterefresh = 600 # how to send notifications (valid: dbus, email, syslog) emit_via = dbus # automatically install updates do_update = yes # automatically download updates do_download = yes # automatically download deps of updates do_download_deps = yes
Caveats
Some installs and updates, usually new kernels, require a reboot. The reboot is not automated.
Common Errors
[Errno -1] Metadata file does not match checksum
If you get this time after time, it means that yum is confused. Kill yum by hitting Ctrl-C many times in succession, then:
[root@localhost ~]# yum clean all
yum crashes with a traceback
Rarely, yum's metadata file gets messed up for unknown reasons. You get a traceback like this:
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in ?
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 229, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 145, in main
(result, resultmsgs) = base.buildTransaction()
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 647, in buildTransaction
(rescode, restring) = self.resolveDeps()
File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 704, in resolveDeps
for po, dep in self._checkFileRequires():
File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 939, in _checkFileRequires
if not self.tsInfo.getOldProvides(filename) and not self.tsInfo.getNewProvides(filename):
File "/usr/lib/python2.4/site-packages/yum/transactioninfo.py", line 414, in getNewProvides
for pkg, hits in self.pkgSack.getProvides(name, flag, version).iteritems():
File "/usr/lib/python2.4/site-packages/yum/packageSack.py", line 300, in getProvides
return self._computeAggregateDictResult("getProvides", name, flags, version)
File "/usr/lib/python2.4/site-packages/yum/packageSack.py", line 470, in _computeAggregateDictResult
sackResult = apply(method, args)
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 861, in getProvides
return self._search("provides", name, flags, version)
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 43, in newFunc
return func(*args, **kwargs)
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 837, in _search
for pkg in self.searchFiles(name, strict=True):
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 43, in newFunc
return func(*args, **kwargs)
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 586, in searchFiles
self._sql_pkgKey2po(rep, cur, pkgs)
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 470, in _sql_pkgKey2po
pkg = self._packageByKey(repo, ob['pkgKey'])
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 413, in _packageByKey
po = self.pc(repo, cur.fetchone())
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 68, in __init__
self._read_db_obj(db_obj)
File "/usr/lib/python2.4/site-packages/yum/sqlitesack.py", line 94, in _read_db_obj
setattr(self, item, _share_data(db_obj[item]))
TypeError: unsubscriptable object
You can fix this with:
[root@arthur ~]# yum clean metadata
Then you run yum -y update and it should work.
see: https://bugzilla.redhat.com/show_bug.cgi?id=491916
Existing lock /var/run/yum.pid: another copy is running. Aborting.
Right after you boot up Fedora Core 6 and log in yum-updatesd starts looking for updates. This interfers with the normal usage of yum for several minutes. You will see an error message like this:
[root@localhost ~]# yum -y update Loading "installonlyn" plugin Existing lock /var/run/yum.pid: another copy is running. Aborting.
tips
Use the localinstall option to pull in dependencies.
Add extra repositories and their keys. You may want to use the RPMForge or other repositories that include RPMs not available in the basic redhat or centos install. Add the rpmforge repository as in http://wiki.centos.org/Repositories/RPMForge.
localinstall and deplist options
Some of the functionality you might think belongs in the rpm command is build into yum:
To install an rpm from your drive and have yum pull in the dependencies from the repositories:
yum localinstall <rpm-package-name>
To see what the dependencies for a package are:
yum deplist <rpm-package-name>
See also
Rpm
man yum
man yum-updatesd
man yum-updatesd.conf
Paranoid Penguin - Using Yum for RPM Updates By Mick Bauer http://www.linuxjournal.com/article/7448
http://www.fedorafaq.org/#installsoftware Adding addition yum repositories for multimedia packages.
http://www.linuxjournal.com/node/7448/print Paranoid Penguin - Using Yum for RPM Updates
