Yum Tips and Tricks (2009-02-08 classroom)

From FedoraProject

Jump to: navigation, search
---nirik has changed the topic to: Fedora IRC Classroom - Using Yum - Tricks and tips with your teacher Kevin Fenzi (nirik) - See https://fedoraproject.org/wiki/Classroom for schedule of tonights classes. Feb 07 03:00
nirik Welcome everyone. Feb 07 03:00
nirik I am going to be talking about yum and yum-utils and various utils around yum tonight. Feb 07 03:00
-->kaos01 (n=kaos01@turing.une.edu.au) has joined #fedora-classroom Feb 07 03:00
-->jsubl2 (n=jsubl2@adsl-75-53-44-81.dsl.rcsntx.sbcglobal.net) has joined #fedora-classroom Feb 07 03:00
nirik I'm happy to adjust the class based on what folks want to hear... otherwise I will start out with some basic info about yum and go from there. Feb 07 03:01
aTypical That sounds good to me, nirik Feb 07 03:01
nirik So, what is yum? It's a command line package management utility. Feb 07 03:01
-->suyashkmr (n=SK@122.172.7.162) has joined #fedora-classroom Feb 07 03:02
nirik You will need to open up a terminal and 'su' to become root to use many of yums commands/options Feb 07 03:02
-->franciscod_ (n=Ankur@122.172.7.162) has joined #fedora-classroom Feb 07 03:02
nirik First, there are a set of basic commands with yum itself: Feb 07 03:02
nirik yum check-update Feb 07 03:03
-->mib_beksxo5f (i=d2d40556@gateway/web/ajax/mibbit.com/x-8ea42f10e65370af) has joined #fedora-classroom Feb 07 03:03
nirik will check to see if there are newer packages that have been updated by fedora (or any other repositories you have defined) and list them. Feb 07 03:03
nirik yum install packagename Feb 07 03:03
nirik will install packagename if it's available from any of the repositories you have enabled. It will also install any packages that are needed by that one to function (dependencies). Feb 07 03:04
nirik it's worth noting that it will ask you if you still want to install it after it has the list of dependencies. Feb 07 03:04
nirik yum remove packagename Feb 07 03:04
nirik will remove a package Feb 07 03:05
nirik yum info packagename Feb 07 03:05
herlo nicklist off Feb 07 03:05
nirik will show you some info about a package, similar to the rpm -qi we saw eariler. Feb 07 03:05
herlo sorrry Feb 07 03:05
-->francisc1d_ (n=Ankur@122.172.7.162) has joined #fedora-classroom Feb 07 03:06
nirik yum update or yum upgrade get a list of updates pending and offers to download and upgrade them for you. Feb 07 03:06
nirik note that in recent fedoras they are the same thing. Feb 07 03:06
nirik (unless you have changed config file values) Feb 07 03:07
nirik yum also has a bunch of group commands... Feb 07 03:07
<--jsubl2 (n=jsubl2@adsl-75-53-44-81.dsl.rcsntx.sbcglobal.net) has left #fedora-classroom Feb 07 03:07
nirik yum grouplist - list all the groups available Feb 07 03:07
nirik yum groupinstall "group name" - install all the packages in a group Feb 07 03:07
nirik etc. See the yum man page 'man yum' for the entire list. ;) Feb 07 03:08
nirik ok, so those are kinda the small subset of commands that most people will use/see... Feb 07 03:08
nirik any questions on those? Feb 07 03:09
<--mib_beksxo5f has quit (Client Quit) Feb 07 03:09
aTypical So far, so good. Feb 07 03:09
<--franciscod has quit (Read error: 110 (Connection timed out)) Feb 07 03:09
kaos01 all cool Feb 07 03:09
nirik ok, a few more informative commands that perhaps people don't know as well: Feb 07 03:09
nirik yum repolist Feb 07 03:10
nirik will show you all the repositories you have enabled currently. This can be handy in debugging problems. Feb 07 03:10
nirik yum localinstall packagename.rpm Feb 07 03:10
nirik will allow you to install a local package you have downloaded, plus any dependencies it has. Feb 07 03:10
nirik you can also disable or enable repos for just one command. For this you use '--disablerepo=name' or '--enablerepo=name' Feb 07 03:11
brunowolff Is "localinstall" implied when you give a package name ending in .rpm ? Feb 07 03:12
nirik this is often handy for getting just one package from the updates-testing repo or the like Feb 07 03:12
nirik brunowolff: I don't think so... you have to pass it a valid rpm package file... ie, 'yum localinstall /path/to/file.rpm' Feb 07 03:12
brunowolff I am pretty sure I did yum install something.rpm and had it work. Feb 07 03:12
-->TheFord (n=rmorris@c-68-83-209-38.hsd1.va.comcast.net) has joined #fedora-classroom Feb 07 03:13
nirik it's possible. ;) The yum guys are always adding cool new features... ;) Feb 07 03:13
nirik brunowolff: we can check after the session? should be easy to test. ;) Feb 07 03:13
<--skorcher has quit (Read error: 110 (Connection timed out)) Feb 07 03:14
nirik so, for installing just one package from updates-testing, you could do something like 'yum install packagename --enablerepo=fedora-updates-testing' Feb 07 03:14
<--SM0TVI has quit (Read error: 110 (Connection timed out)) Feb 07 03:14
-->rtnpro (n=rtnpro@125.20.11.34) has joined #fedora-classroom Feb 07 03:14
nirik another handy one which gets used on rawhide / development installs more than anywhere, is '--skip-broken' Feb 07 03:15
nirik this allows yum to update only the things that don't have problems... Feb 07 03:15
-->che (n=rkastl@redhat/che) has joined #fedora-classroom Feb 07 03:16
nirik ok, thats the base yum commands... now I was going to take a bit about 'yum shell' Feb 07 03:16
nirik yum also has the ability to run in a 'shell' mode. Feb 07 03:17
nirik this is invoked via 'yum shell'. You can do some pretty advanced things here. Feb 07 03:17
nirik you can for example remove one package and install another in a single transaction... instead of having to yum remove then yum install. Feb 07 03:17
nirik I don't know how much we want to get into it's details, but it's a powerfull tool worth mentioning. Feb 07 03:18
nirik ok, next I wanted to move on to yum plugins. Feb 07 03:18
nirik There are a number of plugins available for yum that add on to it, or change it's behavior. Feb 07 03:19
nirik You can take a look at this list with: yum list 'yum-*' Feb 07 03:19
nirik A few to mention: Feb 07 03:20
nirik the yum-fastestmirror plugin is pretty popular. It allows a simplistic check on the mirrors you have available to you and tries to send you to the 'fastest' one. Feb 07 03:20
nirik sadly it can sometimes point you to an out of date mirror also, so be careful when using it. Feb 07 03:21
nirik the yum-presto plugin will likely become more popular in later releases. It allows you to download a delta of a update instead of the entire package again... Feb 07 03:21
nirik saving much bandwith. Feb 07 03:21
nirik There aren't any official fedora mirrors setup for this yet, but it's being worked on. Feb 07 03:22
nirik Another plugin of interest is the yum-security plugin. This will allow you to only apply security updates, and not all updates (bugfix and enhancement) that come out. Feb 07 03:22
<--VileGent has quit (Remote closed the connection) Feb 07 03:23
nirik Anyone have any questions on plugins? Feb 07 03:23
kaos01 the new yum-post-transaction-actions is quite usefull :) Feb 07 03:23
nirik indeed. There are lots of interesting ones. Feb 07 03:23
-->EvilBob (n=EvilBob@fedora/bobjensen) has joined #Fedora-Classroom Feb 07 03:24
nirik ok, moving on, I'd like to talk about yum-utils for a bit. Feb 07 03:24
nirik yum-utils are some associated utilities. It is a seperate package from yum, but it's installed by default now on recent fedora releases. Feb 07 03:24
nirik you can run a 'rpm -ql yum-utils' to see all the bundled utils in the package. Feb 07 03:25
<--Guest123 has quit (Excess Flood) Feb 07 03:25
nirik I'll point out 3 or so of them: Feb 07 03:25
-->Guest123 (i=KVIrc@c80-216-141-34.bredband.comhem.se) has joined #Fedora-Classroom Feb 07 03:25
nirik yumdownloader - this handy util lets you download packages. It does not install them, just downloads them... Feb 07 03:26
nirik it has some nifty arguments as well: --url will just show the url of the package (handy for pasting to someone else on irc) Feb 07 03:26
nirik --source will get the source package instead of the normal binary package. Feb 07 03:26
nirik so you can get source to some package you are interested in (in src.rpm form) Feb 07 03:27
nirik you can pass it --enablerepo and --disablerepo as well. Feb 07 03:27
nirik so you can get the url to a source rpm for a repo you don't even normally have enabled. ;) Feb 07 03:28
nirik Any questions on yumdownloader? Feb 07 03:28
<--suyashkmr has quit ("leaving") Feb 07 03:28
-->skorcher (n=SK@122.172.7.162) has joined #fedora-classroom Feb 07 03:29
nirik next up is 'debuginfo-install'. Feb 07 03:29
nirik this allows you to install debuginfo packages. You need these if you are debugging a program thats crashing... Feb 07 03:29
nirik this util will fetch not only the debuginfo for the package you name, but all the ones it depends on as well. Feb 07 03:30
nirik Finally in yum-utils, I'd like to talk about 'yum-complete-transaction' Feb 07 03:30
nirik Has anyone here ever had a machine loose power in the middle of an update? Feb 07 03:31
skorcher yes Feb 07 03:31
nirik This can be pretty messy as you have a bunch of packages half installed and it's in a weird state. Feb 07 03:31
brunowolff More likely had X go away when not using 'screen' to run the yum command. Feb 07 03:31
nirik This command will allow you to tell yum to finish it's last uncompleted transaction. Feb 07 03:32
nirik So, in some cases you can just run this and everything is all back to normal. Feb 07 03:32
brunowolff It actually will do the oldest uncompleted transaction if you have more than one. Feb 07 03:32
*nirik nods. Feb 07 03:32
nirik correct. You can also tell it to forget about some pending ones you dont want it to complete anymore. Feb 07 03:33
nirik so, it's a pretty handy command. Feb 07 03:33
nirik If you don't have any pending transactions, it will tell you so. Feb 07 03:33
nirik ok, I would like to take a bit about searching for things now... unless anyone has any questions on anything so far? Feb 07 03:34
brunowolff Are you going to cover package-cleanup? That's nice for people doing yum upgrades. Feb 07 03:35
nirik brunowolff: yeah, we can go over that one real quick... Feb 07 03:35
-->rtnpro_ (n=rtnpro@117.201.96.69) has joined #fedora-classroom Feb 07 03:35
nirik package-cleanup is another util that allows you to look for and clean up some problems with your installed package collection. Feb 07 03:35
nirik the --problems flag will tell you about problems you have, like missing dependencies or the like. Feb 07 03:36
nirik -d will tell you about duplicate packages you have installed. Feb 07 03:36
nirik ie, from an update or transaction that never finished right. Feb 07 03:36
nirik --cleandupes will also clean out the older versions of any duplicate packages. Feb 07 03:37
nirik --orphans will tell you about any packages you have installed that are NOT available in any repo you have enabled. Feb 07 03:37
nirik you can also get this info from 'yum list extras' Feb 07 03:37
nirik this can tell you what locally built or 3rd party packages were installed on a machine. Feb 07 03:38
rtnpro_ nirik, ! Feb 07 03:38
nirik go ahead rtnpro_ Feb 07 03:38
rtnpro_ nirik, lately my kernel was not getting updated, but when I did yum clean all, it did Feb 07 03:39
nirik rtnpro_: great question. It was telling you that you had no updates pending? Feb 07 03:40
nirik yum keeps a cache locally to speed up some actions. Feb 07 03:40
nirik so, it will check the mirrors for updates only once that cache has timed out. Usually this isn't a problem, but sometimes you want it to check more often. Feb 07 03:41
nirik you can use 'yum clean all', but that will also clean out any downloaded packages you have around, and any copies of any of the metadata. Feb 07 03:41
nirik you can use just 'yum clean metadata' if you want it to check again for everything, right then. Feb 07 03:42
rtnpro_ nirik, can you explain why ? Feb 07 03:42
rtnpro_ nirik, rather it gave me some dependency incompatibilities Feb 07 03:42
nirik rtnpro_: ah, do you by any chance have any kmod packages installed from rpmfusion? Feb 07 03:42
nirik in that case, when fedora releases a new kernel, rpmfusion builds a new kmod package, but you have to wait for them both to sync out. If you only have one available on your mirrors, Feb 07 03:43
nirik you run into a dependency problem with kernel upgrades. Feb 07 03:43
nirik does that make sense? Feb 07 03:43
rtnpro_ nirik, yes kmod-nvidia Feb 07 03:43
nirik rtnpro_: I can get you a post that explains it in more detail after the class if you like... Feb 07 03:44
nirik ok, shall we move on to searching? then perhaps go to some q&a? Feb 07 03:44
nirik so you can use yum to search for things. You have seen 'yum list' to list package names, but yum also has other search features. Feb 07 03:45
brunowolff Can you talk about setting options in the config file, such as making skip broken the default? Feb 07 03:45
nirik brunowolff: sure thing. Lets talk about searching for a bit then cover that... Feb 07 03:45
brunowolff Oops I got ahead. Feb 07 03:45
<--rtnpro has quit (Read error: 110 (Connection timed out)) Feb 07 03:45
nirik yum has a 'search' feature... which searchs the package name, the description and summary... Feb 07 03:46
nirik ie, 'yum search fingerprint' for example to show any package with that in those fields. Feb 07 03:46
nirik Sometimes you will want to find out what package owns a particular file that you want... you can use 'yum provides' for that... with wildcards. Feb 07 03:47
nirik ie, 'yum provides '/*bash Note that you want to use /* there if you don't know the path so that yum knows you are talking about a file path and not a name Feb 07 03:48
brunowolff Wouldn't */bash be better? Feb 07 03:48
-->rtnpro (n=rtnpro@117.201.96.69) has joined #fedora-classroom Feb 07 03:49
<--rtnpro_ has quit (Read error: 104 (Connection reset by peer)) Feb 07 03:49
nirik brunowolff: yeah, that will work now I guess. it used to be that / needed to be first so yum knew it was a path... Feb 07 03:49
brunowolff That has definitely changed, since I use leading */ on my searches. Feb 07 03:50
nirik ok, any questions on searching? Feb 07 03:50
<--Guest123 has quit (Read error: 110 (Connection timed out)) Feb 07 03:50
nirik brunowolff: yeah, it's changed, but I am not sure in which release... Feb 07 03:50
inode0 what if the file you are searching for ins't installed? Feb 07 03:51
brunowolff Why does yum use provides to mean what you uses whatprovides for. I found that confusing. Feb 07 03:51
nirik inode0: it doesn't matter. It searches yum's info from the mirrors. Feb 07 03:51
brunowolff And related to that is there a way to get what a package provides from yum? Feb 07 03:52
nirik inode0: so the good thing is that it doesn't have to be installed. ;) Feb 07 03:52
nirik brunowolff: yeah, you mean rpm there ? I don't know why they are different. Feb 07 03:52
brunowolff There should have been an 'rpm' in there somewhere. Feb 07 03:52
nirik I don't think you can get that from yum... but there is another command: repoquery This will let you do all kinds of queries on packages. Feb 07 03:53
nirik repoquery -q --provides foobar Feb 07 03:54
nirik ok, we are running low on time... lets talk about the config file. Feb 07 03:54
nirik yum uses a config file in /etc/yum.conf Feb 07 03:54
nirik you can look at all the options via 'man yum.conf' Feb 07 03:54
brunowolff That should do. It's a pain to use rpm for stuff that isn't installed, even with a local mirror. Feb 07 03:54
nirik you can use for example 'skip_broken=1' to set it to be on by default in /etc/yum.conf. Feb 07 03:55
nirik brunowolff: yeah. repoquery works, but it can be slow... ;) Feb 07 03:55
nirik It's worth noting that any plugin config is done in /etc/yum/pluginconf.d/ Feb 07 03:56
nirik not in the main yum.conf. Feb 07 03:56
nirik brunowolff: did that answer your question on skip_broken/ Feb 07 03:56
brunowolff Yes. I think for plugins as well. I wasn't sure if they went in the main file or somewhere else. Feb 07 03:57
nirik any further questions before we wrap up? Feb 07 03:57
brunowolff I did test not having to use localinstall and at least for names ending in .rpm 'install' will work. Feb 07 03:58
nirik excellent. Thanks for the info brunowolff Feb 07 03:59
nirik its worth noting that for rpm it doesn't care what the file is called... it could be foobar.doc and if it's a valid rpm file it will still operate on it fine. Feb 07 04:00
nirik ok, thanks everyone! Feb 07 04:00

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!