Reinstall Yum Packages
Mon, 21 Apr 2008 08:02:17
In the past I had added an additional repository to my Centos server. This was so I could use a later version of the mod_security module under apache. I decided I wanted to remove all the packages installed by this new repository as it was no longer being maintained.
Step one is to remove the .repo file from /etc/yum.repos.d/
Then run 'yum list extras' and notice the packages you want to remove
Then type 'rpm -e --justdb --nodeps <package-name1> <package-name2> <package-name3>' and list all the package names you want to reinstall.
Then 'yum install <package-name1> <package-name2> <package-name3>'
Yum will automatically re-install any missing binaries, but it will not overwrite your existing config files. Instead, the 'default' config files will be written as '<filename>.rpmnew'.
I found the information here (
http://www.liquidstate.net/2007/10/05/reinstalling-a-package-using-yum/ )
which proved an excellent resource.
Additional Nonsense:
[10:35] <rick111> i added a repo which had later versions on some core centos files, i installed the updates. now i've removed the repo and would like the old versions back, when i run 'yum update' it does not show me the files to downgrade, is this possible?
[10:38] <range> Not really. You have to remove those packages and install them again.
[10:38] * whatever-thingy (n=whatever@79-77-80-145.dynamic.dsl.as9105.com) has joined #centos
[10:39] <rick111> thanks
[10:39] * chmac7 (n=chmac@125.24.0.95.adsl.dynamic.totbb.net) has joined #centos
[10:39] <rick111> can i query what packages where installed by that repo?
[10:40] * chmac (n=chmac@125.24.23.233.adsl.dynamic.totbb.net) Quit (Nick collision from services.)
[10:40] <range> Depends on the repository.
[10:40] <rick111> if the option was available, how would i go about running the search?
[10:40] <range> Depends on the repository.
[10:41] * chmac7 is now known as chmac
[10:41] * Zylogue (n=Zylogue@wsip-98-174-167-3.ok.ok.cox.net) has joined #centos
[10:42] <range> Some of them encode the name of the repository into the package name, so you could search for that. On others you have to query buildhost or packager (with rpms queryoptions) to see where it comes from.
[10:42] <rick111> thanks
[10:44] * bman777 (n=bman@nat/ibm/x-98a728a5cec03df8) has joined #centos
[10:49] * alex[slx] (n=alex@unaffiliated/amusolino) has joined #centos
[10:54] * Norky (n=dan@milton.ocsl.co.uk) Quit (Read error: 104 (Connection reset by peer))
[10:54] <rick111> all packages had the word 'jason' in, but if i do a yum search *jason* it sayd nothing is installed?
[10:55] <cap_> rick111, "yum list extras" will list all installed packages that yum doesn't feel responsible for
[10:55] * Zylogue (n=Zylogue@wsip-98-174-167-3.ok.ok.cox.net) Quit ("Leaving")
[10:55] <cap_> rick111, you would want to do "rpm -qa | grep jason"
[10:55] <rick111> thank you
[10:55] <rick111> ahhh the extras thing found them, thanks cap_
[10:56] <cap_> :-)
[10:56] <cap_> as for the difference between "rpm -qa | grep ...
[10:56] <cap_> woops
[10:56] <cap_> "yum list '*str*'" and "yum search str"
[10:57] <rick111> ahhh!
[10:57] <cap_> the first will search in pkg-names/version/rel in installed packages only
[10:57] <cap_> yum list will search in names for all packages in available repos
[10:57] <cap_> and yum search will free text search in all available packages including description text etc.
[10:58] * Norky (n=dan@milton.ocsl.co.uk) has joined #centos
[10:58] <rick111> thats excellent thanks
Step one is to remove the .repo file from /etc/yum.repos.d/
Then run 'yum list extras' and notice the packages you want to remove
Then type 'rpm -e --justdb --nodeps <package-name1> <package-name2> <package-name3>' and list all the package names you want to reinstall.
Then 'yum install <package-name1> <package-name2> <package-name3>'
Yum will automatically re-install any missing binaries, but it will not overwrite your existing config files. Instead, the 'default' config files will be written as '<filename>.rpmnew'.
I found the information here (
http://www.liquidstate.net/2007/10/05/reinstalling-a-package-using-yum/ )
which proved an excellent resource.
Additional Nonsense:
[10:35] <rick111> i added a repo which had later versions on some core centos files, i installed the updates. now i've removed the repo and would like the old versions back, when i run 'yum update' it does not show me the files to downgrade, is this possible?
[10:38] <range> Not really. You have to remove those packages and install them again.
[10:38] * whatever-thingy (n=whatever@79-77-80-145.dynamic.dsl.as9105.com) has joined #centos
[10:39] <rick111> thanks
[10:39] * chmac7 (n=chmac@125.24.0.95.adsl.dynamic.totbb.net) has joined #centos
[10:39] <rick111> can i query what packages where installed by that repo?
[10:40] * chmac (n=chmac@125.24.23.233.adsl.dynamic.totbb.net) Quit (Nick collision from services.)
[10:40] <range> Depends on the repository.
[10:40] <rick111> if the option was available, how would i go about running the search?
[10:40] <range> Depends on the repository.
[10:41] * chmac7 is now known as chmac
[10:41] * Zylogue (n=Zylogue@wsip-98-174-167-3.ok.ok.cox.net) has joined #centos
[10:42] <range> Some of them encode the name of the repository into the package name, so you could search for that. On others you have to query buildhost or packager (with rpms queryoptions) to see where it comes from.
[10:42] <rick111> thanks
[10:44] * bman777 (n=bman@nat/ibm/x-98a728a5cec03df8) has joined #centos
[10:49] * alex[slx] (n=alex@unaffiliated/amusolino) has joined #centos
[10:54] * Norky (n=dan@milton.ocsl.co.uk) Quit (Read error: 104 (Connection reset by peer))
[10:54] <rick111> all packages had the word 'jason' in, but if i do a yum search *jason* it sayd nothing is installed?
[10:55] <cap_> rick111, "yum list extras" will list all installed packages that yum doesn't feel responsible for
[10:55] * Zylogue (n=Zylogue@wsip-98-174-167-3.ok.ok.cox.net) Quit ("Leaving")
[10:55] <cap_> rick111, you would want to do "rpm -qa | grep jason"
[10:55] <rick111> thank you
[10:55] <rick111> ahhh the extras thing found them, thanks cap_
[10:56] <cap_> :-)
[10:56] <cap_> as for the difference between "rpm -qa | grep ...
[10:56] <cap_> woops
[10:56] <cap_> "yum list '*str*'" and "yum search str"
[10:57] <rick111> ahhh!
[10:57] <cap_> the first will search in pkg-names/version/rel in installed packages only
[10:57] <cap_> yum list will search in names for all packages in available repos
[10:57] <cap_> and yum search will free text search in all available packages including description text etc.
[10:58] * Norky (n=dan@milton.ocsl.co.uk) has joined #centos
[10:58] <rick111> thats excellent thanks


