7

I made a big mistake: I removed yum. So now when I for example run the following it gives me an error:

$ yum clean all
yum command not found.

I can download the package succesfully:

wget mirror.centos.org/centos/6/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
--2014-01-15 15:42:59--  http://mirror.centos.org/centos/6/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
Resolving mirror.centos.org... 192.133.139.3
Connecting to mirror.centos.org|192.133.139.3|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1019540 (996K) [application/x-rpm]
Saving to: “yum-3.2.29-40.el6.centos.noarch.rpm.1”

100%[====================================================================================================================>] 1,019,540    649K/s   in 1.5s

2014-01-15 15:43:01 (649 KB/s) - “yum-3.2.29-40.el6.centos.noarch.rpm.1” saved [1019540/1019540]

Trying to install the downloaded package gives the following error:

# rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm
Preparing...                ########################################### [100%]
    file /usr/lib/python2.6/site-packages/yum/__init__.py from install of yum-3.2.29-40.el6.centos.noarch conflicts with file from package yum-3.2.29-30.el6.centos.noarch
[...]
file /usr/share/yum-cli/yummain.pyo from install of yum-3.2.29-40.el6.centos.noarch conflicts with file from package yum-3.2.29-30.el6.centos.noarch

There is no directory "yum" in /usr/bin.

When I use the command "rpm -qa | grep yum".

yum-metadata-parser-1.1.2-16.el6.x86_64
yum-plugin-fastestmirror-1.1.30-14.el6.noarch
yum-3.2.29-30.el6.centos.noarch

The distro is CentOS 6.3.
How can I reinstall yum?

az93
  • 857
  • you have the exact same problem as with your ftp issue the $PATH of your computer is f$$$$ up. please give us the content of command echo $PATH if you work as root please connect to root account with the command su - and not su – Kiwy Jan 15 '14 at 14:48

3 Answers3

8

Given you already have yum installed you cannot do a rpm -ivh ... This command will install an RPM that hasn't been installed yet. Instead you should use either rpm -Uvh ... to upgrade the yum package or remove it first, rpm -e yum.

I would suggest doing an upgrade on the package.

$ wget http://mirror.centos.org/centos/6/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
rpm -Uvh yum-3.2.29-40.el6.centos.noarch.rpm

Relying on the package manager

RPM can help you fix issues like this, or at the very least, help to identify issues. The rpm command includes the ability to verify the packages it maintains.

 $ rpm -V yum

If there isn't an issue it will simply return nothing. If there are issues it will tell you which files are at fault.

$ rpm -V httpd
SM5....T  c /etc/httpd/conf/httpd.conf

The letters/numbers tell you about various aspects of the package which are out of specification with what was originally installed.

excerpt from rpm man page

Each of the 9 characters denotes the result of a comparison of attribute(s) of the file to the value of those attribute(s) recorded in the database. A single "." (period) means the test passed, while a single "?" (question mark) indicates the test could not be performed (e.g. file permissions prevent reading). Otherwise, the (mnemonically emBoldened) character denotes failure of the corresponding --verify test:

   S file Size differs
   M Mode differs (includes permissions and file type)
   5 digest (formerly MD5 sum) differs
   D Device major/minor number mismatch
   L readLink(2) path mismatch
   U User ownership differs
   G Group ownership differs
   T mTime differs
   P caPabilities differ
slm
  • 369,824
  • 1
    @az93 - terrific! Glad that solved your issue. Please mark this A as accepted so other's know your issue's been resolved. – slm Jan 15 '14 at 14:41
0

Download yum (no idea what distro you are using) you can try from here and then install the pkg with

rpm -ivh <rpm_file_name>

or check out the yum project page. For example, for yum 3.2.29-40 (32bit):

wget http://mirror.centos.org/centos/6/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm –
terdon
  • 242,166
b13n1u
  • 524
0

Here I’m listing the steps to resolve this problem. Execute the following YUM command for that.

  1. Eliminate all of the header files which yum uses for dependency resolution.

    # yum clean headers
    
  2. Remove all of the packages held in the caches

    # yum clean packages
    
  3. Remove all metadata

    # yum clean metadata
    
  4. Clean dbcache

    # yum clean dbcache
    
  5. Clean all

    # yum clean all
    

Run the update command, if all of the above mentioned commands didn’t solve the issue.

# yum -y update

If yum update failed it may be due to the corruption in RPM database under /var/lib/rpm/ location. Please do follow the below pasted steps to resolve the issue.

# rm -f /var/lib/rpm/__db.*
# rpm -vv –rebuilddb
# yum update

That’s it.

Source: [Solved] The server’s system package manager, ‘YUM’, failed : Error with easyapache

eyoung100
  • 6,252
  • 23
  • 53
Shiv Singh
  • 151
  • 8