You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

I catch myself sometimes needing to temporarily install a package on a server (e.g. Firefox) but when I do it installs a ton of dependencies only needed for this one temporary package.

# yum install firefox
...
Resolving Dependencies
--> Finished Dependency Resolution
Dependencies Resolved
...
Transaction Summary
================================================================================================================================================================================
Install  1 Package (+47 Dependent packages)

So, then when I go to remove the temporary package, I now also need to remove all of the dependent packages that it just installed.  That can be a pain to do manually.

Here's a method I use to make this a bit simpler:

bash
TIMESTAMP=`tail -1 /var/log/yum.log | awk -F: '{ print $1 ":" $2 }' | sed s'/.$//'`
yum remove `grep $TIMESTAMP /var/log/yum.log | awk '{ print $5 }' | sed 's/\-[0-9].*$//g' | sed 's/^[0-9]://g'`

 

I'm guessing that perhaps YUM has an easier way to do this natively, but for now this approach is better than doing the removals manually.

  • No labels